|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Channel
Connection
,
ConnectionFactory
,
Messenger
Method Summary | |
---|---|
void |
close()
Close the channel |
java.lang.Object |
invoke(java.lang.Object request)
Send a message and wait for a response. |
java.lang.Object |
receive()
Receive a message. |
java.lang.Object |
receive(long timeout)
Receive the next message that arrives within the specified timeout interval. |
void |
send(java.lang.Object message)
Send a message |
void |
setChannelListener(ChannelListener listener)
Register a listener to process messages asynchronously. Only a single listener may be registered at any one time. Setting the listener to null deregisters the listener.> NOTE: the listener will be invoked in a separate thread - to maintain the single threaded nature of channels, it is an error to call send(java.lang.Object) , receive() , or invoke(java.lang.Object) from any other
thread other than that running the listener, while the listener is
registered. |
Method Detail |
---|
void send(java.lang.Object message) throws java.rmi.RemoteException
message
- the object to send
java.rmi.RemoteException
- if the message can't be sentjava.lang.Object receive() throws java.lang.ClassNotFoundException, java.rmi.RemoteException
java.lang.ClassNotFoundException
- if the class of a serialized object
cannot be found
java.rmi.RemoteException
- if the message can't be receivedjava.lang.Object receive(long timeout) throws java.rmi.RemoteException
This call blocks until a message arrives, the timeout expires, or the channel is closed. A timeout of zero never expires and the call blocks indefinitely.
timeout
- the timeout value (in milliseconds)
java.rmi.RemoteException
- if a message can't be received
ReceiveTimeoutException
- if no message is available within
the specified intervaljava.lang.Object invoke(java.lang.Object request) throws java.lang.Exception, java.rmi.RemoteException
request
- the object to send
java.lang.Exception
- if the server throws an exception
java.rmi.RemoteException
- if the message can't be sent or the response
can't be receivedvoid setChannelListener(ChannelListener listener)
send(java.lang.Object)
, receive()
, or invoke(java.lang.Object)
from any other
thread other than that running the listener, while the listener is
registered.
listener
- the listener to process messages, or null,
to deregister the current listenervoid close() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurs closing the channel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |