org.eclipse.jetty.io.nio
类 SelectChannelEndPoint

java.lang.Object
  继承者 org.eclipse.jetty.io.nio.ChannelEndPoint
      继承者 org.eclipse.jetty.io.nio.SelectChannelEndPoint
所有已实现的接口:
AsyncEndPoint, ConnectedEndPoint, EndPoint
直接已知子类:
NetworkTrafficSelectChannelEndPoint

public class SelectChannelEndPoint
extends ChannelEndPoint
implements AsyncEndPoint, ConnectedEndPoint

An Endpoint that can be scheduled by SelectorManager.


字段摘要
static Logger LOG
           
 
从类 org.eclipse.jetty.io.nio.ChannelEndPoint 继承的字段
_channel, _gather2, _local, _maxIdleTime, _remote, _socket
 
构造方法摘要
SelectChannelEndPoint(SocketChannel channel, SelectorManager.SelectSet selectSet, SelectionKey key, int maxIdleTime)
           
 
方法摘要
 void asyncDispatch()
          Dispatch the endpoint.
 boolean blockReadable(long timeoutMs)
           
 boolean blockWritable(long timeoutMs)
           
 void cancelTimeout(Timeout.Task task)
           
 void checkIdleTimestamp(long now)
           
 void close()
          Close any backing stream associated with the endpoint
 void dispatch()
          Dispatch the endpoint if it is not already dispatched
 int fill(Buffer buffer)
          Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer.
 int flush(Buffer buffer)
          Flush the buffer from the current getIndex to it's putIndex using whatever byte sink is backing the buffer.
 int flush(Buffer header, Buffer buffer, Buffer trailer)
          Flush the buffer from the current getIndex to it's putIndex using whatever byte sink is backing the buffer.
 Connection getConnection()
           
 long getIdleTimestamp()
           
 SelectionKey getSelectionKey()
           
 SelectorManager getSelectManager()
           
 SelectorManager.SelectSet getSelectSet()
           
protected  void handle()
           
 boolean hasProgressed()
           
 boolean isCheckForIdle()
          Get if the endpoint should be checked for idleness
 boolean isWritable()
           
protected  void notIdle()
           
 void onIdleExpired(long idleForMs)
          Callback when idle.
 void schedule()
          Called by selectSet to schedule handling
 void scheduleTimeout(Timeout.Task task, long timeoutMs)
           
 void scheduleWrite()
          Schedule a write dispatch.
 void setCheckForIdle(boolean check)
          Set if the endpoint should be checked for idleness
 void setConnection(Connection connection)
           
 void setMaxIdleTime(int timeMs)
          Don't set the SoTimeout
 String toString()
           
protected  boolean undispatch()
          Called when a dispatched thread is no longer handling the endpoint.
 
从类 org.eclipse.jetty.io.nio.ChannelEndPoint 继承的方法
flush, gatheringFlush, getChannel, getLocalAddr, getLocalHost, getLocalPort, getMaxIdleTime, getRemoteAddr, getRemoteHost, getRemotePort, getTransport, isBlocking, isInputShutdown, isOpen, isOutputShutdown, shutdownChannelInput, shutdownChannelOutput, shutdownInput, shutdownOutput
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
从接口 org.eclipse.jetty.io.EndPoint 继承的方法
flush, getLocalAddr, getLocalHost, getLocalPort, getMaxIdleTime, getRemoteAddr, getRemoteHost, getRemotePort, getTransport, isBlocking, isInputShutdown, isOpen, isOutputShutdown, shutdownInput, shutdownOutput
 

字段详细信息

LOG

public static final Logger LOG
构造方法详细信息

SelectChannelEndPoint

public SelectChannelEndPoint(SocketChannel channel,
                             SelectorManager.SelectSet selectSet,
                             SelectionKey key,
                             int maxIdleTime)
                      throws IOException
抛出:
IOException
方法详细信息

getSelectionKey

public SelectionKey getSelectionKey()

getSelectManager

public SelectorManager getSelectManager()

getConnection

public Connection getConnection()
指定者:
接口 ConnectedEndPoint 中的 getConnection

setConnection

public void setConnection(Connection connection)
指定者:
接口 ConnectedEndPoint 中的 setConnection

getIdleTimestamp

public long getIdleTimestamp()

schedule

public void schedule()
Called by selectSet to schedule handling


asyncDispatch

public void asyncDispatch()
从接口 AsyncEndPoint 复制的描述
Dispatch the endpoint. If it is already dispatched, schedule a redispatch

指定者:
接口 AsyncEndPoint 中的 asyncDispatch

dispatch

public void dispatch()
从接口 AsyncEndPoint 复制的描述
Dispatch the endpoint if it is not already dispatched

指定者:
接口 AsyncEndPoint 中的 dispatch

undispatch

protected boolean undispatch()
Called when a dispatched thread is no longer handling the endpoint. The selection key operations are updated.

返回:
If false is returned, the endpoint has been redispatched and thread must keep handling the endpoint.

cancelTimeout

public void cancelTimeout(Timeout.Task task)
指定者:
接口 AsyncEndPoint 中的 cancelTimeout

scheduleTimeout

public void scheduleTimeout(Timeout.Task task,
                            long timeoutMs)
指定者:
接口 AsyncEndPoint 中的 scheduleTimeout

setCheckForIdle

public void setCheckForIdle(boolean check)
从接口 AsyncEndPoint 复制的描述
Set if the endpoint should be checked for idleness

指定者:
接口 AsyncEndPoint 中的 setCheckForIdle

isCheckForIdle

public boolean isCheckForIdle()
从接口 AsyncEndPoint 复制的描述
Get if the endpoint should be checked for idleness

指定者:
接口 AsyncEndPoint 中的 isCheckForIdle

notIdle

protected void notIdle()

checkIdleTimestamp

public void checkIdleTimestamp(long now)

onIdleExpired

public void onIdleExpired(long idleForMs)
从接口 AsyncEndPoint 复制的描述
Callback when idle.

An endpoint is idle if there has been no IO activity for EndPoint.getMaxIdleTime() and AsyncEndPoint.isCheckForIdle() is true.

指定者:
接口 AsyncEndPoint 中的 onIdleExpired
参数:
idleForMs - TODO

fill

public int fill(Buffer buffer)
         throws IOException
从接口 EndPoint 复制的描述
Fill the buffer from the current putIndex to it's capacity from whatever byte source is backing the buffer. The putIndex is increased if bytes filled. The buffer may chose to do a compact before filling.

指定者:
接口 EndPoint 中的 fill
覆盖:
ChannelEndPoint 中的 fill
返回:
an int value indicating the number of bytes filled or -1 if EOF is reached.
抛出:
EofException - If input is shutdown or the endpoint is closed.
IOException

flush

public int flush(Buffer header,
                 Buffer buffer,
                 Buffer trailer)
          throws IOException
从接口 EndPoint 复制的描述
Flush the buffer from the current getIndex to it's putIndex using whatever byte sink is backing the buffer. The getIndex is updated with the number of bytes flushed. Any mark set is cleared. If the entire contents of the buffer are flushed, then an implicit empty() is done. The passed header/trailer buffers are written before/after the contents of this buffer. This may be done either as gather writes, as a poke into this buffer or as several writes. The implementation is free to select the optimal mechanism.

指定者:
接口 EndPoint 中的 flush
覆盖:
ChannelEndPoint 中的 flush
参数:
header - A buffer to write before flushing this buffer. This buffers getIndex is updated.
buffer - The buffer to flush. This buffers getIndex is updated.
trailer - A buffer to write after flushing this buffer. This buffers getIndex is updated.
返回:
the total number of bytes written.
抛出:
IOException

flush

public int flush(Buffer buffer)
          throws IOException
从接口 EndPoint 复制的描述
Flush the buffer from the current getIndex to it's putIndex using whatever byte sink is backing the buffer. The getIndex is updated with the number of bytes flushed. Any mark set is cleared. If the entire contents of the buffer are flushed, then an implicit empty() is done.

指定者:
接口 EndPoint 中的 flush
覆盖:
ChannelEndPoint 中的 flush
参数:
buffer - The buffer to flush. This buffers getIndex is updated.
返回:
the number of bytes written
抛出:
EofException - If the endpoint is closed or output is shutdown.
IOException

blockReadable

public boolean blockReadable(long timeoutMs)
                      throws IOException
指定者:
接口 EndPoint 中的 blockReadable
覆盖:
ChannelEndPoint 中的 blockReadable
抛出:
IOException

blockWritable

public boolean blockWritable(long timeoutMs)
                      throws IOException
指定者:
接口 EndPoint 中的 blockWritable
覆盖:
ChannelEndPoint 中的 blockWritable
抛出:
IOException

scheduleWrite

public void scheduleWrite()
从接口 AsyncEndPoint 复制的描述
Schedule a write dispatch. Set the endpoint to not be writable and schedule a dispatch when it becomes writable.

指定者:
接口 AsyncEndPoint 中的 scheduleWrite
另请参见:
AsyncEndPoint.scheduleWrite()

isWritable

public boolean isWritable()
指定者:
接口 AsyncEndPoint 中的 isWritable

hasProgressed

public boolean hasProgressed()
指定者:
接口 AsyncEndPoint 中的 hasProgressed
返回:
True if IO has been successfully performed since the last call to AsyncEndPoint.hasProgressed()

handle

protected void handle()

close

public void close()
           throws IOException
从接口 EndPoint 复制的描述
Close any backing stream associated with the endpoint

指定者:
接口 EndPoint 中的 close
覆盖:
ChannelEndPoint 中的 close
抛出:
IOException

toString

public String toString()
覆盖:
Object 中的 toString

getSelectSet

public SelectorManager.SelectSet getSelectSet()

setMaxIdleTime

public void setMaxIdleTime(int timeMs)
                    throws IOException
Don't set the SoTimeout

指定者:
接口 EndPoint 中的 setMaxIdleTime
覆盖:
ChannelEndPoint 中的 setMaxIdleTime
参数:
timeMs - the max idle time in MS. Timeout <= 0 implies an infinite timeout
抛出:
IOException - if the timeout cannot be set.
另请参见:
ChannelEndPoint.setMaxIdleTime(int)


Copyright © 2013. All Rights Reserved.