1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.mina.common;
20
21 import org.apache.mina.io.IoSession;
22 import org.apache.mina.protocol.ProtocolSession;
23
24 /***
25 * Represents the type of idleness of {@link IoSession} or
26 * {@link ProtocolSession}. There are three types of idleness:
27 * <ul>
28 * <li>{@link #READER_IDLE} - No data is coming from the remote peer.</li>
29 * <li>{@link #WRITER_IDLE} - Session is not writing any data.</li>
30 * <li>{@link #BOTH_IDLE} - Both {@link #READER_IDLE} and {@link #WRITER_IDLE}.</li>
31 * </ul>
32 * <p>
33 * Idle time settings are all disabled by default. You can enable them
34 * using {@link SessionConfig#setIdleTime(IdleStatus,int)}.
35 *
36 * @author Trustin Lee (trustin@apache.org)
37 * @version $Rev: 210062 $, $Date: 2005-07-11 12:52:38 +0900 $
38 */
39 public class IdleStatus
40 {
41 /***
42 * Represents the session status that no data is coming from the remote
43 * peer.
44 */
45 public static final IdleStatus READER_IDLE = new IdleStatus( "reader idle" );
46
47 /***
48 * Represents the session status that the session is not writing any data.
49 */
50 public static final IdleStatus WRITER_IDLE = new IdleStatus( "writer idle" );
51
52 /***
53 * Represents both {@link #READER_IDLE} and {@link #WRITER_IDLE}.
54 */
55 public static final IdleStatus BOTH_IDLE = new IdleStatus( "both idle" );
56
57 private final String strValue;
58
59 /***
60 * Creates a new instance.
61 */
62 private IdleStatus( String strValue )
63 {
64 this.strValue = strValue;
65 }
66
67 /***
68 * Returns the string representation of this status.
69 * <ul>
70 * <li>{@link #READER_IDLE} - <tt>"reader idle"</tt></li>
71 * <li>{@link #WRITER_IDLE} - <tt>"writer idle"</tt></li>
72 * <li>{@link #BOTH_IDLE} - <tt>"both idle"</tt></li>
73 * </ul>
74 */
75 public String toString()
76 {
77 return strValue;
78 }
79 }