1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 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 IoSession#setIdleTime(IdleStatus,int)}. 33 * 34 * @author The Apache Directory Project (mina-dev@directory.apache.org) 35 * @version $Rev: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (Fri, 13 Jul 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("reader idle"); 43 44 /** 45 * Represents the session status that the session is not writing any data. 46 */ 47 public static final IdleStatus WRITER_IDLE = new IdleStatus("writer idle"); 48 49 /** 50 * Represents both {@link #READER_IDLE} and {@link #WRITER_IDLE}. 51 */ 52 public static final IdleStatus BOTH_IDLE = new IdleStatus("both idle"); 53 54 private final String strValue; 55 56 /** 57 * Creates a new instance. 58 */ 59 private IdleStatus(String strValue) { 60 this.strValue = strValue; 61 } 62 63 /** 64 * Returns the string representation of this status. 65 * <ul> 66 * <li>{@link #READER_IDLE} - <tt>"reader idle"</tt></li> 67 * <li>{@link #WRITER_IDLE} - <tt>"writer idle"</tt></li> 68 * <li>{@link #BOTH_IDLE} - <tt>"both idle"</tt></li> 69 * </ul> 70 */ 71 public String toString() { 72 return strValue; 73 } 74 }