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 notify
RemoteCommitListener
s 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:
-
Field Summary
Fields inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
_listeners
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an OpenJPA-internal listener to this RemoteCommitEventManager.void
addListener
(RemoteCommitListener listen) void
afterCommit
(TransactionEvent event) Notification that a transaction has successfully committed.void
Notification that a transaction has successfully committed and the transaction is no longer active.void
afterRollback
(TransactionEvent event) Notification that a transaction has been rolled back.void
Notification that a transaction has been rolled back and the transaction is no longer active.void
Notification that state transitions are complete.boolean
Return true if remote events are enabled.void
beforeCommit
(TransactionEvent event) Notification that the next flush is for the transaction commit.void
close()
Close this manager and all registered listeners.protected void
Implement this method to fire the given event to the given listener.void
Fire an event to local listeners only notifying them of a detected stale record.Return theRemoteCommitProvider
that this manager uses.boolean
Whether the oids of added instances will be transmitted.void
setTransmitPersistedObjectIds
(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 Details
-
RemoteCommitEventManager
Constructor. Supply configuration.
-
-
Method Details
-
areRemoteEventsEnabled
public boolean areRemoteEventsEnabled()Return true if remote events are enabled. -
getRemoteCommitProvider
Return theRemoteCommitProvider
that 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
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
-
close
public void close()Close this manager and all registered listeners. -
fireEvent
Description copied from class:AbstractConcurrentEventManager
Implement this method to fire the given event to the given listener.- Specified by:
fireEvent
in classAbstractConcurrentEventManager
-
fireLocalStaleNotification
Fire an event to local listeners only notifying them of a detected stale record.- Since:
- 1.0.0
-
afterCommit
Description copied from interface:EndTransactionListener
Notification that a transaction has successfully committed.- Specified by:
afterCommit
in interfaceEndTransactionListener
- See Also:
-
beforeCommit
Description copied from interface:EndTransactionListener
Notification that the next flush is for the transaction commit.- Specified by:
beforeCommit
in interfaceEndTransactionListener
- See Also:
-
afterRollback
Description copied from interface:EndTransactionListener
Notification that a transaction has been rolled back.- Specified by:
afterRollback
in interfaceEndTransactionListener
- See Also:
-
afterCommitComplete
Description copied from interface:EndTransactionListener
Notification that a transaction has successfully committed and the transaction is no longer active.- Specified by:
afterCommitComplete
in interfaceEndTransactionListener
- See Also:
-
afterRollbackComplete
Description copied from interface:EndTransactionListener
Notification that a transaction has been rolled back and the transaction is no longer active.- Specified by:
afterRollbackComplete
in interfaceEndTransactionListener
- See Also:
-
afterStateTransitions
Description copied from interface:EndTransactionListener
Notification that state transitions are complete.- Specified by:
afterStateTransitions
in interfaceEndTransactionListener
- See Also:
-