costin 2003/02/16 17:17:29
Modified: coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
Log:
More checks on start/stop - to deal with the dynamics of JMX
Revision Changes Path
1.15 +35 -4
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
Index: CoyoteConnector.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- CoyoteConnector.java 10 Feb 2003 00:51:20 -0000 1.14
+++ CoyoteConnector.java 17 Feb 2003 01:17:28 -0000 1.15
@@ -1195,9 +1195,11 @@
public void stop() throws LifecycleException {
// Validate and update our current state
- if (!started)
- throw new LifecycleException
- (sm.getString("coyoteConnector.notStarted"));
+ if (!started) {
+ log.error(sm.getString("coyoteConnector.notStarted"));
+ return;
+
+ }
lifecycle.fireLifecycleEvent(STOP_EVENT, null);
started = false;
@@ -1274,6 +1276,35 @@
}
public void postDeregister() {
+ try {
+ if( started ) {
+ stop();
+ }
+ } catch( Throwable t ) {
+ log.error( "Unregistering - can't stop", t);
+ }
+ }
+
+ public void init() throws Exception {
+
+ if( this.getService() != null ) {
+ log.info( "Already configured" );
+ return;
+ }
+
+ // Register to the service
+ ObjectName parentName=new ObjectName( domain + ":" +
+ "type=Service,name=Tomcat-Standalone");
+ log.info("Adding to " + parentName );
+
+ mserver.invoke(parentName, "addConnector", new Object[] { this },
+ new String[] {"org.apache.catalina.Connector"});
+ // initialize(); - is called by addConnector
}
+ public void destroy() throws Exception {
+ if( getService() == null)
+ return;
+ getService().removeConnector(this);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]