|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.thrift.transport.TTransport
org.apache.thrift.transport.TNonblockingTransport
org.apache.thrift.transport.TNonblockingSocket
public class TNonblockingSocket
Transport for use with async client.
| Constructor Summary | |
|---|---|
TNonblockingSocket(java.nio.channels.SocketChannel socketChannel)
Constructor that takes an already created socket. |
|
TNonblockingSocket(java.lang.String host,
int port)
|
|
TNonblockingSocket(java.lang.String host,
int port,
int timeout)
Create a new nonblocking socket transport that will be connected to host:port. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the socket. |
boolean |
finishConnect()
Non-blocking connection completion. |
void |
flush()
Noop. |
java.nio.channels.SocketChannel |
getSocketChannel()
Returns a reference to the underlying SocketChannel. |
boolean |
isOpen()
Checks whether the socket is connected. |
void |
open()
Do not call, the implementation provides its own lazy non-blocking connect. |
int |
read(byte[] buf,
int off,
int len)
Reads from the underlying input stream if not null. |
int |
read(java.nio.ByteBuffer buffer)
Perform a nonblocking read into buffer. |
java.nio.channels.SelectionKey |
registerSelector(java.nio.channels.Selector selector,
int interests)
Register the new SocketChannel with our Selector, indicating we'd like to be notified when it's ready for I/O. |
void |
setTimeout(int timeout)
Sets the socket timeout, although this implementation never uses blocking operations so it is unused. |
boolean |
startConnect()
Non-blocking connection initialization. |
void |
write(byte[] buf,
int off,
int len)
Writes to the underlying output stream if not null. |
int |
write(java.nio.ByteBuffer buffer)
Perform a nonblocking write of the data in buffer; |
| Methods inherited from class org.apache.thrift.transport.TTransport |
|---|
consumeBuffer, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, readAll, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TNonblockingSocket(java.lang.String host,
int port)
throws java.io.IOException
java.io.IOException
public TNonblockingSocket(java.lang.String host,
int port,
int timeout)
throws java.io.IOException
host - port -
TTransportException
java.io.IOException
public TNonblockingSocket(java.nio.channels.SocketChannel socketChannel)
throws java.io.IOException
socketChannel - Already created SocketChannel object
java.io.IOException - if there is an error setting up the streams| Method Detail |
|---|
public java.nio.channels.SelectionKey registerSelector(java.nio.channels.Selector selector,
int interests)
throws java.io.IOException
registerSelector in class TNonblockingTransportselector -
java.io.IOExceptionpublic void setTimeout(int timeout)
timeout - Milliseconds timeoutpublic java.nio.channels.SocketChannel getSocketChannel()
public boolean isOpen()
isOpen in class TTransport
public void open()
throws TTransportException
open in class TTransportTTransportException - if the transport could not be opened
public int read(java.nio.ByteBuffer buffer)
throws java.io.IOException
read in class TNonblockingTransportjava.io.IOException
public int read(byte[] buf,
int off,
int len)
throws TTransportException
read in class TTransportbuf - Array to read intooff - Index to start reading atlen - Maximum number of bytes to read
TTransportException - if there was an error reading data
public int write(java.nio.ByteBuffer buffer)
throws java.io.IOException
write in class TNonblockingTransportjava.io.IOException
public void write(byte[] buf,
int off,
int len)
throws TTransportException
write in class TTransportbuf - The output data bufferoff - The offset to start writing fromlen - The number of bytes to write
TTransportException - if there was an error writing data
public void flush()
throws TTransportException
flush in class TTransportTTransportException - if there was an error writing out data.public void close()
close in class TTransport
public boolean startConnect()
throws java.io.IOException
startConnect in class TNonblockingTransportjava.io.IOExceptionSocketChannel.connect(SocketAddress remote)
public boolean finishConnect()
throws java.io.IOException
finishConnect in class TNonblockingTransportjava.io.IOExceptionSocketChannel.finishConnect()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||