<module name="FileTabCharacter"/>
<module name="TreeWalker">
+ <!-- Block Checks -->
+ <!-- ~60 errors
+ <module name="AvoidNestedBlocks"/>
+ -->
+
<!-- Coding -->
<module name="IllegalInstantiation"/>
https://sourceforge.net/tracker/?func=detail&aid=3039718&group_id=29721&atid=397078
<module name="GenericWhitespace"/>
-->
+ <module name="EmptyForInitializerPad"/>
+ <module name="EmptyForIteratorPad"/>
<!-- ~ 1000 errors
<module name="OperatorWrap">
<property name="option" value="oel"/>
</module>
-->
- <module name="EmptyForInitializerPad"/>
- <module name="EmptyForIteratorPad"/>
</module>
</module>
\ No newline at end of file
("coyoteConnector.protocolHandlerInitializationFailed"), e);
}
- onameProtocolHandler = register(protocolHandler,
- createObjectNameKeyProperties("ProtocolHandler"));
-
// Initialize mapper listener
mapperListener.init();
}
@Override
protected void destroyInternal() throws LifecycleException {
mapperListener.destroy();
- unregister(onameProtocolHandler);
try {
protocolHandler.destroy();
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.juli.logging.Log;
// NOOP
}
+ private ObjectName createObjectName() throws MalformedObjectNameException {
+ // Use the same domain as the connector
+ domain = adapter.getDomain();
+
+ if (domain == null) {
+ return null;
+ }
+
+ StringBuilder name = new StringBuilder(getDomain());
+ name.append(":type=ProtocolHandler,port=");
+ name.append(getPort());
+ InetAddress address = getAddress();
+ if (address != null) {
+ name.append(",address=");
+ name.append(ObjectName.quote(address.toString()));
+ }
+ return new ObjectName(name.toString());
+ }
// ------------------------------------------------------- Lifecycle methods
getLog().info(sm.getString("abstractProtocolHandler.init",
getName()));
+ if (oname == null) {
+ // Component not pre-registered so register it
+ oname = createObjectName();
+ if (oname != null) {
+ Registry.getRegistry(null, null).registerComponent(this, oname,
+ null);
+ }
+ }
+
if (this.domain != null) {
try {
tpOname = new ObjectName(domain + ":" +
getName()), e);
}
+ // If object was pre-registered (mserver != null) what ever registered
+ // the ProtocolHandler should de-register it
+ if (oname != null && mserver == null) {
+ Registry.getRegistry(null, null).unregisterComponent(oname);
+ }
+
if (tpOname != null)
Registry.getRegistry(null, null).unregisterComponent(tpOname);
if (rgOname != null)
throws Exception;
public void log(Request req, Response res, long time);
+
+ /**
+ * Provide the name of the domain to use to register MBeans for conponents
+ * associated with the connector.
+ *
+ * @return The MBean domain name
+ */
+ public String getDomain();
}