01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: *
19: */
20: package org.apache.mina.common;
21:
22: /**
23: * Represents the type of idleness of {@link IoSession} or
24: * {@link IoSession}. There are three types of idleness:
25: * <ul>
26: * <li>{@link #READER_IDLE} - No data is coming from the remote peer.</li>
27: * <li>{@link #WRITER_IDLE} - Session is not writing any data.</li>
28: * <li>{@link #BOTH_IDLE} - Both {@link #READER_IDLE} and {@link #WRITER_IDLE}.</li>
29: * </ul>
30: * <p>
31: * Idle time settings are all disabled by default. You can enable them
32: * using {@link IoSessionConfig#setIdleTime(IdleStatus,int)}.
33: *
34: * @author The Apache MINA Project (dev@mina.apache.org)
35: * @version $Rev: 593474 $, $Date: 2007-11-09 03:14:12 -0700 (Fri, 09 Nov 2007) $
36: */
37: public class IdleStatus {
38: /**
39: * Represents the session status that no data is coming from the remote
40: * peer.
41: */
42: public static final IdleStatus READER_IDLE = new IdleStatus(
43: "reader idle");
44:
45: /**
46: * Represents the session status that the session is not writing any data.
47: */
48: public static final IdleStatus WRITER_IDLE = new IdleStatus(
49: "writer idle");
50:
51: /**
52: * Represents both {@link #READER_IDLE} and {@link #WRITER_IDLE}.
53: */
54: public static final IdleStatus BOTH_IDLE = new IdleStatus(
55: "both idle");
56:
57: private final String strValue;
58:
59: /**
60: * Creates a new instance.
61: */
62: private IdleStatus(String strValue) {
63: this .strValue = strValue;
64: }
65:
66: /**
67: * Returns the string representation of this status.
68: * <ul>
69: * <li>{@link #READER_IDLE} - <tt>"reader idle"</tt></li>
70: * <li>{@link #WRITER_IDLE} - <tt>"writer idle"</tt></li>
71: * <li>{@link #BOTH_IDLE} - <tt>"both idle"</tt></li>
72: * </ul>
73: */
74: @Override
75: public String toString() {
76: return strValue;
77: }
78: }
|