com.cloudtran.replicator
Class ReplicatorOutboundRequest

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

public class ReplicatorOutboundRequest
extends Object

This is for the Manager to request the Replicator to send outbound replication request(s). The manager *synchronously* waits for the Replicator to do its stuff. The first part of the processing here (in run()) is to increase the TxSeqNum for transactions going to the SSD and write the packets to the SSD. With the SSD implementation, it is important that the increase in the txSeqNum is tied to the packets going onto the write queue. The physical write can overlap with further processing, but the ReplicatorOutboundRequest has to wait for at least one of the writes to the SSD to complete. This coordination is done via the semaphore What the run() method does is to put the packets[] onto sendPacketQueue. The reason for having a queue here is: - we're going to have to fork off at some point anyway, because the manager is waiting for this - so we don't really want to go all the way to the linkProvider with all the packets in case there is back pressure from the link. If we did this, the whole thing would be single-threaded. So we'll start with 2 DCConnectionSendThreads. We link with this via the dccSendQueue, which actually contains the whole ReplicatorOutboundRequest because it has - the packet - the result - the semaphore we need The ROR's are sent via MgrReplicatorOutboundThread.


Field Summary
 ByteArrayWriteBuffer bawb
           
 BufferOutput bufferOutput
           
 byte[] dataAsByteArr
           
 int fileNumber
           
 NamedSemaphore finishOutboundRequestSem
           
 long firstTxSeqNum
           
 ReplicatorPacket[] packets
           
 AtomicInteger writeCount
           
 
Constructor Summary
ReplicatorOutboundRequest()
           
ReplicatorOutboundRequest(ReplicatorPacket[] packets)
           
 
Method Summary
 void finishOutboundRequest()
           
 byte[] getByteArray()
           
 Object getResult()
           
 void init(InvocationService arg0)
           
 void readExternal(PofReader reader)
           
 void run()
          This is the method that is called to do the invocable bit! It's not a Thread.run()! This method is run on the isolator/primary replicator.
 String toString()
           
 void writeExternal(PofWriter writer)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

packets

public ReplicatorPacket[] packets

finishOutboundRequestSem

public transient NamedSemaphore finishOutboundRequestSem

bawb

public transient ByteArrayWriteBuffer bawb

bufferOutput

public transient BufferOutput bufferOutput

fileNumber

public transient int fileNumber

dataAsByteArr

public transient byte[] dataAsByteArr

firstTxSeqNum

public transient long firstTxSeqNum

writeCount

public transient AtomicInteger writeCount
Constructor Detail

ReplicatorOutboundRequest

public ReplicatorOutboundRequest()

ReplicatorOutboundRequest

public ReplicatorOutboundRequest(ReplicatorPacket[] packets)
Parameters:
packets - must be non-null
Method Detail

finishOutboundRequest

public void finishOutboundRequest()

getResult

public Object getResult()

init

public void init(InvocationService arg0)

run

public void run()
This is the method that is called to do the invocable bit! It's not a Thread.run()! This method is run on the isolator/primary replicator. We want to get the message stored before returning... so 'sendReplicatorPackets' does the store on our behalf.


getByteArray

public byte[] getByteArray()

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