Package org.jvnet.hk2.config
Class Transactions
- java.lang.Object
-
- org.jvnet.hk2.config.Transactions
-
- All Implemented Interfaces:
org.glassfish.hk2.api.PostConstruct
,org.glassfish.hk2.api.PreDestroy
@Service public final class Transactions extends Object implements org.glassfish.hk2.api.PostConstruct, org.glassfish.hk2.api.PreDestroy
Transactions is a singleton service that receives transaction notifications and dispatch these notifications asynchronously to listeners.- Author:
- Jerome Dochez
-
-
Constructor Summary
Constructors Constructor Description Transactions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListenerForType(Class listenerType, ConfigListener listener)
adds a listener for a particular config typevoid
addTransactionsListener(TransactionListener listener)
add a new listener to all transaction events.List<TransactionListener>
currentListeners()
void
postConstruct()
void
preDestroy()
boolean
removeListenerForType(Class listenerType, ConfigListener listener)
removes a listener for a particular config typeboolean
removeTransactionsListener(TransactionListener listener)
Removes an existing listener for transaction eventsvoid
waitForDrain()
-
-
-
Method Detail
-
postConstruct
public void postConstruct()
- Specified by:
postConstruct
in interfaceorg.glassfish.hk2.api.PostConstruct
-
preDestroy
public void preDestroy()
- Specified by:
preDestroy
in interfaceorg.glassfish.hk2.api.PreDestroy
-
addListenerForType
public void addListenerForType(Class listenerType, ConfigListener listener)
adds a listener for a particular config type- Parameters:
listenerType
- the config typelistener
- the config listener
-
removeListenerForType
public boolean removeListenerForType(Class listenerType, ConfigListener listener)
removes a listener for a particular config type- Parameters:
listenerType
- the config typelistener
- the config listener- Returns:
- true if the listener was removed successfully, false otherwise.
-
addTransactionsListener
public void addTransactionsListener(TransactionListener listener)
add a new listener to all transaction events.- Parameters:
listener
- to be added.
-
removeTransactionsListener
public boolean removeTransactionsListener(TransactionListener listener)
Removes an existing listener for transaction events- Parameters:
listener
- the registered listener- Returns:
- true if the listener unregistration was successful
-
currentListeners
public List<TransactionListener> currentListeners()
-
waitForDrain
public void waitForDrain()
-
-