| java.lang.Object org.apache.tomcat.util.net.NioSelectorPool
NioSelectorPool | public class NioSelectorPool (Code) | | Thread safe non blocking selector pool
author: Filip Hanik version: 1.0 since: 6.0 |
Method Summary | |
public void | close() | public Selector | get() | public int | getMaxSelectors() | public int | getMaxSpareSelectors() | protected static Selector | getSharedSelector() | public boolean | isEnabled() | public void | open() | public void | put(Selector s) | public int | read(ByteBuffer buf, NioChannel socket, Selector selector, long readTimeout) Performs a blocking read using the bytebuffer for data to be read and a selector to block. | public int | read(ByteBuffer buf, NioChannel socket, Selector selector, long readTimeout, boolean block) Performs a read using the bytebuffer for data to be read and a selector to register for events should
you have the block=true. | public void | setEnabled(boolean enabled) | public void | setMaxSelectors(int maxSelectors) | public void | setMaxSpareSelectors(int maxSpareSelectors) | public int | write(ByteBuffer buf, NioChannel socket, Selector selector, long writeTimeout) Performs a blocking write using the bytebuffer for data to be written and a selector to block. | public int | write(ByteBuffer buf, NioChannel socket, Selector selector, long writeTimeout, boolean block) |
SHARED | final protected static boolean SHARED(Code) | | |
enabled | protected boolean enabled(Code) | | |
maxSelectors | protected int maxSelectors(Code) | | |
maxSpareSelectors | protected int maxSpareSelectors(Code) | | |
getMaxSelectors | public int getMaxSelectors()(Code) | | |
getMaxSpareSelectors | public int getMaxSpareSelectors()(Code) | | |
isEnabled | public boolean isEnabled()(Code) | | |
read | public int read(ByteBuffer buf, NioChannel socket, Selector selector, long readTimeout) throws IOException(Code) | | Performs a blocking read using the bytebuffer for data to be read and a selector to block.
If the selector parameter is null, then it will perform a busy read that could
take up a lot of CPU cycles.
Parameters: buf - ByteBuffer - the buffer containing the data, we will read as until we have read at least one byte or we timed out Parameters: socket - SocketChannel - the socket to write data to Parameters: selector - Selector - the selector to use for blocking, if null then a busy read will be initiated Parameters: readTimeout - long - the timeout for this read operation in milliseconds, -1 means no timeout int - returns the number of bytes read throws: EOFException - if read returns -1 throws: SocketTimeoutException - if the read times out throws: IOException - if an IO Exception occurs in the underlying socket logic |
read | public int read(ByteBuffer buf, NioChannel socket, Selector selector, long readTimeout, boolean block) throws IOException(Code) | | Performs a read using the bytebuffer for data to be read and a selector to register for events should
you have the block=true.
If the selector parameter is null, then it will perform a busy read that could
take up a lot of CPU cycles.
Parameters: buf - ByteBuffer - the buffer containing the data, we will read as until we have read at least one byte or we timed out Parameters: socket - SocketChannel - the socket to write data to Parameters: selector - Selector - the selector to use for blocking, if null then a busy read will be initiated Parameters: readTimeout - long - the timeout for this read operation in milliseconds, -1 means no timeout Parameters: block - - true if you want to block until data becomes available or timeout time has been reached int - returns the number of bytes read throws: EOFException - if read returns -1 throws: SocketTimeoutException - if the read times out throws: IOException - if an IO Exception occurs in the underlying socket logic |
setEnabled | public void setEnabled(boolean enabled)(Code) | | |
setMaxSelectors | public void setMaxSelectors(int maxSelectors)(Code) | | |
setMaxSpareSelectors | public void setMaxSpareSelectors(int maxSpareSelectors)(Code) | | |
write | public int write(ByteBuffer buf, NioChannel socket, Selector selector, long writeTimeout) throws IOException(Code) | | Performs a blocking write using the bytebuffer for data to be written and a selector to block.
If the selector parameter is null, then it will perform a busy write that could
take up a lot of CPU cycles.
Parameters: buf - ByteBuffer - the buffer containing the data, we will write as long as (buf.hasRemaining()==true) Parameters: socket - SocketChannel - the socket to write data to Parameters: selector - Selector - the selector to use for blocking, if null then a busy write will be initiated Parameters: writeTimeout - long - the timeout for this write operation in milliseconds, -1 means no timeout int - returns the number of bytes written throws: EOFException - if write returns -1 throws: SocketTimeoutException - if the write times out throws: IOException - if an IO Exception occurs in the underlying socket logic |
|
|