Top Description Fields Constructors Methods
net.sf.ehcache.hibernate.management.impl

public Class EhcacheHibernateMBeanRegistrationImpl

extends Object
implements EhcacheHibernateMBeanRegistration, CacheManagerEventListener
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.event.CacheManagerEventListener, net.sf.ehcache.hibernate.management.impl.EhcacheHibernateMBeanRegistration
Imports
java.lang.management.ManagementFactory, java.util.Properties, javax.management.InstanceAlreadyExistsException, .MBeanServer, .ObjectName, net.sf.ehcache.CacheException, .CacheManager, .Status, net.sf.ehcache.event.CacheManagerEventListener, org.hibernate.SessionFactory, org.hibernate.cfg.Environment, org.slf4j.Logger, .LoggerFactory

Implementation of EhcacheHibernateMBeanRegistration. Also implements CacheManagerEventListener. Deregisters mbeans when the associated cachemanager is shutdown.

Author
Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
private String
private volatile ObjectName
private volatile EhcacheHibernate
private static final Logger
private static final int
private String
private Status

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized void
dispose()

Implements net.sf.ehcache.event.CacheManagerEventListener.dispose.

Stop the listener and free any resources.
public void
private MBeanServer
public synchronized Status
getStatus()

Implements net.sf.ehcache.event.CacheManagerEventListener.getStatus.

Returns the listener status.
public void
public void
notifyCacheAdded(String
the name of the Cache the operation relates to
cacheName
)

Implements net.sf.ehcache.event.CacheManagerEventListener.notifyCacheAdded.

No-op in this case
public void
notifyCacheRemoved(String
the name of the Cache the operation relates to
cacheName
)

Implements net.sf.ehcache.event.CacheManagerEventListener.notifyCacheRemoved.

No-op in this case
private void
public synchronized void
registerMBeanForCacheManager(final CacheManager manager, final Properties properties)

Implements net.sf.ehcache.hibernate.management.impl.EhcacheHibernateMBeanRegistration.registerMBeanForCacheManager.

Registers MBean for the input manager and session factory properties.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheManagerClusterUUIDback to summary
private String cacheManagerClusterUUID
cacheManagerObjectNameback to summary
private volatile ObjectName cacheManagerObjectName
ehcacheHibernateback to summary
private volatile EhcacheHibernate ehcacheHibernate
LOGback to summary
private static final Logger LOG
MAX_MBEAN_REGISTRATION_RETRIESback to summary
private static final int MAX_MBEAN_REGISTRATION_RETRIES
registeredCacheManagerNameback to summary
private String registeredCacheManagerName
statusback to summary
private Status status

Constructor Detail

EhcacheHibernateMBeanRegistrationImplback to summary
public EhcacheHibernateMBeanRegistrationImpl()

Method Detail

disposeback to summary
public synchronized void dispose() throws CacheException

Implements net.sf.ehcache.event.CacheManagerEventListener.dispose.

Doc from net.sf.ehcache.event.CacheManagerEventListener.dispose.

Stop the listener and free any resources.

Exceptions
CacheException:
- all exceptions are wrapped in CacheException
enableHibernateStatisticsSupportback to summary
public void enableHibernateStatisticsSupport(SessionFactory sessionFactory)

Implements net.sf.ehcache.hibernate.management.impl.EhcacheHibernateMBeanRegistration.enableHibernateStatisticsSupport.

Doc from net.sf.ehcache.hibernate.management.impl.EhcacheHibernateMBeanRegistration.enableHibernateStatisticsSupport.

Enable hibernate statistics in the mbean.

getMBeanServerback to summary
private MBeanServer getMBeanServer()
getStatusback to summary
public synchronized Status getStatus()

Implements net.sf.ehcache.event.CacheManagerEventListener.getStatus.

Doc from net.sf.ehcache.event.CacheManagerEventListener.getStatus.

Returns the listener status.

Returns:Status

the status at the point in time the method is called

initback to summary
public void init() throws CacheException

Implements net.sf.ehcache.event.CacheManagerEventListener.init.

No-op in this case

Exceptions
CacheException:

Doc from net.sf.ehcache.event.CacheManagerEventListener.init.

- all exceptions are wrapped in CacheException

notifyCacheAddedback to summary
public void notifyCacheAdded(String cacheName)

Implements net.sf.ehcache.event.CacheManagerEventListener.notifyCacheAdded.

No-op in this case

Parameters
cacheName:String

Doc from net.sf.ehcache.event.CacheManagerEventListener.notifyCacheAdded.

the name of the Cache the operation relates to

notifyCacheRemovedback to summary
public void notifyCacheRemoved(String cacheName)

Implements net.sf.ehcache.event.CacheManagerEventListener.notifyCacheRemoved.

No-op in this case

Parameters
cacheName:String

Doc from net.sf.ehcache.event.CacheManagerEventListener.notifyCacheRemoved.

the name of the Cache the operation relates to

registerBeanback to summary
private void registerBean(String name, CacheManager manager) throws Exception
registerMBeanForCacheManagerback to summary
public synchronized void registerMBeanForCacheManager(final CacheManager manager, final Properties properties) throws Exception

Implements net.sf.ehcache.hibernate.management.impl.EhcacheHibernateMBeanRegistration.registerMBeanForCacheManager.

Doc from net.sf.ehcache.hibernate.management.impl.EhcacheHibernateMBeanRegistration.registerMBeanForCacheManager.

Registers MBean for the input manager and session factory properties.

MBeans will be registered based on the input session factory name. If the input name is null or blank, the name of the cache-manager is used