NamingServicepublic final class NamingService extends NotificationBroadcasterSupport implements NamingServiceMBean, MBeanRegistrationImplementation of the NamingService JMX MBean. |
Fields Summary |
---|
private int | stateStatus of the Slide domain. | private long | sequenceNumberNotification sequence number. | private String | oldUrlValueOld URL packages value. | private String | oldIcValueOld initial context value. |
Methods Summary |
---|
public void | destroy()Destroy servlet container (if any is running).
if (getState() != STOPPED)
stop();
| public java.lang.String | getName()Retruns the Catalina component name.
return NAME;
| public int | getState()Returns the state.
return state;
| public java.lang.String | getStateString()Returns a String representation of the state.
return states[state];
| public void | postDeregister()
destroy();
| public void | postRegister(java.lang.Boolean registrationDone)
if (!registrationDone.booleanValue())
destroy();
| public void | preDeregister()
| public javax.management.ObjectName | preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
// ---------------------------------------------- MBeanRegistration Methods
return new ObjectName(OBJECT_NAME);
| public void | start()Start the servlet container.
Notification notification = null;
if (state != STOPPED)
return;
state = STARTING;
// Notifying the MBEan server that we're starting
notification = new AttributeChangeNotification
(this, sequenceNumber++, System.currentTimeMillis(),
"Starting " + NAME, "State", "java.lang.Integer",
Integer.valueOf(STOPPED), Integer.valueOf(STARTING));
sendNotification(notification);
try {
String value = "org.apache.naming";
String oldValue = System.getProperty(Context.URL_PKG_PREFIXES);
if (oldValue != null) {
oldUrlValue = oldValue;
value = oldValue + ":" + value;
}
System.setProperty(Context.URL_PKG_PREFIXES, value);
oldValue = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
if (oldValue != null) {
oldIcValue = oldValue;
} else {
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
Constants.Package
+ ".java.javaURLContextFactory");
}
} catch (Throwable t) {
state = STOPPED;
notification = new AttributeChangeNotification
(this, sequenceNumber++, System.currentTimeMillis(),
"Stopped " + NAME, "State", "java.lang.Integer",
Integer.valueOf(STARTING), Integer.valueOf(STOPPED));
sendNotification(notification);
}
state = STARTED;
notification = new AttributeChangeNotification
(this, sequenceNumber++, System.currentTimeMillis(),
"Started " + NAME, "State", "java.lang.Integer",
Integer.valueOf(STARTING), Integer.valueOf(STARTED));
sendNotification(notification);
| public void | stop()Stop the servlet container.
Notification notification = null;
if (state != STARTED)
return;
state = STOPPING;
notification = new AttributeChangeNotification
(this, sequenceNumber++, System.currentTimeMillis(),
"Stopping " + NAME, "State", "java.lang.Integer",
Integer.valueOf(STARTED), Integer.valueOf(STOPPING));
sendNotification(notification);
try {
System.setProperty(Context.URL_PKG_PREFIXES, oldUrlValue);
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, oldIcValue);
} catch (Throwable t) {
// FIXME
t.printStackTrace();
}
state = STOPPED;
notification = new AttributeChangeNotification
(this, sequenceNumber++, System.currentTimeMillis(),
"Stopped " + NAME, "State", "java.lang.Integer",
Integer.valueOf(STOPPING), Integer.valueOf(STOPPED));
sendNotification(notification);
|
|