You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/05/10 17:20:25 UTC
[tomcat] branch main updated: Code clean-up - formatting. No functional change.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 612e2cd302 Code clean-up - formatting. No functional change.
612e2cd302 is described below
commit 612e2cd302e73340d2b2d85c21cdb5a67d3c9cca
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed May 10 17:04:27 2023 +0100
Code clean-up - formatting. No functional change.
Main purpose is to trigger CI build to test building with Java 21
---
java/org/apache/catalina/ant/jmx/Arg.java | 8 +-
.../catalina/ant/jmx/JMXAccessorCondition.java | 40 +++--
.../catalina/ant/jmx/JMXAccessorConditionBase.java | 36 +++--
.../catalina/ant/jmx/JMXAccessorCreateTask.java | 49 +++---
.../ant/jmx/JMXAccessorEqualsCondition.java | 9 +-
.../catalina/ant/jmx/JMXAccessorGetTask.java | 26 ++--
.../catalina/ant/jmx/JMXAccessorInvokeTask.java | 67 ++++----
.../catalina/ant/jmx/JMXAccessorQueryTask.java | 25 +--
.../catalina/ant/jmx/JMXAccessorSetTask.java | 44 +++---
.../apache/catalina/ant/jmx/JMXAccessorTask.java | 173 +++++++++------------
.../ant/jmx/JMXAccessorUnregisterTask.java | 28 ++--
11 files changed, 251 insertions(+), 254 deletions(-)
diff --git a/java/org/apache/catalina/ant/jmx/Arg.java b/java/org/apache/catalina/ant/jmx/Arg.java
index dc47302f3a..ba9059cae8 100644
--- a/java/org/apache/catalina/ant/jmx/Arg.java
+++ b/java/org/apache/catalina/ant/jmx/Arg.java
@@ -21,12 +21,12 @@ public class Arg {
private String type;
private String value;
- public void setType( String type) {
- this.type=type;
+ public void setType(String type) {
+ this.type = type;
}
- public void setValue( String value ) {
- this.value=value;
+ public void setValue(String value) {
+ this.value = value;
}
public String getValue() {
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorCondition.java b/java/org/apache/catalina/ant/jmx/JMXAccessorCondition.java
index 37e2e6a762..9fe020b2ac 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorCondition.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorCondition.java
@@ -20,6 +20,7 @@ import org.apache.tools.ant.BuildException;
/**
* <b>Definition</b>:
+ *
* <pre>
* <path id="catalina_ant">
* <fileset dir="${catalina.home}/server/lib">
@@ -38,6 +39,7 @@ import org.apache.tools.ant.BuildException;
* </pre>
*
* <b>Usage</b>: Wait for start backup node
+ *
* <pre>
* <target name="wait">
* <jmxOpen
@@ -61,28 +63,30 @@ import org.apache.tools.ant.BuildException;
* <fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" />
* <echo message="Server ${url} alive" />
* </target>
- *
* </pre>
+ *
* Allowed operation between jmx attribute and reference value:
* <ul>
- * <li>== equals</li>
- * <li>!= not equals</li>
+ * <li>== equals</li>
+ * <li>!= not equals</li>
* <li>> greater than (&gt;)</li>
* <li>>= greater than or equals (&gt;=)</li>
* <li>< lesser than (&lt;)</li>
* <li><= lesser than or equals (&lt;=)</li>
* </ul>
- * <b>NOTE</b>: For numeric expressions the type must be set and use xml entities as operations.<br>
+ * <b>NOTE</b>: For numeric expressions the type must be set and use xml entities as operations.<br>
* As type we currently support <em>long</em> and <em>double</em>.
+ *
* @author Peter Rossbach
+ *
* @since 5.5.10
*/
public class JMXAccessorCondition extends JMXAccessorConditionBase {
// ----------------------------------------------------- Instance Variables
- private String operation = "==" ;
- private String type = "long" ;
+ private String operation = "==";
+ private String type = "long";
private String unlessCondition;
private String ifCondition;
@@ -95,6 +99,7 @@ public class JMXAccessorCondition extends JMXAccessorConditionBase {
public String getOperation() {
return operation;
}
+
/**
* @param operation The operation to set.
*/
@@ -108,6 +113,7 @@ public class JMXAccessorCondition extends JMXAccessorConditionBase {
public String getType() {
return type;
}
+
/**
* @param type The type to set.
*/
@@ -121,23 +127,26 @@ public class JMXAccessorCondition extends JMXAccessorConditionBase {
public String getIf() {
return ifCondition;
}
+
/**
* Only execute if a property of the given name exists in the current project.
+ *
* @param c property name
*/
public void setIf(String c) {
ifCondition = c;
}
- /**
+ /**
* @return Returns the unlessCondition.
*/
public String getUnless() {
return unlessCondition;
}
+
/**
- * Only execute if a property of the given name does not
- * exist in the current project.
+ * Only execute if a property of the given name does not exist in the current project.
+ *
* @param c property name
*/
public void setUnless(String c) {
@@ -146,6 +155,7 @@ public class JMXAccessorCondition extends JMXAccessorConditionBase {
/**
* test the if condition
+ *
* @return true if there is no if condition, or the named property exists
*/
protected boolean testIfCondition() {
@@ -157,8 +167,8 @@ public class JMXAccessorCondition extends JMXAccessorConditionBase {
/**
* test the unless condition
- * @return true if there is no unless condition,
- * or there is a named property but it doesn't exist
+ *
+ * @return true if there is no unless condition, or there is a named property but it doesn't exist
*/
protected boolean testUnlessCondition() {
if (unlessCondition == null || "".equals(unlessCondition)) {
@@ -168,8 +178,9 @@ public class JMXAccessorCondition extends JMXAccessorConditionBase {
}
/**
- * This method evaluates the condition
- * It support for operation ">,>=,<,<=" the types <code>long</code> and <code>double</code>.
+ * This method evaluates the condition It support for operation ">,>=,<,<=" the types <code>long</code>
+ * and <code>double</code>.
+ *
* @return expression <em>jmxValue</em> <em>operation</em> <em>value</em>
*/
@Override
@@ -182,8 +193,7 @@ public class JMXAccessorCondition extends JMXAccessorConditionBase {
throw new BuildException("value attribute is not set");
}
if ((getName() == null || getAttribute() == null)) {
- throw new BuildException(
- "Must specify an MBean name and attribute for condition");
+ throw new BuildException("Must specify an MBean name and attribute for condition");
}
if (testIfCondition() && testUnlessCondition()) {
String jmxValue = accessJMXValue();
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorConditionBase.java b/java/org/apache/catalina/ant/jmx/JMXAccessorConditionBase.java
index 27e30e609c..1b355508a0 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorConditionBase.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorConditionBase.java
@@ -35,7 +35,7 @@ public abstract class JMXAccessorConditionBase extends ProjectComponent implemen
private String name = null;
private String attribute;
private String value;
- private String ref = "jmx.server" ;
+ private String ref = "jmx.server";
/**
* @return Returns the attribute.
@@ -43,90 +43,105 @@ public abstract class JMXAccessorConditionBase extends ProjectComponent implemen
public String getAttribute() {
return attribute;
}
+
/**
* @param attribute The attribute to set.
*/
public void setAttribute(String attribute) {
this.attribute = attribute;
}
+
/**
* @return Returns the host.
*/
public String getHost() {
return host;
}
+
/**
* @param host The host to set.
*/
public void setHost(String host) {
this.host = host;
}
+
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
+
/**
* @param objectName The name to set.
*/
public void setName(String objectName) {
this.name = objectName;
}
+
/**
* @return Returns the password.
*/
public String getPassword() {
return password;
}
+
/**
* @param password The password to set.
*/
public void setPassword(String password) {
this.password = password;
}
+
/**
* @return Returns the port.
*/
public String getPort() {
return port;
}
+
/**
* @param port The port to set.
*/
public void setPort(String port) {
this.port = port;
}
+
/**
* @return Returns the url.
*/
public String getUrl() {
return url;
}
+
/**
* @param url The url to set.
*/
public void setUrl(String url) {
this.url = url;
}
+
/**
* @return Returns the username.
*/
public String getUsername() {
return username;
}
+
/**
* @param username The username to set.
*/
public void setUsername(String username) {
this.username = username;
}
+
/**
* @return Returns the value.
*/
public String getValue() {
return value;
}
+
// The setter for the "value" attribute
public void setValue(String value) {
this.value = value;
@@ -138,6 +153,7 @@ public abstract class JMXAccessorConditionBase extends ProjectComponent implemen
public String getRef() {
return ref;
}
+
/**
* @param refId The ref to set.
*/
@@ -146,19 +162,16 @@ public abstract class JMXAccessorConditionBase extends ProjectComponent implemen
}
/**
- * Get JMXConnection (default look at <em>jmx.server</em> project reference
- * from jmxOpen Task).
+ * Get JMXConnection (default look at <em>jmx.server</em> project reference from jmxOpen Task).
*
* @return active JMXConnection
+ *
* @throws MalformedURLException Invalid URL for JMX server
- * @throws IOException Connection error
+ * @throws IOException Connection error
*/
- protected MBeanServerConnection getJMXConnection()
- throws MalformedURLException, IOException {
- return JMXAccessorTask.accessJMXConnection(
- getProject(),
- getUrl(), getHost(),
- getPort(), getUsername(), getPassword(), ref);
+ protected MBeanServerConnection getJMXConnection() throws MalformedURLException, IOException {
+ return JMXAccessorTask.accessJMXConnection(getProject(), getUrl(), getHost(), getPort(), getUsername(),
+ getPassword(), ref);
}
/**
@@ -168,8 +181,7 @@ public abstract class JMXAccessorConditionBase extends ProjectComponent implemen
*/
protected String accessJMXValue() {
try {
- Object result = getJMXConnection().getAttribute(
- new ObjectName(name), attribute);
+ Object result = getJMXConnection().getAttribute(new ObjectName(name), attribute);
if (result != null) {
return result.toString();
}
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorCreateTask.java b/java/org/apache/catalina/ant/jmx/JMXAccessorCreateTask.java
index 9c5fc961a5..61668aaf27 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorCreateTask.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorCreateTask.java
@@ -32,10 +32,10 @@ import org.apache.tools.ant.BuildException;
* <li>Create remote Mbeans with different classloader</li>
* </ul>
* <p>
- * Examples:
- * <br>
+ * Examples: <br>
* create a new Mbean at jmx.server connection
* </p>
+ *
* <pre>
* <jmx:create
* ref="jmx.server"
@@ -46,8 +46,8 @@ import org.apache.tools.ant.BuildException;
* </jmxCreate/>
* </pre>
* <p>
- * <b>WARNING</b>Not all Tomcat MBeans can create remotely and autoregister by its parents!
- * Please, use the MBeanFactory operation to generate valves and realms.
+ * <b>WARNING</b>Not all Tomcat MBeans can create remotely and autoregister by its parents! Please, use the MBeanFactory
+ * operation to generate valves and realms.
* </p>
* <p>
* First call to a remote MBeanserver save the JMXConnection a reference <em>jmx.server</em>
@@ -55,6 +55,7 @@ import org.apache.tools.ant.BuildException;
* These tasks require Ant 1.6 or later interface.
*
* @author Peter Rossbach
+ *
* @since 5.5.12
*/
public class JMXAccessorCreateTask extends JMXAccessorTask {
@@ -62,7 +63,7 @@ public class JMXAccessorCreateTask extends JMXAccessorTask {
private String className;
private String classLoader;
- private List<Arg> args=new ArrayList<>();
+ private List<Arg> args = new ArrayList<>();
// ------------------------------------------------------------- Properties
@@ -94,7 +95,7 @@ public class JMXAccessorCreateTask extends JMXAccessorTask {
this.className = className;
}
- public void addArg(Arg arg ) {
+ public void addArg(Arg arg) {
args.add(arg);
}
@@ -104,6 +105,7 @@ public class JMXAccessorCreateTask extends JMXAccessorTask {
public List<Arg> getArgs() {
return args;
}
+
/**
* @param args The args to set.
*/
@@ -114,15 +116,13 @@ public class JMXAccessorCreateTask extends JMXAccessorTask {
// ------------------------------------------------------ protected Methods
@Override
- public String jmxExecute(MBeanServerConnection jmxServerConnection)
- throws Exception {
+ public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception {
if (getName() == null) {
throw new BuildException("Must specify a 'name'");
}
if ((className == null)) {
- throw new BuildException(
- "Must specify a 'className' for get");
+ throw new BuildException("Must specify a 'className' for get");
}
jmxCreate(jmxServerConnection, getName());
return null;
@@ -132,25 +132,25 @@ public class JMXAccessorCreateTask extends JMXAccessorTask {
* Create new MBean from ClassLoader identified by an ObjectName.
*
* @param jmxServerConnection Connection to the JMX server
- * @param name MBean name
+ * @param name MBean name
+ *
* @throws Exception Error creating MBean
*/
- protected void jmxCreate(MBeanServerConnection jmxServerConnection,
- String name) throws Exception {
+ protected void jmxCreate(MBeanServerConnection jmxServerConnection, String name) throws Exception {
Object argsA[] = null;
String sigA[] = null;
if (args != null) {
- argsA = new Object[ args.size()];
+ argsA = new Object[args.size()];
sigA = new String[args.size()];
- for( int i=0; i<args.size(); i++ ) {
- Arg arg=args.get(i);
+ for (int i = 0; i < args.size(); i++) {
+ Arg arg = args.get(i);
if (arg.getType() == null) {
arg.setType("java.lang.String");
- sigA[i]=arg.getType();
- argsA[i]=arg.getValue();
+ sigA[i] = arg.getType();
+ argsA[i] = arg.getValue();
} else {
- sigA[i]=arg.getType();
- argsA[i]=convertStringToType(arg.getValue(),arg.getType());
+ sigA[i] = arg.getType();
+ argsA[i] = convertStringToType(arg.getValue(), arg.getType());
}
}
}
@@ -158,20 +158,21 @@ public class JMXAccessorCreateTask extends JMXAccessorTask {
if (isEcho()) {
handleOutput("create MBean " + name + " from class " + className + " with classLoader " + classLoader);
}
- if(args == null) {
+ if (args == null) {
jmxServerConnection.createMBean(className, new ObjectName(name), new ObjectName(classLoader));
} else {
- jmxServerConnection.createMBean(className, new ObjectName(name), new ObjectName(classLoader),argsA,sigA);
+ jmxServerConnection.createMBean(className, new ObjectName(name), new ObjectName(classLoader), argsA,
+ sigA);
}
} else {
if (isEcho()) {
handleOutput("create MBean " + name + " from class " + className);
}
- if(args == null) {
+ if (args == null) {
jmxServerConnection.createMBean(className, new ObjectName(name));
} else {
- jmxServerConnection.createMBean(className, new ObjectName(name),argsA,sigA);
+ jmxServerConnection.createMBean(className, new ObjectName(name), argsA, sigA);
}
}
}
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorEqualsCondition.java b/java/org/apache/catalina/ant/jmx/JMXAccessorEqualsCondition.java
index 7fcccc6743..c46ee21483 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorEqualsCondition.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorEqualsCondition.java
@@ -20,6 +20,7 @@ import org.apache.tools.ant.BuildException;
/**
* Definition
+ *
* <pre>
* <path id="catalina_ant">
* <fileset dir="${catalina.home}/server/lib">
@@ -34,6 +35,7 @@ import org.apache.tools.ant.BuildException;
* </pre>
*
* usage: Wait for start backup node
+ *
* <pre>
* <target name="wait">
* <waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" >
@@ -50,10 +52,10 @@ import org.apache.tools.ant.BuildException;
* <fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" />
* <echo message="Server ${url} alive" />
* </target>
- *
* </pre>
*
* @author Peter Rossbach
+ *
* @since 5.5.10
*/
public class JMXAccessorEqualsCondition extends JMXAccessorConditionBase {
@@ -66,10 +68,9 @@ public class JMXAccessorEqualsCondition extends JMXAccessorConditionBase {
throw new BuildException("value attribute is not set");
}
if (getName() == null || getAttribute() == null) {
- throw new BuildException(
- "Must specify an MBean name and attribute for equals condition");
+ throw new BuildException("Must specify an MBean name and attribute for equals condition");
}
- //FIXME check url or host/parameter
+ // FIXME check url or host/parameter
String jmxValue = accessJMXValue();
if (jmxValue != null) {
return jmxValue.equals(value);
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorGetTask.java b/java/org/apache/catalina/ant/jmx/JMXAccessorGetTask.java
index 541abf2b0b..a0d6e2a388 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorGetTask.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorGetTask.java
@@ -31,10 +31,10 @@ import org.apache.tools.ant.BuildException;
* <li>Bind Get result as Ant properties</li>
* </ul>
* <p>
- * Examples:
- * <br>
+ * Examples: <br>
* Get an Mbean IDataSender attribute nrOfRequests and create a new ant property <em>IDataSender.9025.nrOfRequests</em>
* </p>
+ *
* <pre>
* <jmx:get
* ref="jmx.server"
@@ -50,6 +50,7 @@ import org.apache.tools.ant.BuildException;
* These tasks require Ant 1.6 or later interface.
*
* @author Peter Rossbach
+ *
* @since 5.5.10
*/
public class JMXAccessorGetTask extends JMXAccessorTask {
@@ -79,17 +80,15 @@ public class JMXAccessorGetTask extends JMXAccessorTask {
// ------------------------------------------------------ protected Methods
@Override
- public String jmxExecute(MBeanServerConnection jmxServerConnection)
- throws Exception {
+ public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception {
if (getName() == null) {
throw new BuildException("Must specify a 'name'");
}
if ((attribute == null)) {
- throw new BuildException(
- "Must specify a 'attribute' for get");
+ throw new BuildException("Must specify a 'attribute' for get");
}
- return jmxGet(jmxServerConnection, getName());
+ return jmxGet(jmxServerConnection, getName());
}
@@ -97,19 +96,20 @@ public class JMXAccessorGetTask extends JMXAccessorTask {
* Get property value.
*
* @param jmxServerConnection Connection to the JMX server
- * @param name The MBean name
+ * @param name The MBean name
+ *
* @return The error message if any
+ *
* @throws Exception An error occurred
*/
protected String jmxGet(MBeanServerConnection jmxServerConnection, String name) throws Exception {
String error = null;
- if(isEcho()) {
- handleOutput("MBean " + name + " get attribute " + attribute );
+ if (isEcho()) {
+ handleOutput("MBean " + name + " get attribute " + attribute);
}
- Object result = jmxServerConnection.getAttribute(
- new ObjectName(name), attribute);
+ Object result = jmxServerConnection.getAttribute(new ObjectName(name), attribute);
if (result != null) {
- echoResult(attribute,result);
+ echoResult(attribute, result);
createProperty(result);
} else {
error = "Attribute " + attribute + " is empty";
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorInvokeTask.java b/java/org/apache/catalina/ant/jmx/JMXAccessorInvokeTask.java
index daf5013743..50f2d65064 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorInvokeTask.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorInvokeTask.java
@@ -32,17 +32,16 @@ import org.apache.tools.ant.BuildException;
* <li>open more then one JSR 160 rmi connection</li>
* <li>Get/Set Mbeans attributes</li>
* <li>Call Mbean Operation with arguments</li>
- * <li>Argument values can be converted from string to int,long,float,double,boolean,ObjectName or InetAddress </li>
+ * <li>Argument values can be converted from string to int,long,float,double,boolean,ObjectName or InetAddress</li>
* <li>Query Mbeans</li>
* <li>Show Get, Call, Query result at Ant console log</li>
* <li>Bind Get, Call, Query result at Ant properties</li>
* </ul>
- *
* Examples:
* <ul>
- * <li>
- * Get a session attribute hello from session with ref <em>${sessionid.0}</em> form
- * app <em>Catalina:type=Manager,context=/ClusterTest,host=localhost</em>
+ * <li>Get a session attribute hello from session with ref <em>${sessionid.0}</em> form app
+ * <em>Catalina:type=Manager,context=/ClusterTest,host=localhost</em>
+ *
* <pre>
* <jmx:invoke
* name="Catalina:type=Manager,context=/ClusterTest,host=localhost"
@@ -52,10 +51,9 @@ import org.apache.tools.ant.BuildException;
* <arg value="Hello"/>
* </jmx:invoke>
* </pre>
+ *
* </li>
- * <li>
- * Create new AccessLogger at localhost
- * <code>
+ * <li>Create new AccessLogger at localhost <code>
* <jmx:invoke
* name="Catalina:type=MBeanFactory"
* operation="createAccessLoggerValve"
@@ -64,11 +62,8 @@ import org.apache.tools.ant.BuildException;
* <arg value="Catalina:type=Host,host=localhost"/>
* </jmx:invoke>
*
- * </code>
- * </li>
- * <li>
- * Remove existing AccessLogger at localhost
- * <code>
+ * </code></li>
+ * <li>Remove existing AccessLogger at localhost <code>
* <jmx:invoke
* name="Catalina:type=MBeanFactory"
* operation="removeValve"
@@ -76,8 +71,7 @@ import org.apache.tools.ant.BuildException;
* <arg value="Catalina:type=Valve,name=AccessLogValve,host=localhost"/>
* </jmx:invoke>
*
- * </code>
- * </li>
+ * </code></li>
* </ul>
* <p>
* First call to a remote MBeanserver save the JMXConnection a referenz <em>jmx.server</em>
@@ -85,6 +79,7 @@ import org.apache.tools.ant.BuildException;
* These tasks require Ant 1.6 or later interface.
*
* @author Peter Rossbach
+ *
* @since 5.5.10
*/
public class JMXAccessorInvokeTask extends JMXAccessorTask {
@@ -92,8 +87,8 @@ public class JMXAccessorInvokeTask extends JMXAccessorTask {
// ----------------------------------------------------- Instance Variables
- private String operation ;
- private List<Arg> args=new ArrayList<>();
+ private String operation;
+ private List<Arg> args = new ArrayList<>();
// ------------------------------------------------------------- Properties
@@ -103,6 +98,7 @@ public class JMXAccessorInvokeTask extends JMXAccessorTask {
public String getOperation() {
return operation;
}
+
/**
* @param operation The operation to set.
*/
@@ -110,7 +106,7 @@ public class JMXAccessorInvokeTask extends JMXAccessorTask {
this.operation = operation;
}
- public void addArg(Arg arg ) {
+ public void addArg(Arg arg) {
args.add(arg);
}
@@ -120,6 +116,7 @@ public class JMXAccessorInvokeTask extends JMXAccessorTask {
public List<Arg> getArgs() {
return args;
}
+
/**
* @param args The args to set.
*/
@@ -130,49 +127,49 @@ public class JMXAccessorInvokeTask extends JMXAccessorTask {
// ------------------------------------------------------ protected Methods
@Override
- public String jmxExecute(MBeanServerConnection jmxServerConnection)
- throws Exception {
+ public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception {
if (getName() == null) {
throw new BuildException("Must specify a 'name'");
}
if ((operation == null)) {
- throw new BuildException(
- "Must specify a 'operation' for call");
+ throw new BuildException("Must specify a 'operation' for call");
}
- return jmxInvoke(jmxServerConnection, getName());
+ return jmxInvoke(jmxServerConnection, getName());
}
/**
* Invoke specified operation.
*
* @param jmxServerConnection Connection to the JMX server
- * @param name The MBean name
+ * @param name The MBean name
+ *
* @return null (no error message to report other than exception)
+ *
* @throws Exception An error occurred
*/
protected String jmxInvoke(MBeanServerConnection jmxServerConnection, String name) throws Exception {
- Object result ;
+ Object result;
if (args == null) {
result = jmxServerConnection.invoke(new ObjectName(name), operation, null, null);
} else {
- Object argsA[]=new Object[ args.size()];
- String sigA[]=new String[args.size()];
- for( int i=0; i<args.size(); i++ ) {
- Arg arg=args.get(i);
+ Object argsA[] = new Object[args.size()];
+ String sigA[] = new String[args.size()];
+ for (int i = 0; i < args.size(); i++) {
+ Arg arg = args.get(i);
if (arg.getType() == null) {
arg.setType("java.lang.String");
- sigA[i]=arg.getType();
- argsA[i]=arg.getValue();
+ sigA[i] = arg.getType();
+ argsA[i] = arg.getValue();
} else {
- sigA[i]=arg.getType();
- argsA[i]=convertStringToType(arg.getValue(),arg.getType());
+ sigA[i] = arg.getType();
+ argsA[i] = convertStringToType(arg.getValue(), arg.getType());
}
}
result = jmxServerConnection.invoke(new ObjectName(name), operation, argsA, sigA);
}
- if(result != null) {
- echoResult(operation,result);
+ if (result != null) {
+ echoResult(operation, result);
createProperty(result);
}
return null;
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorQueryTask.java b/java/org/apache/catalina/ant/jmx/JMXAccessorQueryTask.java
index 4f8aa81b46..8358e9f924 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorQueryTask.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorQueryTask.java
@@ -38,6 +38,7 @@ import org.apache.tools.ant.BuildException;
* </ul>
* <br>
* Query a list of Mbeans.
+ *
* <pre>
* <jmxQuery
* host="127.0.0.1"
@@ -45,14 +46,13 @@ import org.apache.tools.ant.BuildException;
* name="Catalina:type=Manager,*
* resultproperty="manager" />
* </pre>
- * with attribute <em>attributebinding="true"</em> you can get
- * all attributes also from result objects.<br>
- * The property manager.length show the size of the result
- * and with manager.[0..length].name the
- * resulted ObjectNames are saved.
- * These tasks require Ant 1.6 or later interface.
+ *
+ * with attribute <em>attributebinding="true"</em> you can get all attributes also from result objects.<br>
+ * The property manager.length show the size of the result and with manager.[0..length].name the resulted ObjectNames
+ * are saved. These tasks require Ant 1.6 or later interface.
*
* @author Peter Rossbach
+ *
* @since 5.5.10
*/
public class JMXAccessorQueryTask extends JMXAccessorTask {
@@ -69,6 +69,7 @@ public class JMXAccessorQueryTask extends JMXAccessorTask {
public boolean isAttributebinding() {
return attributebinding;
}
+
/**
* @param attributeBinding The attributebinding to set.
*/
@@ -80,8 +81,7 @@ public class JMXAccessorQueryTask extends JMXAccessorTask {
@Override
- public String jmxExecute(MBeanServerConnection jmxServerConnection)
- throws Exception {
+ public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception {
if (getName() == null) {
throw new BuildException("Must specify a 'name'");
@@ -92,11 +92,12 @@ public class JMXAccessorQueryTask extends JMXAccessorTask {
/**
- * Call Mbean server for some mbeans with same domain, attributes.
- * with <em>attributebinding=true</em> you can save all attributes from all found objects
+ * Call Mbean server for some mbeans with same domain, attributes. with <em>attributebinding=true</em> you can save
+ * all attributes from all found objects
*
* @param jmxServerConnection Connection to the JMX server
- * @param qry The query
+ * @param qry The query
+ *
* @return null (no error message to report other than exception)
*/
protected String jmxQuery(MBeanServerConnection jmxServerConnection, String qry) {
@@ -106,7 +107,7 @@ public class JMXAccessorQueryTask extends JMXAccessorTask {
try {
names = jmxServerConnection.queryNames(new ObjectName(qry), null);
if (resultproperty != null) {
- setProperty(resultproperty + ".Length",Integer.toString(names.size()));
+ setProperty(resultproperty + ".Length", Integer.toString(names.size()));
}
} catch (Exception e) {
if (isEcho()) {
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java b/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java
index c870f92c24..fdb8270ca3 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java
@@ -34,10 +34,10 @@ import org.apache.tools.ant.BuildException;
* <li>Bind Get result as Ant properties</li>
* </ul>
* <p>
- * Examples:
- * Set an Mbean Manager attribute maxActiveSessions.
- * Set this attribute with fresh jmx connection without save reference
+ * Examples: Set an Mbean Manager attribute maxActiveSessions. Set this attribute with fresh jmx connection without save
+ * reference
* </p>
+ *
* <pre>
* <jmx:set
* host="127.0.0.1"
@@ -56,6 +56,7 @@ import org.apache.tools.ant.BuildException;
* These tasks require Ant 1.6 or later interface.
*
* @author Peter Rossbach
+ *
* @since 5.5.10
*/
public class JMXAccessorSetTask extends JMXAccessorTask {
@@ -65,7 +66,7 @@ public class JMXAccessorSetTask extends JMXAccessorTask {
private String attribute;
private String value;
private String type;
- private boolean convert = false ;
+ private boolean convert = false;
// ------------------------------------------------------------- Properties
@@ -89,6 +90,7 @@ public class JMXAccessorSetTask extends JMXAccessorTask {
public String getValue() {
return value;
}
+
/**
* @param value The value to set.
*/
@@ -118,6 +120,7 @@ public class JMXAccessorSetTask extends JMXAccessorTask {
public boolean isConvert() {
return convert;
}
+
/**
* @param convert The convert to set.
*/
@@ -127,43 +130,40 @@ public class JMXAccessorSetTask extends JMXAccessorTask {
// ------------------------------------------------------ protected Methods
@Override
- public String jmxExecute(MBeanServerConnection jmxServerConnection)
- throws Exception {
+ public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception {
if (getName() == null) {
throw new BuildException("Must specify a 'name'");
}
if ((attribute == null || value == null)) {
- throw new BuildException(
- "Must specify a 'attribute' and 'value' for set");
+ throw new BuildException("Must specify a 'attribute' and 'value' for set");
}
- return jmxSet(jmxServerConnection, getName());
+ return jmxSet(jmxServerConnection, getName());
}
/**
* Set property value.
*
* @param jmxServerConnection Connection to the JMX server
- * @param name The MBean name
+ * @param name The MBean name
+ *
* @return null (no error message to report other than exception)
+ *
* @throws Exception An error occurred
*/
- protected String jmxSet(MBeanServerConnection jmxServerConnection,
- String name) throws Exception {
+ protected String jmxSet(MBeanServerConnection jmxServerConnection, String name) throws Exception {
Object realValue;
if (type != null) {
realValue = convertStringToType(value, type);
} else {
if (isConvert()) {
- String mType = getMBeanAttributeType(jmxServerConnection, name,
- attribute);
+ String mType = getMBeanAttributeType(jmxServerConnection, name, attribute);
realValue = convertStringToType(value, mType);
} else {
realValue = value;
}
}
- jmxServerConnection.setAttribute(new ObjectName(name), new Attribute(
- attribute, realValue));
+ jmxServerConnection.setAttribute(new ObjectName(name), new Attribute(attribute, realValue));
return null;
}
@@ -172,15 +172,15 @@ public class JMXAccessorSetTask extends JMXAccessorTask {
* Get MBean Attribute from Mbean Server
*
* @param jmxServerConnection The JMX connection name
- * @param name The MBean name
- * @param attribute The attribute name
+ * @param name The MBean name
+ * @param attribute The attribute name
+ *
* @return The type of the attribute
+ *
* @throws Exception An error occurred
*/
- protected String getMBeanAttributeType(
- MBeanServerConnection jmxServerConnection,
- String name,
- String attribute) throws Exception {
+ protected String getMBeanAttributeType(MBeanServerConnection jmxServerConnection, String name, String attribute)
+ throws Exception {
ObjectName oname = new ObjectName(name);
String mattrType = null;
MBeanInfo minfo = jmxServerConnection.getMBeanInfo(oname);
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java b/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
index c03d543ab0..585461470d 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java
@@ -51,13 +51,11 @@ import org.apache.tools.ant.Project;
* <li>open more then one JSR 160 rmi connection</li>
* <li>Get/Set Mbeans attributes</li>
* <li>Call Mbean Operation with arguments</li>
- * <li>Argument values can be converted from string to
- * int,long,float,double,boolean,ObjectName or InetAddress</li>
+ * <li>Argument values can be converted from string to int,long,float,double,boolean,ObjectName or InetAddress</li>
* <li>Query Mbeans</li>
* <li>Show Get, Call, Query result at Ant console log</li>
* <li>Bind Get, Call, Query result at Ant properties</li>
* </ul>
- *
* Examples: open server with reference and authorisation
*
* <pre>
@@ -69,20 +67,18 @@ import org.apache.tools.ant.Project;
* password="mysecret"
* ref="jmx.myserver"
* />
- *
* </pre>
*
* All calls after opening with same refid reuse the connection.
* <p>
- * First call to a remote MBeanserver save the JMXConnection a referenz
- * <em>jmx.server</em>
+ * First call to a remote MBeanserver save the JMXConnection a referenz <em>jmx.server</em>
* </p>
- * All JMXAccessorXXXTask support the attribute <em>if</em> and
- * <em>unless</em>. With <em>if</em> the task is only execute when property
- * exist and with <em>unless</em> when property not exists. <br><b>NOTE
- * </b>: These tasks require Ant 1.6 or later interface.
+ * All JMXAccessorXXXTask support the attribute <em>if</em> and <em>unless</em>. With <em>if</em> the task is only
+ * execute when property exist and with <em>unless</em> when property not exists. <br>
+ * <b>NOTE </b>: These tasks require Ant 1.6 or later interface.
*
* @author Peter Rossbach
+ *
* @since 5.5.10
*/
public class JMXAccessorTask extends BaseRedirectorHelperTask {
@@ -172,8 +168,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
}
/**
- * @param echo
- * The echo to set.
+ * @param echo The echo to set.
*/
public void setEcho(boolean echo) {
this.echo = echo;
@@ -187,8 +182,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
}
/**
- * @param separateArrayResults
- * The separatearrayresults to set.
+ * @param separateArrayResults The separatearrayresults to set.
*/
public void setSeparatearrayresults(boolean separateArrayResults) {
this.separatearrayresults = separateArrayResults;
@@ -278,8 +272,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
}
/**
- * Only execute if a property of the given name exists in the current
- * project.
+ * Only execute if a property of the given name exists in the current project.
*
* @param c property name
*/
@@ -295,8 +288,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
}
/**
- * Only execute if a property of the given name does not exist in the
- * current project.
+ * Only execute if a property of the given name does not exist in the current project.
*
* @param c property name
*/
@@ -307,12 +299,10 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
// --------------------------------------------------------- Public Methods
/**
- * Execute the specified command. This logic only performs the common
- * attribute validation required by all subclasses; it does not perform any
- * functional logic directly.
+ * Execute the specified command. This logic only performs the common attribute validation required by all
+ * subclasses; it does not perform any functional logic directly.
*
- * @exception BuildException
- * if a validation error occurs
+ * @exception BuildException if a validation error occurs
*/
@Override
public void execute() throws BuildException {
@@ -342,27 +332,27 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
/**
* Create a new JMX Connection with auth when username and password is set.
*
- * @param url URL to be used for the JMX connection
- * (if specified, it is a complete URL so host and port will not
- * be used)
- * @param host Host name of the JMX server
- * @param port Port number for the JMX server
+ * @param url URL to be used for the JMX connection (if specified, it is a complete URL so host and port will
+ * not be used)
+ * @param host Host name of the JMX server
+ * @param port Port number for the JMX server
* @param username User name for the connection
* @param password Credentials corresponding to the specified user
+ *
* @throws MalformedURLException Invalid URL specified
- * @throws IOException Other connection error
+ * @throws IOException Other connection error
+ *
* @return the JMX connection
*/
- public static MBeanServerConnection createJMXConnection(String url,
- String host, String port, String username, String password)
- throws MalformedURLException, IOException {
+ public static MBeanServerConnection createJMXConnection(String url, String host, String port, String username,
+ String password) throws MalformedURLException, IOException {
String urlForJMX;
if (url != null) {
urlForJMX = url;
} else {
urlForJMX = JMX_SERVICE_PREFIX + host + ":" + port + JMX_SERVICE_SUFFIX;
}
- Map<String, String[]> environment = null;
+ Map<String,String[]> environment = null;
if (username != null && password != null) {
String[] credentials = new String[2];
credentials[0] = username;
@@ -370,8 +360,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
environment = new HashMap<>();
environment.put(JMXConnector.CREDENTIALS, credentials);
}
- return JMXConnectorFactory.connect(new JMXServiceURL(urlForJMX),
- environment).getMBeanServerConnection();
+ return JMXConnectorFactory.connect(new JMXServiceURL(urlForJMX), environment).getMBeanServerConnection();
}
@@ -390,8 +379,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
/**
* test the unless condition
*
- * @return true if there is no unless condition, or there is a named
- * property but it doesn't exist
+ * @return true if there is no unless condition, or there is a named property but it doesn't exist
*/
protected boolean testUnlessCondition() {
if (unlessCondition == null || "".equals(unlessCondition)) {
@@ -403,24 +391,23 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
/**
* Get Current Connection from <em>ref</em> parameter or create a new one!
*
- * @param project The Ant project
- * @param url URL to be used for the JMX connection
- * (if specified, it is a complete URL so host and port will not
- * be used)
- * @param host Host name of the JMX server
- * @param port Port number for the JMX server
+ * @param project The Ant project
+ * @param url URL to be used for the JMX connection (if specified, it is a complete URL so host and port will
+ * not be used)
+ * @param host Host name of the JMX server
+ * @param port Port number for the JMX server
* @param username User name for the connection
* @param password Credentials corresponding to the specified user
- * @param refId The Id of the reference to retrieve in the project
+ * @param refId The Id of the reference to retrieve in the project
+ *
* @throws MalformedURLException Invalid URL specified
- * @throws IOException Other connection error
+ * @throws IOException Other connection error
+ *
* @return the JMX connection
*/
@SuppressWarnings("null")
- public static MBeanServerConnection accessJMXConnection(Project project,
- String url, String host, String port, String username,
- String password, String refId) throws MalformedURLException,
- IOException {
+ public static MBeanServerConnection accessJMXConnection(Project project, String url, String host, String port,
+ String username, String password, String refId) throws MalformedURLException, IOException {
MBeanServerConnection jmxServerConnection = null;
boolean isRef = project != null && refId != null && refId.length() > 0;
if (isRef) {
@@ -428,14 +415,12 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
try {
jmxServerConnection = (MBeanServerConnection) pref;
} catch (ClassCastException cce) {
- project.log("wrong object reference " + refId + " - "
- + pref.getClass());
+ project.log("wrong object reference " + refId + " - " + pref.getClass());
return null;
}
}
if (jmxServerConnection == null) {
- jmxServerConnection = createJMXConnection(url, host, port,
- username, password);
+ jmxServerConnection = createJMXConnection(url, host, port, username, password);
}
if (isRef && jmxServerConnection != null) {
project.addReference(refId, jmxServerConnection);
@@ -449,51 +434,48 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
* get JMXConnection
*
* @throws MalformedURLException Invalid URL specified
- * @throws IOException Other connection error
+ * @throws IOException Other connection error
+ *
* @return the JMX connection
*/
- protected MBeanServerConnection getJMXConnection()
- throws MalformedURLException, IOException {
+ protected MBeanServerConnection getJMXConnection() throws MalformedURLException, IOException {
MBeanServerConnection jmxServerConnection = null;
if (isUseRef()) {
- Object pref = null ;
- if(getProject() != null) {
+ Object pref = null;
+ if (getProject() != null) {
pref = getProject().getReference(getRef());
if (pref != null) {
try {
jmxServerConnection = (MBeanServerConnection) pref;
} catch (ClassCastException cce) {
- getProject().log(
- "Wrong object reference " + getRef() + " - "
- + pref.getClass());
+ getProject().log("Wrong object reference " + getRef() + " - " + pref.getClass());
return null;
}
}
}
if (jmxServerConnection == null) {
- jmxServerConnection = accessJMXConnection(getProject(),
- getUrl(), getHost(), getPort(), getUsername(),
+ jmxServerConnection = accessJMXConnection(getProject(), getUrl(), getHost(), getPort(), getUsername(),
getPassword(), getRef());
}
} else {
- jmxServerConnection = accessJMXConnection(getProject(), getUrl(),
- getHost(), getPort(), getUsername(), getPassword(), null);
+ jmxServerConnection = accessJMXConnection(getProject(), getUrl(), getHost(), getPort(), getUsername(),
+ getPassword(), null);
}
return jmxServerConnection;
}
/**
- * Execute the specified command, based on the configured properties. The
- * input stream will be closed upon completion of this task, whether it was
- * executed successfully or not.
+ * Execute the specified command, based on the configured properties. The input stream will be closed upon
+ * completion of this task, whether it was executed successfully or not.
*
* @param jmxServerConnection The JMX connection that should be used
+ *
* @return An error message string in some situations
+ *
* @exception Exception if an error occurs
*/
- public String jmxExecute(MBeanServerConnection jmxServerConnection)
- throws Exception {
+ public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception {
if ((jmxServerConnection == null)) {
throw new BuildException("Must open a connection!");
@@ -504,11 +486,11 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
}
/**
- * Convert string to datatype FIXME How we can transfer values from ant
- * project reference store (ref)?
+ * Convert string to datatype FIXME How we can transfer values from ant project reference store (ref)?
*
- * @param value The value
+ * @param value The value
* @param valueType The type
+ *
* @return The converted object
*/
protected Object convertStringToType(String value, String valueType) {
@@ -525,8 +507,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
handleErrorOutput("Unable to convert to integer:" + value);
}
}
- } else if ("java.lang.Long".equals(valueType)
- || "long".equals(valueType)) {
+ } else if ("java.lang.Long".equals(valueType) || "long".equals(valueType)) {
try {
convertValue = Long.valueOf(value);
} catch (NumberFormatException ex) {
@@ -534,11 +515,9 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
handleErrorOutput("Unable to convert to long:" + value);
}
}
- } else if ("java.lang.Boolean".equals(valueType)
- || "boolean".equals(valueType)) {
+ } else if ("java.lang.Boolean".equals(valueType) || "boolean".equals(valueType)) {
convertValue = Boolean.valueOf(value);
- } else if ("java.lang.Float".equals(valueType)
- || "float".equals(valueType)) {
+ } else if ("java.lang.Float".equals(valueType) || "float".equals(valueType)) {
try {
convertValue = Float.valueOf(value);
} catch (NumberFormatException ex) {
@@ -546,8 +525,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
handleErrorOutput("Unable to convert to float:" + value);
}
}
- } else if ("java.lang.Double".equals(valueType)
- || "double".equals(valueType)) {
+ } else if ("java.lang.Double".equals(valueType) || "double".equals(valueType)) {
try {
convertValue = Double.valueOf(value);
} catch (NumberFormatException ex) {
@@ -555,8 +533,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
handleErrorOutput("Unable to convert to double:" + value);
}
}
- } else if ("javax.management.ObjectName".equals(valueType)
- || "name".equals(valueType)) {
+ } else if ("javax.management.ObjectName".equals(valueType) || "name".equals(valueType)) {
try {
convertValue = new ObjectName(value);
} catch (MalformedObjectNameException e) {
@@ -577,7 +554,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
}
/**
- * @param name context of result
+ * @param name context of result
* @param result The result
*/
protected void echoResult(String name, Object result) {
@@ -596,6 +573,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
* create result as property with name from attribute resultproperty
*
* @param result The result
+ *
* @see #createProperty(String, Object)
*/
protected void createProperty(Object result) {
@@ -605,15 +583,13 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
}
/**
- * create result as property with name from property prefix When result is
- * an array and isSeparateArrayResults is true, resultproperty used as
- * prefix (<code>resultproperty.0-array.length</code> and store the
- * result array length at <code>resultproperty.length</code>. Other
- * option is that you delimit your result with a delimiter
+ * create result as property with name from property prefix When result is an array and isSeparateArrayResults is
+ * true, resultproperty used as prefix (<code>resultproperty.0-array.length</code> and store the result array length
+ * at <code>resultproperty.length</code>. Other option is that you delimit your result with a delimiter
* (java.util.StringTokenizer is used).
*
* @param propertyPrefix Prefix for the property
- * @param result The result
+ * @param result The result
*/
protected void createProperty(String propertyPrefix, Object result) {
if (propertyPrefix == null) {
@@ -638,8 +614,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
for (Object key1 : ((List<?>) key)) {
CompositeData valuedata = data.get(new Object[] { key1 });
Object value = valuedata.get("value");
- OpenType<?> type = valuedata.getCompositeType().getType(
- "value");
+ OpenType<?> type = valuedata.getCompositeType().getType("value");
if (type instanceof SimpleType<?>) {
setProperty(propertyPrefix + "." + key1, value);
} else {
@@ -651,21 +626,18 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
if (isSeparatearrayresults()) {
int size = 0;
for (int i = 0; i < Array.getLength(result); i++) {
- if (setProperty(propertyPrefix + "." + size, Array.get(
- result, i))) {
+ if (setProperty(propertyPrefix + "." + size, Array.get(result, i))) {
size++;
}
}
if (size > 0) {
- setProperty(propertyPrefix + ".Length", Integer
- .toString(size));
+ setProperty(propertyPrefix + ".Length", Integer.toString(size));
}
}
} else {
String delim = getDelimiter();
if (delim != null) {
- StringTokenizer tokenizer = new StringTokenizer(result
- .toString(), delim);
+ StringTokenizer tokenizer = new StringTokenizer(result.toString(), delim);
int size = 0;
for (; tokenizer.hasMoreTokens();) {
String token = tokenizer.nextToken();
@@ -684,7 +656,9 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
/**
* Get Property
+ *
* @param property name
+ *
* @return The property value
*/
public String getProperty(String property) {
@@ -698,7 +672,8 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask {
/**
* @param property The property
- * @param value The value
+ * @param value The value
+ *
* @return True if successful
*/
public boolean setProperty(String property, Object value) {
diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorUnregisterTask.java b/java/org/apache/catalina/ant/jmx/JMXAccessorUnregisterTask.java
index 1226d5e9a9..4ae2aee5f5 100644
--- a/java/org/apache/catalina/ant/jmx/JMXAccessorUnregisterTask.java
+++ b/java/org/apache/catalina/ant/jmx/JMXAccessorUnregisterTask.java
@@ -27,19 +27,18 @@ import org.apache.tools.ant.BuildException;
* <li>unregister Mbeans</li>
* </ul>
* <p>
- * Examples:
- * <br>
+ * Examples: <br>
* unregister an existing Mbean at jmx.server connection
* </p>
+ *
* <pre>
* <jmx:unregister
* ref="jmx.server"
* name="Catalina:type=MBeanFactory" />
* </pre>
* <p>
- * <b>WARNING</b>Not all Tomcat MBeans can successfully unregister remotely. The mbean
- * unregistration don't remove valves, realm, .. from parent class.
- * Please, use the MBeanFactory operation to remove valves and realms.
+ * <b>WARNING</b>Not all Tomcat MBeans can successfully unregister remotely. The mbean unregistration don't remove
+ * valves, realm, .. from parent class. Please, use the MBeanFactory operation to remove valves and realms.
* </p>
* <p>
* First call to a remote MBeanserver save the JMXConnection a reference <em>jmx.server</em>
@@ -47,6 +46,7 @@ import org.apache.tools.ant.BuildException;
* These tasks require Ant 1.6 or later interface.
*
* @author Peter Rossbach
+ *
* @since 5.5.12
*/
public class JMXAccessorUnregisterTask extends JMXAccessorTask {
@@ -54,13 +54,12 @@ public class JMXAccessorUnregisterTask extends JMXAccessorTask {
// ------------------------------------------------------ protected Methods
@Override
- public String jmxExecute(MBeanServerConnection jmxServerConnection)
- throws Exception {
+ public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception {
if (getName() == null) {
throw new BuildException("Must specify a 'name'");
}
- return jmxUuregister(jmxServerConnection, getName());
+ return jmxUuregister(jmxServerConnection, getName());
}
@@ -68,17 +67,18 @@ public class JMXAccessorUnregisterTask extends JMXAccessorTask {
* Unregister MBean.
*
* @param jmxServerConnection Connection to the JMX server
- * @param name The MBean name
+ * @param name The MBean name
+ *
* @return null (no error message to report other than exception)
+ *
* @throws Exception An error occurred
*/
- protected String jmxUuregister(MBeanServerConnection jmxServerConnection,String name) throws Exception {
+ protected String jmxUuregister(MBeanServerConnection jmxServerConnection, String name) throws Exception {
String error = null;
- if(isEcho()) {
- handleOutput("Unregister MBean " + name );
+ if (isEcho()) {
+ handleOutput("Unregister MBean " + name);
}
- jmxServerConnection.unregisterMBean(
- new ObjectName(name));
+ jmxServerConnection.unregisterMBean(new ObjectName(name));
return error;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org