DomainStatuspublic class DomainStatus extends NotificationBroadcasterSupport implements DomainStatusMBeanProvides for determining the state of servers within the
scope of this domain |
Fields Summary |
---|
private static final Logger | sLoggervariables | private static final com.sun.enterprise.util.i18n.StringManager | localStrings | private Map | m |
Constructors Summary |
---|
public DomainStatus()default constructor
m = Collections.synchronizedMap(new HashMap());
|
Methods Summary |
---|
public javax.management.MBeanServerConnection | getServerMBeanServerConnection(java.lang.String serverName)get the mBean server connection for the given server
sLogger.log(Level.FINE,
"DomainStatus.getServerMBeanServerConnection for " + serverName);
// vars
ConfigContext configContext =
AdminService.getAdminService().getAdminContext().getAdminConfigContext();
MBeanServerConnection mbsc = null;
// check if DAS
if (ServerHelper.isDAS(configContext, serverName)) {
mbsc = MBeanServerFactory.getMBeanServer();
} else {
mbsc = ServerHelper.connect(configContext, serverName);
}
return mbsc;
| public int | getstate(java.lang.String serverName)get the current state of the given server
sLogger.log(Level.FINE, "DomainStatus.getstate for " + serverName);
// check for server name and return the value
if ((serverName != null) && (serverName.length() > 0)) {
if (m.containsKey(serverName)) {
return ((Integer) m.get(serverName)).intValue();
} else {
throw new Exception(
localStrings.getString(
"admin.mbeans.domainStatus.serverNotFound",
serverName));
}
}
return StateManageable.STATE_FAILED;
| private void | sendServerStatusChangedNotification(java.lang.String serverName)send status change notification
sLogger.log(Level.FINE,
"DomainStatus.sendServerStatusChangedNotification for " + serverName);
Map m = Collections.synchronizedMap(new HashMap());
m.put(DomainStatusMBean.SERVER_NAME_KEY, serverName);
Notification notification = new Notification(
DomainStatusMBean.SERVER_STATUS_NOTIFICATION_TYPE,
this,
0,
serverName);
notification.setUserData(m);
sendNotification(notification);
| public void | setstate(java.lang.String serverName, java.lang.Integer state)set the current state of the given server
sLogger.log(Level.FINE, "DomainStatus.setstate for " + serverName);
// check for server name and set the value
if ((serverName != null) && (serverName.length() > 0)) {
m.put(serverName, state);
// send notification
sendServerStatusChangedNotification(serverName);
} else {
throw new Exception(
localStrings.getString(
"admin.mbeans.domainStatus.serverNotFound",
serverName));
}
|
|