Class JMXStatusEntry
- java.lang.Object
-
- dk.netarkivet.monitor.webinterface.JMXStatusEntry
-
- All Implemented Interfaces:
StatusEntry
,Comparable<StatusEntry>
public class JMXStatusEntry extends Object implements StatusEntry
Implementation of StatusEntry, that receives its data from the MBeanServer (JMX).
-
-
Constructor Summary
Constructors Constructor Description JMXStatusEntry(ObjectName mBeanName)
Constructor for the JMXStatusEntry.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(StatusEntry o)
Compares two entries according to first their location, then their machine name, then their ports, and then their application name, and then their index.String
getApplicationInstanceID()
Get the instance id of the application that this status entry is from.String
getApplicationName()
Get the name of the application that this status entry is from.String
getArchiveReplicaName()
Get the replica id of the application that this status entry is represents.String
getHarvestPriority()
Get the priority of the harvest queue that this status entry is from.String
getHTTPPort()
Get the HTTP port used by the application this status entry is from.String
getIndex()
Get the index in the list of most recent log messages that this status entry is from.String
getLogMessage(Locale l)
Gets the log message from this status entry.String
getMachineName()
Get the name of the host (machine) this status entry is from.String
getPhysicalLocation()
Get the (physical) location this status entry is from, e.g.static List<StatusEntry>
queryJMX(String query)
Query the JMX system for system status mbeans.static void
unregisterJMXInstance(String query)
Unregister an JMX MBean instance.
-
-
-
Constructor Detail
-
JMXStatusEntry
public JMXStatusEntry(ObjectName mBeanName)
Constructor for the JMXStatusEntry.- Parameters:
mBeanName
- The ObjectName to be assigned to the MBean representing this JMXStatusEntry.
-
-
Method Detail
-
getPhysicalLocation
public String getPhysicalLocation()
Description copied from interface:StatusEntry
Get the (physical) location this status entry is from, e.g. EAST.- Specified by:
getPhysicalLocation
in interfaceStatusEntry
- Returns:
- the location designated by the key
JMXSummaryUtils.JMXPhysLocationProperty
-
getMachineName
public String getMachineName()
Description copied from interface:StatusEntry
Get the name of the host (machine) this status entry is from.- Specified by:
getMachineName
in interfaceStatusEntry
- Returns:
- the hostname designated by the key
JMXSummaryUtils.JMXMachineNameProperty
-
getHTTPPort
public String getHTTPPort()
Description copied from interface:StatusEntry
Get the HTTP port used by the application this status entry is from. Used for HTTP and self-identification.- Specified by:
getHTTPPort
in interfaceStatusEntry
- Returns:
- the http-port designated by the key
JMXSummaryUtils.JMXHttpportProperty
-
getApplicationName
public String getApplicationName()
Description copied from interface:StatusEntry
Get the name of the application that this status entry is from.- Specified by:
getApplicationName
in interfaceStatusEntry
- Returns:
- the application name designated by the key
JMXSummaryUtils.JMXApplicationNameProperty
-
getApplicationInstanceID
public String getApplicationInstanceID()
Description copied from interface:StatusEntry
Get the instance id of the application that this status entry is from.- Specified by:
getApplicationInstanceID
in interfaceStatusEntry
- Returns:
- the application inst id designated by the key
JMXSummaryUtils.JMXApplicationInstIdProperty
-
getHarvestPriority
public String getHarvestPriority()
Description copied from interface:StatusEntry
Get the priority of the harvest queue that this status entry is from.- Specified by:
getHarvestPriority
in interfaceStatusEntry
- Returns:
- the harvest priority designated by the key
JMXSummaryUtils.JMXHarvestChannelProperty
-
getArchiveReplicaName
public String getArchiveReplicaName()
Description copied from interface:StatusEntry
Get the replica id of the application that this status entry is represents.- Specified by:
getArchiveReplicaName
in interfaceStatusEntry
- Returns:
- the replica id designated by the key
JMXSummaryUtils.JMXArchiveReplicaNameProperty
-
getIndex
public String getIndex()
Description copied from interface:StatusEntry
Get the index in the list of most recent log messages that this status entry is from.- Specified by:
getIndex
in interfaceStatusEntry
- Returns:
- the index designated by the key
JMXSummaryUtils.JMXIndexProperty
-
getLogMessage
public String getLogMessage(Locale l)
Gets the log message from this status entry. This implementation actually talks to an MBeanServer to get the log message. Will return an explanation if remote host does not respond, throws exception or returns null.- Specified by:
getLogMessage
in interfaceStatusEntry
- Parameters:
l
- the current Locale- Returns:
- A log message.
- Throws:
ArgumentNotValid
- if the current Locale is null
-
compareTo
public int compareTo(StatusEntry o)
Compares two entries according to first their location, then their machine name, then their ports, and then their application name, and then their index.- Specified by:
compareTo
in interfaceComparable<StatusEntry>
- Parameters:
o
- The object to compare with- Returns:
- A negative number if this entry comes first, a positive if it comes second and 0 if they are equal.
-
queryJMX
public static List<StatusEntry> queryJMX(String query) throws MalformedObjectNameException
Query the JMX system for system status mbeans.- Parameters:
query
- A JMX request, e.g. dk.netarkivet.logging:location=EAST,httpport=8080,*- Returns:
- A list of status entries for the mbeans that match the query.
- Throws:
MalformedObjectNameException
- If the query has wrong format.
-
unregisterJMXInstance
public static void unregisterJMXInstance(String query) throws MalformedObjectNameException, InstanceNotFoundException, MBeanRegistrationException
Unregister an JMX MBean instance.- Parameters:
query
- A JMX request, for picking the beans to unregister.- Throws:
MalformedObjectNameException
- if query is malformed.InstanceNotFoundException
- if the instanced unregistered doesn't exists.MBeanRegistrationException
- if unregeterBean is thrown.
-
-