📄 iosession.java
字号:
*/ boolean removeAttribute(Object key, Object value); /** * Replaces a user defined attribute with the specified key if the * value of the attribute is equals to the specified old value. * This method is same with the following code except that the operation * is performed atomically. * <pre> * if (containsAttribute(key) && getAttribute(key).equals(oldValue)) { * setAttribute(key, newValue); * return true; * } else { * return false; * } * </pre> */ boolean replaceAttribute(Object key, Object oldValue, Object newValue); /** * Returns <tt>true</tt> if this session contains the attribute with * the specified <tt>key</tt>. */ boolean containsAttribute(Object key); /** * Returns the set of keys of all user-defined attributes. */ Set<Object> getAttributeKeys(); /** * Returns <code>true</code> if this session is connected with remote peer. */ boolean isConnected(); /** * Returns <code>true</tt> if and only if this session is being closed * (but not disconnected yet) or is closed. */ boolean isClosing(); /** * Returns the {@link CloseFuture} of this session. This method returns * the same instance whenever user calls it. */ CloseFuture getCloseFuture(); /** * Returns the socket address of remote peer. */ SocketAddress getRemoteAddress(); /** * Returns the socket address of local machine which is associated with this * session. */ SocketAddress getLocalAddress(); /** * Returns the socket address of the {@link IoService} listens to to manage * this session. If this session is managed by {@link IoAcceptor}, it * returns the {@link SocketAddress} which is specified as a parameter of * {@link IoAcceptor#bind()}. If this session is managed by * {@link IoConnector}, this method returns the same address with * that of {@link #getRemoteAddress()}. */ SocketAddress getServiceAddress(); /** * * TODO setWriteRequestQueue. * * @param writeRequestQueue */ void setCurrentWriteRequest(WriteRequest currentWriteRequest); /** * Suspends read operations for this session. */ void suspendRead(); /** * Suspends write operations for this session. */ void suspendWrite(); /** * Resumes read operations for this session. */ void resumeRead(); /** * Resumes write operations for this session. */ void resumeWrite(); /** * Is read operation is suspended for this session. * @return <code>true</code> if suspended */ boolean isReadSuspended(); /** * Is write operation is suspended for this session. * @return <code>true</code> if suspended */ boolean isWriteSuspended(); /** * Update all statistical properties related with throughput assuming * the specified time is the current time. By default this method returns * silently without updating the throughput properties if they were * calculated already within last * {@link IoSessionConfig#getThroughputCalculationInterval() calculation interval}. * If, however, <tt>force</tt> is specified as <tt>true</tt>, this method * updates the throughput properties immediately. * @param currentTime the current time in milliseconds */ void updateThroughput(long currentTime, boolean force); /** * Returns the total number of bytes which were read from this session. */ long getReadBytes(); /** * Returns the total number of bytes which were written to this session. */ long getWrittenBytes(); /** * Returns the total number of messages which were read and decoded from this session. */ long getReadMessages(); /** * Returns the total number of messages which were written and encoded by this session. */ long getWrittenMessages(); /** * Returns the number of read bytes per second. */ double getReadBytesThroughput(); /** * Returns the number of written bytes per second. */ double getWrittenBytesThroughput(); /** * Returns the number of read messages per second. */ double getReadMessagesThroughput(); /** * Returns the number of written messages per second. */ double getWrittenMessagesThroughput(); /** * Returns the number of messages which are scheduled to be written to this session. */ int getScheduledWriteMessages(); /** * Returns the number of bytes which are scheduled to be written to this * session. */ long getScheduledWriteBytes(); /** * Returns the message which is being written by {@link IoService}. * @return <tt>null</tt> if and if only no message is being written */ Object getCurrentWriteMessage(); /** * Returns the {@link WriteRequest} which is being processed by * {@link IoService}. * * @return <tt>null</tt> if and if only no message is being written */ WriteRequest getCurrentWriteRequest(); /** * @return the session's creation time in nanoseconds */ long getCreationTime(); /** * Returns the time in millis when I/O occurred lastly. */ long getLastIoTime(); /** * Returns the time in millis when read operation occurred lastly. */ long getLastReadTime(); /** * Returns the time in millis when write operation occurred lastly. */ long getLastWriteTime(); /** * Returns <code>true</code> if this session is idle for the specified * {@link IdleStatus}. */ boolean isIdle(IdleStatus status); /** * Returns <code>true</code> if this session is {@link IdleStatus#READER_IDLE}. * @see #isIdle(IdleStatus) */ boolean isReaderIdle(); /** * Returns <code>true</code> if this session is {@link IdleStatus#WRITER_IDLE}. * @see #isIdle(IdleStatus) */ boolean isWriterIdle(); /** * Returns <code>true</code> if this session is {@link IdleStatus#BOTH_IDLE}. * @see #isIdle(IdleStatus) */ boolean isBothIdle(); /** * Returns the number of the fired continuous <tt>sessionIdle</tt> events * for the specified {@link IdleStatus}. * <p/> * If <tt>sessionIdle</tt> event is fired first after some time after I/O, * <tt>idleCount</tt> becomes <tt>1</tt>. <tt>idleCount</tt> resets to * <tt>0</tt> if any I/O occurs again, otherwise it increases to * <tt>2</tt> and so on if <tt>sessionIdle</tt> event is fired again without * any I/O between two (or more) <tt>sessionIdle</tt> events. */ int getIdleCount(IdleStatus status); /** * Returns the number of the fired continuous <tt>sessionIdle</tt> events * for {@link IdleStatus#READER_IDLE}. * @see #getIdleCount(IdleStatus) */ int getReaderIdleCount(); /** * Returns the number of the fired continuous <tt>sessionIdle</tt> events * for {@link IdleStatus#WRITER_IDLE}. * @see #getIdleCount(IdleStatus) */ int getWriterIdleCount(); /** * Returns the number of the fired continuous <tt>sessionIdle</tt> events * for {@link IdleStatus#BOTH_IDLE}. * @see #getIdleCount(IdleStatus) */ int getBothIdleCount(); /** * Returns the time in milliseconds when the last <tt>sessionIdle</tt> event * is fired for the specified {@link IdleStatus}. */ long getLastIdleTime(IdleStatus status); /** * Returns the time in milliseconds when the last <tt>sessionIdle</tt> event * is fired for {@link IdleStatus#READER_IDLE}. * @see #getLastIdleTime(IdleStatus) */ long getLastReaderIdleTime(); /** * Returns the time in milliseconds when the last <tt>sessionIdle</tt> event * is fired for {@link IdleStatus#WRITER_IDLE}. * @see #getLastIdleTime(IdleStatus) */ long getLastWriterIdleTime(); /** * Returns the time in milliseconds when the last <tt>sessionIdle</tt> event * is fired for {@link IdleStatus#BOTH_IDLE}. * @see #getLastIdleTime(IdleStatus) */ long getLastBothIdleTime();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -