Package org.apache.geode.management
Class ManagementService
java.lang.Object
org.apache.geode.management.ManagementService
Interface to the GemFire management service for a single Cache.
- Since:
- GemFire 7.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddMembershipListener(MembershipListener listener) Registers a listener that receives call backs when a member joins or leaves the distributed system.abstract <T> voidfederate(ObjectName objectName, Class<T> interfaceClass, boolean notificationEmitter) Adds a bean to the list of those being federated, meaning that it's state will be periodically pushed to managing members.abstract ObjectNamegetAsyncEventQueueMBeanName(DistributedMember member, String queueId) Returns the object name of the AsyncEventQueueMBean representing an asynchronous queue.abstract Set<ObjectName>Returns the ids of the async event queues on this memberabstract ObjectNamegetCacheServerMBeanName(int serverPort, DistributedMember member) Returns the object name of the CacheServerMBean representing a cache server.abstract ObjectNamegetDiskStoreMBeanName(DistributedMember member, String diskName) Returns the object name of the DiskStoreMBean representing a disk store.abstract ObjectNamegetDistributedLockServiceMBeanName(String lockService) Returns the object name of the DistributedLockServiceMBean representing a lock service.abstract DistributedLockServiceMXBeangetDistributedLockServiceMXBean(String lockServiceName) Returns a LockServiceMXBean for managing and monitoring a lock service from a system wide perspective.abstract ObjectNamegetDistributedRegionMBeanName(String regionName) Returns the object name of the DistributedRegionMBean representing a region.abstract DistributedRegionMXBeangetDistributedRegionMXBean(String regionPath) Returns a DistributedRegionMXBean for managing and monitoring a region from a system wide perspective.abstract ObjectNameReturns the object name of the DistributedSystemMBean representing a distributed system.abstract DistributedSystemMXBeanReturns the DistributedSystemMXBean for managing and monitoring the distributed system as a whole.static ManagementServiceReturns the existing instance of the management service for a cache.abstract ObjectNameReturns the object name of the GatewayReceiverMBean representing a gateway receiver.abstract ObjectNamegetGatewaySenderMBeanName(DistributedMember member, String gatwaySenderId) Returns the object name of the GatewaySenderMBean representing a gateway sender.abstract longgetLastUpdateTime(ObjectName objectName) Returns the last updated time of the remote MBean as reported by Sysem.currentTimeMillis().abstract AsyncEventQueueMXBeangetLocalAsyncEventQueueMXBean(String queueId) Returns a AsyncEventQueueMXBean for managing and monitoring an asynchronous queue.abstract CacheServerMXBeangetLocalCacheServerMXBean(int serverPort) Returns a CacheServerMXBean for managing and monitoring a cache server.abstract DiskStoreMXBeangetLocalDiskStoreMBean(String diskStoreName) Returns a DiskStoreMXBean for managing and monitoring a disk store.abstract GatewayReceiverMXBeanReturns the GatewayReceiverMXBean for managing and monitoring the gateway receiver.abstract GatewaySenderMXBeangetLocalGatewaySenderMXBean(String senderId) Returns a GatewaySenderMXBean for managing and monitoring a gateway sender.abstract LocatorMXBeanReturns the LocatorMXBean for managing and monitoring the locator.abstract LockServiceMXBeangetLocalLockServiceMBean(String lockServiceName) Returns a LockServiceMXBean for managing and monitoring a lock service.abstract RegionMXBeangetLocalRegionMBean(String regionPath) Returns a RegionMXBbean for managing and monitoring a Region.abstract ObjectNamegetLocatorMBeanName(DistributedMember member) Returns the object name of the LocatorMBean representing a locator.abstract ObjectNamegetLockServiceMBeanName(DistributedMember member, String lockServiceName) Returns the object name of the LockServiceMBean representing a lock service.static ManagementServicegetManagementService(Cache cache) Returns a newly created or the existing instance of the management service for a cache.abstract ObjectNameReturns the object name of the ManagerMBean representing a manager.abstract ManagerMXBeanReturns the ManagerMXBean for the management service.abstract <T> TgetMBeanInstance(ObjectName objectName, Class<T> interfaceClass) Returns an instance of an MBean.abstract ObjectNamegetMemberMBeanName(DistributedMember member) Returns the object name of the MemberMBean representing a distributed member.abstract MemberMXBeanReturns the MemberMXBean for managing and monitoring the local member.abstract ObjectNamegetRegionMBeanName(DistributedMember member, String regionPath) Returns the object name of the RegionMBean representing a region.abstract booleanReturns whether this member is running the management service.abstract Set<ObjectName>queryMBeanNames(DistributedMember member) Returns the object names for all MBeans associated with a member.abstract ObjectNameregisterMBean(Object object, ObjectName objectName) Registers an MBean in the GemFire domain.abstract voidremoveMembershipListener(MembershipListener listener) Unregisters a membership listenerabstract voidStarts the management service on this member.abstract voidStops the management service running on this member.abstract voidunregisterMBean(ObjectName objectName) Unregisters an MBean.
-
Constructor Details
-
ManagementService
public ManagementService()
-
-
Method Details
-
getManagementService
Returns a newly created or the existing instance of the management service for a cache.- Parameters:
cache- Cache for which to get the management service.- Returns:
- a newly created or the existing instance of the management service for a cache
-
getExistingManagementService
Returns the existing instance of the management service for a cache.- Parameters:
cache- Cache for which to get the management service.- Returns:
- The existing management service if one exists, null otherwise.
-
isManager
public abstract boolean isManager()Returns whether this member is running the management service.- Returns:
- True if this member is running the management service, false otherwise.
-
startManager
public abstract void startManager()Starts the management service on this member. -
stopManager
public abstract void stopManager()Stops the management service running on this member. -
registerMBean
Registers an MBean in the GemFire domain. Any other domain specified as part of the object will be ignored.- Parameters:
object- MBean to register.objectName- Object name of the MBean to register.- Returns:
- Object name, which may have been modified to use the GemFire domain.
-
unregisterMBean
Unregisters an MBean.- Parameters:
objectName- Object name of the MBean to unregister.
-
federate
public abstract <T> void federate(ObjectName objectName, Class<T> interfaceClass, boolean notificationEmitter) Adds a bean to the list of those being federated, meaning that it's state will be periodically pushed to managing members. It's possible to simply register MBeans in the GemFire domain without calling federate if the developer doesn't need their state to be shared amongst members. Note that Dynamic MBeans are not supported by this service.Example Usage:
CustomMXBean bean = new CustomMBean(); ObjectName beanName = ObjectName.getInstance("DefualtDomain:type=CustomType"); ObjectName gemfireBeanName = service.registerMBean(customMBean, customMBeanName); service.federate(gemfireBeanName, CustomMXBean.class, true);- Type Parameters:
T- the type of MBean- Parameters:
objectName- Object name of the MBean.interfaceClass- Interface which this MBean exposes.notificationEmitter- True if the MBean is a notification emitter.
-
getMemberMXBean
Returns the MemberMXBean for managing and monitoring the local member.- Returns:
- the MemberMXBean for managing and monitoring the local member
-
getLocalRegionMBean
Returns a RegionMXBbean for managing and monitoring a Region.- Parameters:
regionPath- Path of the region.- Returns:
- A RegionMXBean if the region exists, null otherwise.
-
getLocalLockServiceMBean
Returns a LockServiceMXBean for managing and monitoring a lock service.- Parameters:
lockServiceName- Name of the lock service.- Returns:
- A LockServiceMXBean if the lock service exists, null otherwise.
-
getLocalDiskStoreMBean
Returns a DiskStoreMXBean for managing and monitoring a disk store.- Parameters:
diskStoreName- Name of the disk store.- Returns:
- A DiskStoreMXBean if the disk store exists, null otherwise.
-
getLocalCacheServerMXBean
Returns a CacheServerMXBean for managing and monitoring a cache server.- Parameters:
serverPort- Port on which the cache server is listening.- Returns:
- A CacheServerMXBean if the cache server is found, null otherwise.
-
getDistributedSystemMXBean
Returns the DistributedSystemMXBean for managing and monitoring the distributed system as a whole.- Returns:
- A DistributedSystemMXBean if one is found, null otherwise.
-
getManagerMXBean
Returns the ManagerMXBean for the management service.- Returns:
- A ManagerMXBean if one is found, null otherwise.
-
getDistributedRegionMXBean
Returns a DistributedRegionMXBean for managing and monitoring a region from a system wide perspective.- Parameters:
regionPath- Path of the Region.- Returns:
- A DistributedRegionMXBean if the region exists, null otherwise.
-
getDistributedLockServiceMXBean
public abstract DistributedLockServiceMXBean getDistributedLockServiceMXBean(String lockServiceName) Returns a LockServiceMXBean for managing and monitoring a lock service from a system wide perspective.- Parameters:
lockServiceName- Name of the LockService.- Returns:
- A DistributedLockServiceMXBean if the lock service exists, null otherwise.
-
getLocalGatewayReceiverMXBean
Returns the GatewayReceiverMXBean for managing and monitoring the gateway receiver.- Returns:
- A GatewayReceiverMXBean if one is found, null otherwise.
-
getLocalGatewaySenderMXBean
Returns a GatewaySenderMXBean for managing and monitoring a gateway sender.- Parameters:
senderId- ID of the gateway sender.- Returns:
- A GatewaySenderMXBean if the gateway sender is found, null otherwise.
-
getLocalAsyncEventQueueMXBean
Returns a AsyncEventQueueMXBean for managing and monitoring an asynchronous queue.- Parameters:
queueId- ID of the asynchronous queue.- Returns:
- An AsyncEventQueueMXBean if the asynchronous queue is found, null otherwise.
-
getLocalLocatorMXBean
Returns the LocatorMXBean for managing and monitoring the locator.- Returns:
- A LocatorMXBean if the locator is found, null otherwise.
-
queryMBeanNames
Returns the object names for all MBeans associated with a member.- Parameters:
member- Member for which to find MBeans.- Returns:
- the object names for all MBeans associated with a member
-
getAsyncEventQueueMBeanNames
Returns the ids of the async event queues on this member- Parameters:
member- Member for which to find MBeans.- Returns:
- the ids of the async event queues on this member
-
getMBeanInstance
Returns an instance of an MBean. This is a reference to the MBean instance and not aObjectInstance.- Type Parameters:
T- the type of MBean- Parameters:
objectName- Object name of the MBean.interfaceClass- Interface which this MBean exposes.- Returns:
- an instance of an MBean
- Throws:
ClassCastException- if the MBean does not implement the given interface.
-
getLastUpdateTime
Returns the last updated time of the remote MBean as reported by Sysem.currentTimeMillis().- Parameters:
objectName- Object name of the MBean.- Returns:
- Last updated time or 0 if the MBean is local or the management service is not running on this member.
-
getMemberMBeanName
Returns the object name of the MemberMBean representing a distributed member. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.- Returns:
- the object name of the MemberMBean representing a distributed member
-
getRegionMBeanName
Returns the object name of the RegionMBean representing a region. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.regionPath- Path of the region.- Returns:
- the object name of the RegionMBean representing a region
-
getDiskStoreMBeanName
Returns the object name of the DiskStoreMBean representing a disk store. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.diskName- Name of the disk store.- Returns:
- the object name of the DiskStoreMBean representing a disk store
-
getCacheServerMBeanName
Returns the object name of the CacheServerMBean representing a cache server. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.serverPort- Port on which the cache server is listening.- Returns:
- the object name of the CacheServerMBean representing a cache server
-
getLockServiceMBeanName
public abstract ObjectName getLockServiceMBeanName(DistributedMember member, String lockServiceName) Returns the object name of the LockServiceMBean representing a lock service. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.lockServiceName- Name of the lock service.- Returns:
- the object name of the LockServiceMBean representing a lock service
-
getGatewayReceiverMBeanName
Returns the object name of the GatewayReceiverMBean representing a gateway receiver. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.- Returns:
- the object name of the GatewayReceiverMBean representing a gateway receiver
-
getGatewaySenderMBeanName
public abstract ObjectName getGatewaySenderMBeanName(DistributedMember member, String gatwaySenderId) Returns the object name of the GatewaySenderMBean representing a gateway sender. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.gatwaySenderId- ID of the gateway sender.- Returns:
- the object name of the GatewaySenderMBean representing a gateway sender
-
getAsyncEventQueueMBeanName
Returns the object name of the AsyncEventQueueMBean representing an asynchronous queue. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.queueId- ID of the asynchronous queue.- Returns:
- the object name of the AsyncEventQueueMBean representing an asynchronous queue
-
getDistributedRegionMBeanName
Returns the object name of the DistributedRegionMBean representing a region. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
regionName- Name of the region.- Returns:
- the object name of the DistributedRegionMBean representing a region
-
getDistributedLockServiceMBeanName
Returns the object name of the DistributedLockServiceMBean representing a lock service. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
lockService- Name of the lock service.- Returns:
- the object name of the DistributedLockServiceMBean representing a lock service
-
getDistributedSystemMBeanName
Returns the object name of the DistributedSystemMBean representing a distributed system. This is a utility method for generating an object name and it does not register an MBean.- Returns:
- the object name of the DistributedSystemMBean representing a distributed system
-
getManagerMBeanName
Returns the object name of the ManagerMBean representing a manager. This is a utility method for generating an object name and it does not register an MBean.- Returns:
- the object name of the ManagerMBean representing a manager
-
getLocatorMBeanName
Returns the object name of the LocatorMBean representing a locator. This is a utility method for generating an object name and it does not register an MBean.- Parameters:
member- Distributed member used to generate the object name.- Returns:
- the object name of the LocatorMBean representing a locator
-
addMembershipListener
Registers a listener that receives call backs when a member joins or leaves the distributed system.- Parameters:
listener- the membership listener to register
-
removeMembershipListener
Unregisters a membership listener- Parameters:
listener- the membership listener to unregister- See Also:
-