com.cloudtran.replicator
Class ReplicatorPacket

java.lang.Object
  extended by com.cloudtran.replicator.ReplicatorPacket

public class ReplicatorPacket
extends Object


Field Summary
 CohortEntryActionLL[] entries
          The list of grid entries, containing the objects as they appear in the grid.
 byte[] entriesAsByteArray
           
 long hisTxSeqNum
          hisTxSeqNum is only used in the remote replicator.
 long internalTxId
          This is the internalTxId on the originating (local) grid.
 long myTxSeqNum
          myTxSeqNum is used in the Replicator so that we can figure out whether we should be sending from the ReplicatorOutboundThread (not too many in the queue) or from the SSD.
 NamedSemaphore replicatorReleaseSemaphore
          Semaphore to be released by when the Replicator service has taken responsibility.
 
Constructor Summary
ReplicatorPacket()
           
ReplicatorPacket(ManagerEvent event)
           
 
Method Summary
 void convertEntriesFromPof(PofContext pofContext)
           
 void convertEntriesToPof(PofContext pofContext, BufferOutput bufferOutput)
          This is used on the local Manager when sending the ReplicatorPacket to the local Replicator.
 void readExternal(PofReader reader)
           
 String toString()
           
 void writeExternal(PofWriter writer)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

internalTxId

public long internalTxId
This is the internalTxId on the originating (local) grid. On the remote grid, when we send this packet to a manager to commit (the replica transaction) the new transaction DefaultCTxDefinition gets this value into its "remoteTxId" field. This stops it replicating the transaction back to the originating grid. -> ReplicatorInboundManagerInvocation.doOnePacket() -> ctxDefinition.setRemoteTxId( (originalGrid) internalTxId ) -> Ct.startTransactionEP -> CTxInfoCoh(DefaultCTxDefinition dta) -> super -> AbstractCTxInfo.setAttributes(DefaultCTxDefinition dta) -> remoteTxId = dta.remoteTxId;


entries

public transient CohortEntryActionLL[] entries
The list of grid entries, containing the objects as they appear in the grid. Currently we use the entries[].previousValue field to check the remote grid is in synch. The entries are present on the local manager and on the remote manager. For transmission to the local and remote replicator, we convert to POF and put into the entriesAsByteArray.


entriesAsByteArray

public byte[] entriesAsByteArray

replicatorReleaseSemaphore

public transient NamedSemaphore replicatorReleaseSemaphore
Semaphore to be released by when the Replicator service has taken responsibility. This semaphore is released on the *manager* side, but reflects the undertaking by the isolator side. It is possible to do this because we put the packets on a queue, take them off in MgrReplicatorOutboundThread, send the array of packets to the replicator in ReplicatorOutboundRequest(), which returns synchronously to the MgrReplicatorOutboundThread... so we can use the semaphores right there. We don't need to send them to the replicator, or have a map to match them up. This is also reused on the remote manager invocation.


hisTxSeqNum

public transient long hisTxSeqNum
hisTxSeqNum is only used in the remote replicator. a) it guarantees/allows us to check the order of arrival at the replicator b) because it is more compact (at the remote replicator) than the internalTxId, the InPlay data will be smaller


myTxSeqNum

public transient long myTxSeqNum
myTxSeqNum is used in the Replicator so that we can figure out whether we should be sending from the ReplicatorOutboundThread (not too many in the queue) or from the SSD. myTxSeqNum is set when the packet is put on the outboundRequestQueue.

Constructor Detail

ReplicatorPacket

public ReplicatorPacket()

ReplicatorPacket

public ReplicatorPacket(ManagerEvent event)
Method Detail

convertEntriesToPof

public void convertEntriesToPof(PofContext pofContext,
                                BufferOutput bufferOutput)
This is used on the local Manager when sending the ReplicatorPacket to the local Replicator. We do the conversion at the manager because that is more scalable and the Replicator is likely to be a bottleneck. Note that we only do one ReplicatorPacket at a time, so the internalTxId is visible - we need that.


convertEntriesFromPof

public void convertEntriesFromPof(PofContext pofContext)

writeExternal

public void writeExternal(PofWriter writer)
                   throws IOException
Throws:
IOException

readExternal

public void readExternal(PofReader reader)
                  throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object