|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfabric.messages.Message<N,R>
N
- The class of nodes to which messages of this type may be sent.R
- The class of responses.public abstract class Message<N extends RemoteNode,R extends Message.Response>
Nested Class Summary | |
---|---|
protected static class |
Message.MessageType
|
static interface |
Message.Response
|
Field Summary | |
---|---|
protected Message.MessageType |
messageType
The MessageType corresponding to this class. |
Constructor Summary | |
---|---|
protected |
Message(Message.MessageType messageType)
|
Method Summary | |
---|---|
R |
dispatch(MessageHandlerThread handler)
Calls the appropriate handle(...) method on the handler. |
R |
dispatch(MessageHandlerThread handler)
Calls the appropriate handle(...) method on the handler. |
static void |
receive(java.io.DataInput in,
java.io.DataOutputStream out,
MessageHandler handler)
This reads a Message from the provided input stream,
dispatches it to the given MessageHandler , and writes the
response to the provided OutputStream. |
abstract R |
response(N node,
java.io.DataInput in)
Creates a Response message of the appropriate type using the provided input stream. |
protected R |
send(N node,
boolean useSSL)
Sends this message to the given node. |
abstract void |
write(java.io.DataOutput out)
Writes this message out on the given output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Message.MessageType messageType
MessageType
corresponding to this class.
Constructor Detail |
---|
protected Message(Message.MessageType messageType)
Method Detail |
---|
protected final R send(N node, boolean useSSL) throws FabricException
FabricException
- if an error occurs at the remote node while handling the message.public static void receive(java.io.DataInput in, java.io.DataOutputStream out, MessageHandler handler) throws java.io.IOException
Message
from the provided input stream,
dispatches it to the given MessageHandler
, and writes the
response to the provided OutputStream. Used only by the store.
in
- The input stream to read the incoming message from.out
- The output stream to write the result to.handler
- The handler that will handle the message and generate the response
java.io.IOException
- If a malformed message is sent, or in the case of a failure in
the i/o streams provided.
java.lang.ClassNotFoundException
public R dispatch(MessageHandlerThread handler) throws FabricException
handle(...)
method on the handler.
handler
-
FabricException
public R dispatch(MessageHandlerThread handler) throws FabricException
handle(...)
method on the handler.
handler
-
FabricException
public abstract R response(N node, java.io.DataInput in) throws java.io.IOException, FabricException
node
- the remote node from which the response originated.in
- Input stream containing the message.
java.io.IOException
FabricException
public abstract void write(java.io.DataOutput out) throws java.io.IOException
java.io.IOException
- if the output stream throws an IOException.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |