fabric.messages
Class PrepareTransactionMessage

java.lang.Object
  extended by fabric.messages.Message<RemoteNode,PrepareTransactionMessage.Response>
      extended by fabric.messages.PrepareTransactionMessage

public class PrepareTransactionMessage
extends Message<RemoteNode,PrepareTransactionMessage.Response>

A PrepareTransactionMessage represents a transaction request to a store.


Nested Class Summary
static class PrepareTransactionMessage.Response
           
 
Nested classes/interfaces inherited from class fabric.messages.Message
Message.MessageType
 
Field Summary
 long commitTime
           
 java.util.Collection<Object._Impl> creates
          The objects created during the transaction, unserialized.
 LongKeyMap<java.lang.Integer> reads
           
 java.util.Collection<SerializedObject> serializedCreates
          The objects created during the transaction, serialized.
 java.util.Collection<SerializedObject> serializedWrites
          The objects modified during the transaction, serialized.
 long tid
           
 java.util.Collection<Object._Impl> writes
          The objects modified during the transaction, unserialized.
 
Fields inherited from class fabric.messages.Message
messageType
 
Constructor Summary
protected PrepareTransactionMessage(java.io.DataInput in)
          Deserialization constructor.
  PrepareTransactionMessage(long tid, long commitTime)
          Used to prepare transactions at remote workers.
  PrepareTransactionMessage(long tid, long commitTime, java.util.Collection<Object._Impl> toCreate, LongKeyMap<java.lang.Integer> reads, java.util.Collection<Object._Impl> writes)
          Only used by the worker.
 
Method Summary
 PrepareTransactionMessage.Response dispatch(MessageHandlerThread w)
          Calls the appropriate handle(...) method on the handler.
 PrepareTransactionMessage.Response dispatch(MessageHandlerThread handler)
          Calls the appropriate handle(...) method on the handler.
 PrepareTransactionMessage.Response response(RemoteNode node, java.io.DataInput in)
          Creates a Response message of the appropriate type using the provided input stream.
 PrepareTransactionMessage.Response send(RemoteNode node)
           
 void write(java.io.DataOutput out)
          Writes this message out on the given output stream.
 
Methods inherited from class fabric.messages.Message
receive, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tid

public final long tid

commitTime

public final long commitTime

reads

public final LongKeyMap<java.lang.Integer> reads

creates

public final java.util.Collection<Object._Impl> creates
The objects created during the transaction, unserialized. This will only be non-null on the worker. The store should use the serializedCreates field instead.


serializedCreates

public final java.util.Collection<SerializedObject> serializedCreates
The objects created during the transaction, serialized. This will only be non-null on the store. The worker should use the creates field instead.


writes

public final java.util.Collection<Object._Impl> writes
The objects modified during the transaction, unserialized. This will only be non-null on the worker. The store should use the serializedWrites field instead.


serializedWrites

public final java.util.Collection<SerializedObject> serializedWrites
The objects modified during the transaction, serialized. This will only be non-null on the store. The worker should use the writes field instead.

Constructor Detail

PrepareTransactionMessage

public PrepareTransactionMessage(long tid,
                                 long commitTime)
Used to prepare transactions at remote workers.


PrepareTransactionMessage

public PrepareTransactionMessage(long tid,
                                 long commitTime,
                                 java.util.Collection<Object._Impl> toCreate,
                                 LongKeyMap<java.lang.Integer> reads,
                                 java.util.Collection<Object._Impl> writes)
Only used by the worker.


PrepareTransactionMessage

protected PrepareTransactionMessage(java.io.DataInput in)
                             throws java.io.IOException
Deserialization constructor. Used only by the store.

Throws:
java.io.IOException
Method Detail

dispatch

public PrepareTransactionMessage.Response dispatch(MessageHandlerThread w)
                                            throws ProtocolError,
                                                   TransactionPrepareFailedException
Description copied from class: Message
Calls the appropriate handle(...) method on the handler.

Overrides:
dispatch in class Message<RemoteNode,PrepareTransactionMessage.Response>
Returns:
the result computed by the handler
Throws:
ProtocolError
TransactionPrepareFailedException

dispatch

public PrepareTransactionMessage.Response dispatch(MessageHandlerThread handler)
                                            throws ProtocolError,
                                                   TransactionPrepareFailedException
Description copied from class: Message
Calls the appropriate handle(...) method on the handler.

Overrides:
dispatch in class Message<RemoteNode,PrepareTransactionMessage.Response>
Returns:
the result computed by the handler
Throws:
ProtocolError
TransactionPrepareFailedException

send

public PrepareTransactionMessage.Response send(RemoteNode node)
                                        throws UnreachableNodeException,
                                               TransactionPrepareFailedException
Throws:
UnreachableNodeException
TransactionPrepareFailedException

response

public PrepareTransactionMessage.Response response(RemoteNode node,
                                                   java.io.DataInput in)
                                            throws java.io.IOException
Description copied from class: Message
Creates a Response message of the appropriate type using the provided input stream.

Specified by:
response in class Message<RemoteNode,PrepareTransactionMessage.Response>
Parameters:
node - the remote node from which the response originated.
in - Input stream containing the message.
Returns:
A Response message with the appropriate type.
Throws:
java.io.IOException

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Description copied from class: Message
Writes this message out on the given output stream. Only used by the worker.

Specified by:
write in class Message<RemoteNode,PrepareTransactionMessage.Response>
Throws:
java.io.IOException - if the output stream throws an IOException.