Top Description Inners Fields Constructors Methods
net.sf.ehcache.management

public Class ManagementServerLoader

extends Object
Class Inheritance
Imports
net.sf.ehcache.CacheException, .CacheManager, net.sf.ehcache.config.ManagementRESTServiceConfiguration, org.slf4j.Logger, .LoggerFactory, java.lang.reflect.Constructor, .Method, java.net.URL, java.util.HashMap, .Iterator, .Map, .ServiceLoader

ManagementServerLoader is a facility class to access the rest management interface One would use it from EhCache or QuartzScheduler to start or stop a new rest management interface or to simply register a cache or a scheduler to an already started management interface.

It uses internally a ResourceClassLoader to load classes from a rest agent jar.

Author
Anthony Dahanne

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final Logger
private static final Class<?>
pack-priv static final Map<String, ManagementServerLoader.ManagementServerHolder>
private static final String
private static final ClassLoader

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if ehcache-rest-agent is available, false otherwise.
isManagementAvailable
()

Check if the ehcache-rest-agent jar is on the classpath

private static Object

Returns:

a ManagementServer instance
loadOSorEEManagementServer
()

This method instantiates the ManagementServer implementation found in META-INF/services/net.sf.ehcache.management.ManagementServer

public static void
register(CacheManager
the cacheManager to register
cacheManager
,
String
the client UUID
clientUUID
,
ManagementRESTServiceConfiguration
the management configuration
managementRESTServiceConfiguration
)

Register a cacheManager to management rest server.

public static void
unregister(String
the bind identifying what to un-register from
registeredMgmtSvrBind
,
CacheManager
the cacheManager to un-register
cacheManager
)

Unregister a cache manager from a management rest server If it is the last cache manager bound to this server, stops the server too.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG
MANAGEMENT_SERVER_CLASSback to summary
private static final Class<?> MANAGEMENT_SERVER_CLASS
MGMT_SVR_BY_BINDback to summary
pack-priv static final Map<String, ManagementServerLoader.ManagementServerHolder> MGMT_SVR_BY_BIND
PRIVATE_CLASSPATHback to summary
private static final String PRIVATE_CLASSPATH
RESOURCE_CLASS_LOADERback to summary
private static final ClassLoader RESOURCE_CLASS_LOADER

Constructor Detail

ManagementServerLoaderback to summary
public ManagementServerLoader()

Method Detail

isManagementAvailableback to summary
public static boolean isManagementAvailable()

Check if the ehcache-rest-agent jar is on the classpath

Returns:boolean

true if ehcache-rest-agent is available, false otherwise.

loadOSorEEManagementServerback to summary
private static Object loadOSorEEManagementServer() throws Exception

This method instantiates the ManagementServer implementation found in META-INF/services/net.sf.ehcache.management.ManagementServer

Returns:Object

a ManagementServer instance

registerback to summary
public static void register(CacheManager cacheManager, String clientUUID, ManagementRESTServiceConfiguration managementRESTServiceConfiguration)

Register a cacheManager to management rest server. If the server does not exist, starts it.

Parameters
cacheManager:CacheManager

the cacheManager to register

clientUUID:String

the client UUID

managementRESTServiceConfiguration:ManagementRESTServiceConfiguration

the management configuration

unregisterback to summary
public static void unregister(String registeredMgmtSvrBind, CacheManager cacheManager)

Unregister a cache manager from a management rest server If it is the last cache manager bound to this server, stops the server too.

Parameters
registeredMgmtSvrBind:String

the bind identifying what to un-register from

cacheManager:CacheManager

the cacheManager to un-register

net.sf.ehcache.management back to summary

pack-priv final Class ManagementServerLoader.ManagementServerHolder

extends Object
Class Inheritance
  • java.lang.Object
  • net.sf.ehcache.management.ManagementServerLoader.ManagementServerHolder

Field Summary

Modifier and TypeField and Description
private final Map<String, String>
private Object

Constructor Summary

AccessConstructor and Description
pack-priv
ManagementServerHolder(Object managementServer)

Method Summary

Modifier and TypeMethod and Description
public Object
pack-priv boolean
pack-priv void
register(CacheManager cacheManager, String clientUUID)

pack-priv void
start(ManagementRESTServiceConfiguration managementRESTServiceConfiguration)

pack-priv void
stop(String bind)

pack-priv void
unregister(CacheManager cacheManager)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clientUUIDsback to summary
private final Map<String, String> clientUUIDs
managementServerback to summary
private Object managementServer

Constructor Detail

ManagementServerHolderback to summary
pack-priv ManagementServerHolder(Object managementServer)

Method Detail

getManagementServerback to summary
public Object getManagementServer()
hasRegisteredback to summary
pack-priv boolean hasRegistered() throws Exception
registerback to summary
pack-priv void register(CacheManager cacheManager, String clientUUID) throws Exception
startback to summary
pack-priv void start(ManagementRESTServiceConfiguration managementRESTServiceConfiguration) throws Exception
stopback to summary
pack-priv void stop(String bind) throws Exception
unregisterback to summary
pack-priv void unregister(CacheManager cacheManager) throws Exception