org.eclipse.ecf.core.sharedobject
Class TwoPhaseCommitEventProcessor
java.lang.Object
org.eclipse.ecf.core.sharedobject.TwoPhaseCommitEventProcessor
- All Implemented Interfaces:
- ISharedObjectContainerTransaction, IEventProcessor
public class TwoPhaseCommitEventProcessor
- extends java.lang.Object
- implements IEventProcessor, ISharedObjectContainerTransaction
Implementation of two-phase commit for transactional replication of shared
objects.
- See Also:
ISharedObjectTransactionConfig
,
ISharedObjectTransactionParticipantsFilter
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TwoPhaseCommitEventProcessor
public TwoPhaseCommitEventProcessor(BaseSharedObject bse,
ISharedObjectTransactionConfig config)
trace
protected void trace(java.lang.String msg)
traceStack
protected void traceStack(java.lang.String msg,
java.lang.Throwable t)
getTimeout
protected int getTimeout()
getMinFailedToAbort
protected int getMinFailedToAbort()
isPrimary
protected boolean isPrimary()
getSharedObject
protected BaseSharedObject getSharedObject()
getHomeID
protected ID getHomeID()
addParticipants
protected void addParticipants(ID[] ids)
removeParticipant
protected void removeParticipant(ID id)
addFailed
protected void addFailed(ID remote,
java.lang.Throwable failure)
getContext
protected ISharedObjectContext getContext()
processEvent
public boolean processEvent(Event event)
- Description copied from interface:
IEventProcessor
- Process given Event
- Specified by:
processEvent
in interface IEventProcessor
- Parameters:
event
- the Event to process
- Returns:
- true if the event has been successfully processed and no further
processing should occur. False if the event should receive
further processing by another event processor (e.g. in a chain)
handleActivated
protected void handleActivated(ISharedObjectActivatedEvent event)
replicateTo
protected void replicateTo(ID[] remotes)
handlePrimaryActivated
protected void handlePrimaryActivated(ISharedObjectActivatedEvent event)
handleReplicaActivated
protected void handleReplicaActivated(ISharedObjectActivatedEvent event)
handleJoined
protected void handleJoined(IContainerConnectedEvent event)
handleCreateResponse
protected void handleCreateResponse(ISharedObjectCreateResponseEvent event)
handleDeparted
protected void handleDeparted(IContainerDisconnectedEvent event)
handleVotingCompletedCreateResponse
protected void handleVotingCompletedCreateResponse(ID fromID,
java.lang.Throwable e,
long identifier1)
handlePostCommitFailure
protected void handlePostCommitFailure(ID fromID,
java.lang.Throwable e,
long identifier1)
sendCommit
protected void sendCommit()
throws SharedObjectAddAbortException
- Throws:
SharedObjectAddAbortException
getTransactionState
public byte getTransactionState()
- Description copied from interface:
ISharedObjectContainerTransaction
- Get state of transaction. Returns one of 'ACTIVE', 'VOTING', 'PREPARED',
'COMMITTED', or 'ABORTED'.
- Specified by:
getTransactionState
in interface ISharedObjectContainerTransaction
- Returns:
- byte code. Returns one of 'ACTIVE', 'VOTING', 'PREPARED',
'COMMITTED', or 'ABORTED'.
setTransactionState
protected void setTransactionState(byte state)
waitToCommit
public void waitToCommit()
throws SharedObjectAddAbortException
- Description copied from interface:
ISharedObjectContainerTransaction
- Method called to wait for a transaction to complete.
- Specified by:
waitToCommit
in interface ISharedObjectContainerTransaction
- Throws:
SharedObjectAddAbortException
doTMAbort
protected void doTMAbort(java.lang.Throwable except)
throws SharedObjectAddAbortException
- Throws:
SharedObjectAddAbortException
doTMCommit
protected void doTMCommit()
throws SharedObjectAddAbortException
- Throws:
SharedObjectAddAbortException
localCommitted
protected void localCommitted()
isVotingCompleted
protected boolean isVotingCompleted()
throws SharedObjectAddAbortException
- Throws:
SharedObjectAddAbortException