Package org.apache.openjpa.event
Class RemoteCommitEventManager
- java.lang.Object
-
- org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
-
- org.apache.openjpa.event.RemoteCommitEventManager
-
- All Implemented Interfaces:
Serializable,EndTransactionListener,Closeable,EventManager
public class RemoteCommitEventManager extends AbstractConcurrentEventManager implements EndTransactionListener, Closeable
Manager that can be used to track and notifyRemoteCommitListeners on remote commit events. If remote events are enabled, this manager should be installed as a transaction listener on all brokers so that it knows when commits are made.- Since:
- 0.3.0
- Author:
- Patrick Linskey, Abe White
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
_listeners
-
-
Constructor Summary
Constructors Constructor Description RemoteCommitEventManager(OpenJPAConfiguration conf)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInternalListener(RemoteCommitListener listen)Adds an OpenJPA-internal listener to this RemoteCommitEventManager.voidaddListener(RemoteCommitListener listen)voidafterCommit(TransactionEvent event)Notification that a transaction has successfully committed.voidafterCommitComplete(TransactionEvent event)Notification that a transaction has successfully committed and the transaction is no longer active.voidafterRollback(TransactionEvent event)Notification that a transaction has been rolled back.voidafterRollbackComplete(TransactionEvent event)Notification that a transaction has been rolled back and the transaction is no longer active.voidafterStateTransitions(TransactionEvent event)Notification that state transitions are complete.booleanareRemoteEventsEnabled()Return true if remote events are enabled.voidbeforeCommit(TransactionEvent event)Notification that the next flush is for the transaction commit.voidclose()Close this manager and all registered listeners.protected voidfireEvent(Object event, Object listener)Implement this method to fire the given event to the given listener.voidfireLocalStaleNotification(Object oid)Fire an event to local listeners only notifying them of a detected stale record.RemoteCommitProvidergetRemoteCommitProvider()Return theRemoteCommitProviderthat this manager uses.booleangetTransmitPersistedObjectIds()Whether the oids of added instances will be transmitted.voidsetTransmitPersistedObjectIds(boolean transmit)Whether the oids of added instances will be transmitted.-
Methods inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
addListener, fireEvent, getListeners, hasListener, hasListeners, isFailFast, newListenerCollection, removeListener, setFailFast
-
-
-
-
Constructor Detail
-
RemoteCommitEventManager
public RemoteCommitEventManager(OpenJPAConfiguration conf)
Constructor. Supply configuration.
-
-
Method Detail
-
areRemoteEventsEnabled
public boolean areRemoteEventsEnabled()
Return true if remote events are enabled.
-
getRemoteCommitProvider
public RemoteCommitProvider getRemoteCommitProvider()
Return theRemoteCommitProviderthat this manager uses.- Since:
- 0.3.1
-
getTransmitPersistedObjectIds
public boolean getTransmitPersistedObjectIds()
Whether the oids of added instances will be transmitted.
-
setTransmitPersistedObjectIds
public void setTransmitPersistedObjectIds(boolean transmit)
Whether the oids of added instances will be transmitted.
-
addInternalListener
public void addInternalListener(RemoteCommitListener listen)
Adds an OpenJPA-internal listener to this RemoteCommitEventManager. Listeners so registered will be fired before any that are registered viaaddListener(org.apache.openjpa.event.RemoteCommitListener). This means that the external listeners can rely on internal caches and data structures being up-to-date by the time that they are invoked.- Since:
- 1.0.0
-
addListener
public void addListener(RemoteCommitListener listen)
-
close
public void close()
Close this manager and all registered listeners.
-
fireEvent
protected void fireEvent(Object event, Object listener)
Description copied from class:AbstractConcurrentEventManagerImplement this method to fire the given event to the given listener.- Specified by:
fireEventin classAbstractConcurrentEventManager
-
fireLocalStaleNotification
public void fireLocalStaleNotification(Object oid)
Fire an event to local listeners only notifying them of a detected stale record.- Since:
- 1.0.0
-
afterCommit
public void afterCommit(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that a transaction has successfully committed.- Specified by:
afterCommitin interfaceEndTransactionListener- See Also:
TransactionEvent.AFTER_COMMIT
-
beforeCommit
public void beforeCommit(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that the next flush is for the transaction commit.- Specified by:
beforeCommitin interfaceEndTransactionListener- See Also:
TransactionEvent.BEFORE_COMMIT
-
afterRollback
public void afterRollback(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that a transaction has been rolled back.- Specified by:
afterRollbackin interfaceEndTransactionListener- See Also:
TransactionEvent.AFTER_ROLLBACK
-
afterCommitComplete
public void afterCommitComplete(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that a transaction has successfully committed and the transaction is no longer active.- Specified by:
afterCommitCompletein interfaceEndTransactionListener- See Also:
TransactionEvent.AFTER_COMMIT_COMPLETE
-
afterRollbackComplete
public void afterRollbackComplete(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that a transaction has been rolled back and the transaction is no longer active.- Specified by:
afterRollbackCompletein interfaceEndTransactionListener- See Also:
TransactionEvent.AFTER_ROLLBACK_COMPLETE
-
afterStateTransitions
public void afterStateTransitions(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that state transitions are complete.- Specified by:
afterStateTransitionsin interfaceEndTransactionListener- See Also:
TransactionEvent.AFTER_STATE_TRANSITIONS
-
-