public abstract class Transceiver extends Object implements Closeable
Requestor.| Constructor and Description | 
|---|
Transceiver()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()  | 
Protocol | 
getRemote()
Returns the protocol passed to  
setRemote(Protocol). | 
abstract String | 
getRemoteName()  | 
boolean | 
isConnected()
True if a handshake has been completed for this connection. 
 | 
void | 
lockChannel()
Acquires an exclusive lock on the transceiver's channel. 
 | 
abstract List<ByteBuffer> | 
readBuffers()
Called by the default definition of  
transceive(List). | 
void | 
setRemote(Protocol protocol)
Called with the remote protocol when a handshake has been completed. 
 | 
List<ByteBuffer> | 
transceive(List<ByteBuffer> request)
Called by  
Requestor.request(String,Object) for two-way messages. | 
void | 
transceive(List<ByteBuffer> request,
          Callback<List<ByteBuffer>> callback)
Called by  
Requestor.request(String,Object,Callback) for two-way messages using callbacks. | 
void | 
unlockChannel()
Releases the lock on the transceiver's channel if held by the calling thread. 
 | 
abstract void | 
writeBuffers(List<ByteBuffer> buffers)
Called by  
Requestor.request(String,Object) for one-way messages. | 
public abstract String getRemoteName() throws IOException
IOExceptionpublic void lockChannel()
public void unlockChannel()
public List<ByteBuffer> transceive(List<ByteBuffer> request) throws IOException
Requestor.request(String,Object) for two-way messages.
 By default calls writeBuffers(List) followed by
 readBuffers().IOExceptionpublic void transceive(List<ByteBuffer> request, Callback<List<ByteBuffer>> callback) throws IOException
Requestor.request(String,Object,Callback) for two-way messages using callbacks.IOExceptionpublic abstract List<ByteBuffer> readBuffers() throws IOException
transceive(List).IOExceptionpublic abstract void writeBuffers(List<ByteBuffer> buffers) throws IOException
Requestor.request(String,Object) for one-way messages.IOExceptionpublic boolean isConnected()
public void setRemote(Protocol protocol)
isConnected() should return true and #getRemote() should return this
 protocol.  Does nothing by default.public Protocol getRemote()
setRemote(Protocol).  Throws
 IllegalStateException by default.public void close()
           throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.