Package org.glassfish.admin.mbeanserver
Class PendingConfigBeans
- java.lang.Object
-
- org.glassfish.admin.mbeanserver.PendingConfigBeans
-
- All Implemented Interfaces:
ConfigBeanListener
,org.glassfish.hk2.api.PostConstruct
,TransactionListener
@Service(name="PendingConfigBeans") public class PendingConfigBeans extends Object implements ConfigBeanListener, org.glassfish.hk2.api.PostConstruct, TransactionListener
Called when ConfigBeans come into the habitat (see GlassfishConfigBean); a job queue is maintained for processing by the AMXConfigLoader, which is lazily loaded.- Author:
- llc
-
-
Constructor Summary
Constructors Constructor Description PendingConfigBeans()
/** Singleton: there should be only one instance and hence a private constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PendingConfigBeanJob
add(ConfigBean cb, boolean useLatch)
void
onEntered(org.glassfish.hk2.api.ActiveDescriptor<ConfigBean> provider)
Notification that a new config beans has entered the configuration tree.PendingConfigBeanJob
peek()
void
postConstruct()
boolean
remove(ConfigBean cb)
Removing a ConfigBean must ensure that all its children are also removed.int
size()
void
swapTransactionListener(TransactionListener newListener)
amx-impl has its own TransactionListener which takes over once AMX is loaded.PendingConfigBeanJob
take()
void
transactionCommited(List<PropertyChangeEvent> events)
This is a workaround for the fact that the onEntered() is not being called in all cases, namely during deployment before AMX has loaded.void
unprocessedTransactedEvents(List<UnprocessedChangeEvents> changes)
Nofication of unprocessed events by ConfigListener, usually requiring a server restart.
-
-
-
Method Detail
-
size
public int size()
-
postConstruct
public void postConstruct()
- Specified by:
postConstruct
in interfaceorg.glassfish.hk2.api.PostConstruct
-
take
public PendingConfigBeanJob take() throws InterruptedException
- Throws:
InterruptedException
-
peek
public PendingConfigBeanJob peek() throws InterruptedException
- Throws:
InterruptedException
-
onEntered
public void onEntered(org.glassfish.hk2.api.ActiveDescriptor<ConfigBean> provider)
Description copied from interface:ConfigBeanListener
Notification that a new config beans has entered the configuration tree.- Specified by:
onEntered
in interfaceConfigBeanListener
- Parameters:
provider
- the new config bean
-
add
public PendingConfigBeanJob add(ConfigBean cb, boolean useLatch)
-
remove
public boolean remove(ConfigBean cb)
Removing a ConfigBean must ensure that all its children are also removed. This will normally happen if AMX is loaded as a side effect of unregistering MBeans, but if AMX has not loaded we must ensure it directly. This is all caused by an HK2 asymmetry that does not issue REMOVE events for children of removed elements.TODO: remove all children of the ConfigBean.
-
swapTransactionListener
public void swapTransactionListener(TransactionListener newListener)
amx-impl has its own TransactionListener which takes over once AMX is loaded. Note that it is synchronized with transactionCommited() [sic] to avoid a race condition.
-
transactionCommited
public void transactionCommited(List<PropertyChangeEvent> events)
This is a workaround for the fact that the onEntered() is not being called in all cases, namely during deployment before AMX has loaded. See disableTransactionListener() above.- Specified by:
transactionCommited
in interfaceTransactionListener
-
unprocessedTransactedEvents
public void unprocessedTransactedEvents(List<UnprocessedChangeEvents> changes)
Description copied from interface:TransactionListener
Nofication of unprocessed events by ConfigListener, usually requiring a server restart.- Specified by:
unprocessedTransactedEvents
in interfaceTransactionListener
-
-