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.core.session; 21 22 23 /** 24 * Represents the type of idleness of {@link IoSession} or 25 * {@link IoSession}. There are three types of idleness: 26 * <ul> 27 * <li>{@link #READER_IDLE} - No data is coming from the remote peer.</li> 28 * <li>{@link #WRITER_IDLE} - Session is not writing any data.</li> 29 * <li>{@link #BOTH_IDLE} - Both {@link #READER_IDLE} and {@link #WRITER_IDLE}.</li> 30 * </ul> 31 * <p> 32 * Idle time settings are all disabled by default. You can enable them 33 * using {@link IoSessionConfig#setIdleTime(IdleStatus,int)}. 34 * 35 * @author The Apache MINA Project (dev@mina.apache.org) 36 * @version $Rev: 671827 $, $Date: 2008-06-26 10:49:48 +0200 (jeu, 26 jun 2008) $ 37 */ 38 public class IdleStatus { 39 /** 40 * Represents the session status that no data is coming from the remote 41 * peer. 42 */ 43 public static final IdleStatus READER_IDLE = new IdleStatus("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("writer idle"); 49 50 /** 51 * Represents both {@link #READER_IDLE} and {@link #WRITER_IDLE}. 52 */ 53 public static final IdleStatus BOTH_IDLE = new IdleStatus("both idle"); 54 55 private final String strValue; 56 57 /** 58 * Creates a new instance. 59 */ 60 private IdleStatus(String strValue) { 61 this.strValue = strValue; 62 } 63 64 /** 65 * Returns the string representation of this status. 66 * <ul> 67 * <li>{@link #READER_IDLE} - <tt>"reader idle"</tt></li> 68 * <li>{@link #WRITER_IDLE} - <tt>"writer idle"</tt></li> 69 * <li>{@link #BOTH_IDLE} - <tt>"both idle"</tt></li> 70 * </ul> 71 */ 72 @Override 73 public String toString() { 74 return strValue; 75 } 76 }