You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/10/28 21:40:23 UTC
[09/98] [abbrv] [partial] incubator-geode git commit: Added Spotless
plugin to enforce formatting standards. Added Google Java Style guide
formatter templates, removed existing formatter templates.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryService.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryService.java
index 6bf240f..1ba6b84 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryService.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryService.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -45,36 +43,31 @@ public class RMIRegistryService implements RMIRegistryServiceMBean {
private boolean isRunning;
/**
- * Constructor to configure RMI Registry to start using default RMI Registry
- * port: {@link Registry#REGISTRY_PORT}
+ * Constructor to configure RMI Registry to start using default RMI Registry port:
+ * {@link Registry#REGISTRY_PORT}
*/
public RMIRegistryService() {
this(Registry.REGISTRY_PORT);
}
/**
- * Constructor to configure RMI Registry to start using given RMI Registry
- * port.
+ * Constructor to configure RMI Registry to start using given RMI Registry port.
*
- * @param port
- * to run RMI Registry on
+ * @param port to run RMI Registry on
*/
public RMIRegistryService(int port) {
setPort(port);
}
/**
- * Constructor to configure RMI Registry to start using given RMI Registry
- * port & host bind address.
+ * Constructor to configure RMI Registry to start using given RMI Registry port & host bind
+ * address.
*
- * @param host
- * to bind RMI Registry to
- * @param port
- * to run RMI Registry on
+ * @param host to bind RMI Registry to
+ * @param port to run RMI Registry on
*
- * @throws UnknownHostException
- * if IP Address can not be resolved for the given host string while
- * creating the RMIServerSocketFactory
+ * @throws UnknownHostException if IP Address can not be resolved for the given host string while
+ * creating the RMIServerSocketFactory
*/
public RMIRegistryService(String host, int port) throws UnknownHostException {
setPort(port);
@@ -83,7 +76,7 @@ public class RMIRegistryService implements RMIRegistryServiceMBean {
ssf = new RMIServerSocketFactoryImpl(host);
}
}
-
+
/**
* Returns the host on which rmiregistry listens for incoming connections
*
@@ -96,16 +89,15 @@ public class RMIRegistryService implements RMIRegistryServiceMBean {
/**
* Sets the host on which rmiregistry listens for incoming connections
*
- * @param host
- * the host on which rmiregistry listens for incoming connections
+ * @param host the host on which rmiregistry listens for incoming connections
*/
protected void setHost(String host) {
- if (isRunning()) {
+ if (isRunning()) {
throw new IllegalStateException("RMIRegistryService is running, cannot change the host");
}
this.host = host;
}
-
+
/**
* Returns the port on which rmiregistry listens for incoming connections
*
@@ -118,11 +110,10 @@ public class RMIRegistryService implements RMIRegistryServiceMBean {
/**
* Sets the port on which rmiregistry listens for incoming connections
*
- * @param port
- * the port on which rmiregistry listens for incoming connections
+ * @param port the port on which rmiregistry listens for incoming connections
*/
protected void setPort(int port) {
- if (isRunning()) {
+ if (isRunning()) {
throw new IllegalStateException("RMIRegistryService is running, cannot change the port");
}
this.port = port;
@@ -137,13 +128,12 @@ public class RMIRegistryService implements RMIRegistryServiceMBean {
public synchronized void start() throws RemoteException {
if (!isRunning()) {
if (ssf != null) {
- registry = LocateRegistry.createRegistry(port,
- null, //RMIClientSocketFactory
- ssf); //RMIServerSocketFactory
+ registry = LocateRegistry.createRegistry(port, null, // RMIClientSocketFactory
+ ssf); // RMIServerSocketFactory
} else {
registry = LocateRegistry.createRegistry(port);
}
-
+
isRunning = true;
}
}
@@ -195,6 +185,7 @@ public class RMIRegistryService implements RMIRegistryServiceMBean {
}
}
+
/**
* Custom implementation of the {@link RMIServerSocketFactory}
*
@@ -204,34 +195,27 @@ class RMIServerSocketFactoryImpl implements RMIServerSocketFactory {
private InetAddress bindAddress;
/**
- * Constructs a RMIServerSocketFactory. The given rmiBindAddress is used to
- * bind the ServerSockets created from this factory.
+ * Constructs a RMIServerSocketFactory. The given rmiBindAddress is used to bind the ServerSockets
+ * created from this factory.
*
- * @param rmiBindAddress
- * String representation of the address to bind the ServerSockets to
+ * @param rmiBindAddress String representation of the address to bind the ServerSockets to
*
- * @throws UnknownHostException
- * if IP Address can not be resolved for the given host string
+ * @throws UnknownHostException if IP Address can not be resolved for the given host string
*/
- /*default */RMIServerSocketFactoryImpl(String rmiBindAddress)
- throws UnknownHostException {
+ /* default */ RMIServerSocketFactoryImpl(String rmiBindAddress) throws UnknownHostException {
this.bindAddress = InetAddress.getByName(rmiBindAddress);
}
/**
- * Create a server socket on the specified port (port 0 indicates an anonymous
- * port).
+ * Create a server socket on the specified port (port 0 indicates an anonymous port).
*
- * @param port
- * the port number
+ * @param port the port number
* @return the server socket on the specified port
- * @exception IOException
- * if an I/O error occurs during server socket creation
+ * @exception IOException if an I/O error occurs during server socket creation
*/
public ServerSocket createServerSocket(int port) throws IOException {
- return new ServerSocket(port,
- 0/*backlog - for '0' internally uses the default*/,
- bindAddress);
+ return new ServerSocket(port, 0/* backlog - for '0' internally uses the default */,
+ bindAddress);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryServiceMBean.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryServiceMBean.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryServiceMBean.java
index f2ac079..9d9bfb4 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryServiceMBean.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RMIRegistryServiceMBean.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -21,11 +19,9 @@ import java.rmi.NotBoundException;
import java.rmi.RemoteException;
/**
- * This interface is similar to mx4j.tools.naming.NamingServiceMBean.
- * Features that differ are:
- * 1. This MBean interface additionally provides a way to specify the host that
- * the RMI Registry should get bound to.
- * 2. Port property can not be changed once set.
+ * This interface is similar to mx4j.tools.naming.NamingServiceMBean. Features that differ are: 1.
+ * This MBean interface additionally provides a way to specify the host that the RMI Registry should
+ * get bound to. 2. Port property can not be changed once set.
*
*/
public interface RMIRegistryServiceMBean {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RefreshNotificationType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RefreshNotificationType.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RefreshNotificationType.java
index 93513e5..14be6cb 100755
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RefreshNotificationType.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/RefreshNotificationType.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -21,110 +19,108 @@ import org.apache.commons.lang.StringUtils;
/**
* Type-safe definition for refresh notifications.
*
- * @since GemFire 3.5
+ * @since GemFire 3.5
*
*/
public class RefreshNotificationType implements java.io.Serializable {
private static final long serialVersionUID = 4376763592395613794L;
-
+
/** Notify StatisticResource to refresh statistics */
- public static final RefreshNotificationType STATISTIC_RESOURCE_STATISTICS =
- new RefreshNotificationType(
- "GemFire.Timer.StatisticResource.statistics.refresh",
- "refresh");
+ public static final RefreshNotificationType STATISTIC_RESOURCE_STATISTICS =
+ new RefreshNotificationType("GemFire.Timer.StatisticResource.statistics.refresh", "refresh");
/** Notify SystemMember to refresh config */
- public static final RefreshNotificationType SYSTEM_MEMBER_CONFIG =
- new RefreshNotificationType(
- "GemFire.Timer.SystemMember.config.refresh",
- "refresh");
+ public static final RefreshNotificationType SYSTEM_MEMBER_CONFIG =
+ new RefreshNotificationType("GemFire.Timer.SystemMember.config.refresh", "refresh");
/** Notification type for the javax.management.Notification */
private final transient String type;
-
+
/** Notification msg for the javax.management.Notification */
private final transient String msg;
-
+
// The 4 declarations below are necessary for serialization
/** int used as ordinal to represent this Scope */
public final int ordinal = nextOrdinal++;
private static int nextOrdinal = 0;
-
+
private static final RefreshNotificationType[] VALUES =
- { STATISTIC_RESOURCE_STATISTICS, SYSTEM_MEMBER_CONFIG };
+ {STATISTIC_RESOURCE_STATISTICS, SYSTEM_MEMBER_CONFIG};
private Object readResolve() throws java.io.ObjectStreamException {
- return VALUES[ordinal]; // Canonicalize
+ return VALUES[ordinal]; // Canonicalize
}
-
+
/** Creates a new instance of RefreshNotificationType. */
private RefreshNotificationType(String type, String msg) {
this.type = type;
this.msg = msg;
}
-
+
/** Return the RefreshNotificationType represented by specified ordinal */
public static RefreshNotificationType fromOrdinal(int ordinal) {
return VALUES[ordinal];
}
- public String getType() {
- return this.type;
- }
+ public String getType() {
+ return this.type;
+ }
+
+ public String getMessage() {
+ return this.msg;
+ }
- public String getMessage() {
- return this.msg;
- }
-
- /**
+ /**
* Returns a string representation for this notification type.
*
* @return the type string for this Notification
*/
@Override
public String toString() {
- return this.type;
+ return this.type;
}
- /**
- * Indicates whether some other object is "equal to" this one.
- *
- * @param other the reference object with which to compare.
- * @return true if this object is the same as the obj argument;
- * false otherwise.
- */
+ /**
+ * Indicates whether some other object is "equal to" this one.
+ *
+ * @param other the reference object with which to compare.
+ * @return true if this object is the same as the obj argument; false otherwise.
+ */
@Override
- public boolean equals(Object other) {
- if (other == this) return true;
- if (other == null) return false;
- if (!(other instanceof RefreshNotificationType)) return false;
- final RefreshNotificationType that = (RefreshNotificationType) other;
-
- if (!StringUtils.equals(this.type, that.type)) return false;
- if (!StringUtils.equals(this.msg, that.msg)) return false;
-
- return true;
- }
-
- /**
- * Returns a hash code for the object. This method is supported for the
- * benefit of hashtables such as those provided by java.util.Hashtable.
- *
- * @return the integer 0 if description is null; otherwise a unique integer.
- */
+ public boolean equals(Object other) {
+ if (other == this)
+ return true;
+ if (other == null)
+ return false;
+ if (!(other instanceof RefreshNotificationType))
+ return false;
+ final RefreshNotificationType that = (RefreshNotificationType) other;
+
+ if (!StringUtils.equals(this.type, that.type))
+ return false;
+ if (!StringUtils.equals(this.msg, that.msg))
+ return false;
+
+ return true;
+ }
+
+ /**
+ * Returns a hash code for the object. This method is supported for the benefit of hashtables such
+ * as those provided by java.util.Hashtable.
+ *
+ * @return the integer 0 if description is null; otherwise a unique integer.
+ */
@Override
- public int hashCode() {
- int result = 17;
- final int mult = 37;
-
- result = mult * result +
- (this.type == null ? 0 : this.type.hashCode());
- result = mult * result +
- (this.msg == null ? 0 : this.msg.hashCode());
-
- return result;
- }
-
+ public int hashCode() {
+ int result = 17;
+ final int mult = 37;
+
+ result = mult * result + (this.type == null ? 0 : this.type.hashCode());
+ result = mult * result + (this.msg == null ? 0 : this.msg.hashCode());
+
+ return result;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertNotification.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertNotification.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertNotification.java
index 59d7948..40ca11b 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertNotification.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertNotification.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -36,12 +34,12 @@ import org.apache.geode.internal.admin.StatAlertDefinition;
*
* @since GemFire 5.7
*/
-public class StatAlertNotification extends StatAlert implements Serializable, DataSerializable, DataSerializableFixedID {
+public class StatAlertNotification extends StatAlert
+ implements Serializable, DataSerializable, DataSerializableFixedID {
private static final long serialVersionUID = -1634729103430107871L;
private String memberId;
- public StatAlertNotification() {
- }
+ public StatAlertNotification() {}
public StatAlertNotification(StatAlert statAlert, String memberId) {
this.setDefinitionId(statAlert.getDefinitionId());
@@ -63,8 +61,7 @@ public class StatAlertNotification extends StatAlert implements Serializable, Da
/**
*
- * @param id
- * of gemfire member which raised the alert
+ * @param id of gemfire member which raised the alert
*/
public void setMemberId(String id) {
memberId = id;
@@ -85,16 +82,10 @@ public class StatAlertNotification extends StatAlert implements Serializable, Da
}
/**
- * The notification is something like this
- * "For Member ID: <ID>
- * [
- * <StatName> = <Value>
- * ..
- * ]"
- * @param defn
- * {@link StatAlertDefinition}
- * @return String representation of this object based on
- * {@link StatAlertDefinition}
+ * The notification is something like this "For Member ID: <ID> [ <StatName> = <Value> .. ]"
+ *
+ * @param defn {@link StatAlertDefinition}
+ * @return String representation of this object based on {@link StatAlertDefinition}
*/
public String toString(StatAlertDefinition defn) {
StringBuffer buf = new StringBuffer();
@@ -103,8 +94,7 @@ public class StatAlertNotification extends StatAlert implements Serializable, Da
buf.append("\n");
buf.append("[ ");
for (int i = 0; i < getValues().length; i++) {
- buf.append(defn.getStatisticInfo()[i].toString() + "=" + getValues()[i]
- + "\n");
+ buf.append(defn.getStatisticInfo()[i].toString() + "=" + getValues()[i] + "\n");
}
buf.append("]");
return getTime().toString() + ":" + buf.toString();
@@ -116,7 +106,7 @@ public class StatAlertNotification extends StatAlert implements Serializable, Da
return false;
}
- StatAlertNotification other = (StatAlertNotification)object;
+ StatAlertNotification other = (StatAlertNotification) object;
int defId = getDefinitionId();
@@ -143,13 +133,12 @@ public class StatAlertNotification extends StatAlert implements Serializable, Da
DataSerializer.writeString(this.memberId, out);
}
- public void fromData(DataInput in)
- throws IOException, ClassNotFoundException {
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
// Do not modify StatAlert to allow 57 cacheservers to function with 57+ agent
// However, update of a new StatAlertDefn on 57 server from 57+ agent not covered with this
this.setDefinitionId(DataSerializer.readPrimitiveInt(in));
this.setTime(DataSerializer.readDate(in));
- this.setValues((Number[])DataSerializer.readObjectArray(in));
+ this.setValues((Number[]) DataSerializer.readObjectArray(in));
this.memberId = DataSerializer.readString(in);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertsAggregator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertsAggregator.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertsAggregator.java
index b80b18b..106fa35 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertsAggregator.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatAlertsAggregator.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -21,14 +19,14 @@ import org.apache.geode.internal.admin.StatAlert;
import org.apache.geode.internal.admin.StatAlertDefinition;
/**
- * This interface represents an Aggregator entity and resides in JMXAgent.
- * Responsibilities are as follows:
+ * This interface represents an Aggregator entity and resides in JMXAgent. Responsibilities are as
+ * follows:
* <ol>
- * <li> set AlertsManager in the newly joined members
- * <li> create/update/remove alert
- * <li> manage refresh interval
- * <li> process notification from members
- * <li> Aggregate stats & make available for clients thro' JMXAgent
+ * <li>set AlertsManager in the newly joined members
+ * <li>create/update/remove alert
+ * <li>manage refresh interval
+ * <li>process notification from members
+ * <li>Aggregate stats & make available for clients thro' JMXAgent
* </ol>
*
*/
@@ -37,12 +35,10 @@ public interface StatAlertsAggregator {
/**
* This method can be used to get an alert definition.
*
- * @param alertDefinition
- * StatAlertDefinition to retrieve
+ * @param alertDefinition StatAlertDefinition to retrieve
* @return StatAlertDefinition
*/
- public StatAlertDefinition getAlertDefinition(
- StatAlertDefinition alertDefinition);
+ public StatAlertDefinition getAlertDefinition(StatAlertDefinition alertDefinition);
/**
* This method can be used to retrieve all available stat alert definitions.
@@ -52,43 +48,38 @@ public interface StatAlertsAggregator {
public StatAlertDefinition[] getAllStatAlertDefinitions();
/**
- * This method can be used to update alert definition for the Stat mentioned.
- * This method should update the collection maintained at the aggregator and
- * should notify members for the newly added alert definitions.
+ * This method can be used to update alert definition for the Stat mentioned. This method should
+ * update the collection maintained at the aggregator and should notify members for the newly
+ * added alert definitions.
* <p>
* A new alert definition will be created if matching one not found.
*
- * @param alertDefinition
- * alertDefinition to be updated
+ * @param alertDefinition alertDefinition to be updated
*/
public void updateAlertDefinition(StatAlertDefinition alertDefinition);
/**
* This method can be used to remove alert definition for the Stat mentioned.
* <p>
- * This method should update the collection maintained at the aggregator and
- * should notify members for the newly added alert definitions.
+ * This method should update the collection maintained at the aggregator and should notify members
+ * for the newly added alert definitions.
*
- * @param defId
- * id of the alert definition to be removed
+ * @param defId id of the alert definition to be removed
*/
public void removeAlertDefinition(Integer defId);
/**
* Convenience method to check whether an alert definition is created.
*
- * @param alert
- * alert definition to check whether already created
+ * @param alert alert definition to check whether already created
* @return true if the alert definition is already created, false otherwise
*/
public boolean isAlertDefinitionCreated(StatAlertDefinition alert);
/**
- * This method can be used to set the AlertManager for the newly joined member
- * VM.
+ * This method can be used to set the AlertManager for the newly joined member VM.
*
- * @param memberVM
- * Member VM to set AlertsManager for
+ * @param memberVM Member VM to set AlertsManager for
*/
public void setAlertsManager(GemFireVM memberVM);
@@ -100,22 +91,18 @@ public interface StatAlertsAggregator {
public int getRefreshIntervalForStatAlerts();
/**
- * This method is used to set the refresh interval for the Stats Alerts in
- * seconds
+ * This method is used to set the refresh interval for the Stats Alerts in seconds
*
- * @param refreshInterval
- * refresh interval for the Stats(in seconds)
+ * @param refreshInterval refresh interval for the Stats(in seconds)
*/
public void setRefreshIntervalForStatAlerts(int refreshInterval);
/**
- * This method can be used to process the notifications sent by the member(s).
- * Actual aggregation of stats can occur here. The array contains alert
- * objects with alert def. ID & value. AlertHelper class can be used to
- * retrieve the corresponding alert definition.
+ * This method can be used to process the notifications sent by the member(s). Actual aggregation
+ * of stats can occur here. The array contains alert objects with alert def. ID & value.
+ * AlertHelper class can be used to retrieve the corresponding alert definition.
*
- * @param alerts
- * array of Alert class(contains alert def. ID & value)
+ * @param alerts array of Alert class(contains alert def. ID & value)
* @param remoteVM
*/
public void processNotifications(StatAlert[] alerts, GemFireVM remoteVM);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticAttributeInfo.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticAttributeInfo.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticAttributeInfo.java
index 92c6091..c257ad5 100755
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticAttributeInfo.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticAttributeInfo.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -23,55 +21,50 @@ import javax.management.Descriptor;
import javax.management.modelmbean.DescriptorSupport;
import javax.management.modelmbean.ModelMBeanAttributeInfo;
-/**
- * Subclass of AttributeInfo with {@link org.apache.geode.admin.Statistic}
- * added for use as the {@link
- * javax.management.modelmbean.ModelMBeanAttributeInfo} descriptor's
- * <i>targetObject</i> value.
+/**
+ * Subclass of AttributeInfo with {@link org.apache.geode.admin.Statistic} added for use as the
+ * {@link javax.management.modelmbean.ModelMBeanAttributeInfo} descriptor's <i>targetObject</i>
+ * value.
*
- * @since GemFire 3.5
+ * @since GemFire 3.5
*
*/
class StatisticAttributeInfo extends org.apache.commons.modeler.AttributeInfo {
private static final long serialVersionUID = 28022387514935560L;
-
+
private Statistic stat;
-
+
public StatisticAttributeInfo() {
super();
}
-
+
public Statistic getStat() {
return this.stat;
}
+
public void setStat(Statistic stat) {
- //System.out.println(">> stat = " + stat);
+ // System.out.println(">> stat = " + stat);
Assert.assertTrue(stat != null, "Attempting to set stat to null");
this.stat = stat;
}
-
+
@Override
public ModelMBeanAttributeInfo createAttributeInfo() {
- Descriptor desc = new DescriptorSupport(
- new String[] {
- "name=" + this.displayName,
- "descriptorType=attribute",
- "currencyTimeLimit=-1", // always stale
- "displayName=" + this.displayName,
- "getMethod=getValue" });
+ Descriptor desc = new DescriptorSupport(new String[] {"name=" + this.displayName,
+ "descriptorType=attribute", "currencyTimeLimit=-1", // always stale
+ "displayName=" + this.displayName, "getMethod=getValue"});
Assert.assertTrue(this.stat != null, "Stat target object is null!");
desc.setField("targetObject", this.stat);
- ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(
- this.displayName, // name
- this.type, // type
+ ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(this.displayName, // name
+ this.type, // type
this.description, // description
- this.readable, // isReadable
- this.writeable, // isWritable
- this.is, // isIs
+ this.readable, // isReadable
+ this.writeable, // isWritable
+ this.is, // isIs
desc);
-
+
return info;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java
index 3e04500..4f46d5a 100755
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/StatisticResourceJmxImpl.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -36,22 +34,20 @@ import org.apache.geode.internal.logging.LogService;
/**
* Provides MBean support for the monitoring of a statistic resource.
*
- * @since GemFire 3.5
+ * @since GemFire 3.5
*
*/
-public class StatisticResourceJmxImpl
-extends org.apache.geode.admin.internal.StatisticResourceImpl
-implements javax.management.NotificationListener,
- org.apache.geode.admin.jmx.internal.ManagedResource {
+public class StatisticResourceJmxImpl extends org.apache.geode.admin.internal.StatisticResourceImpl
+ implements javax.management.NotificationListener,
+ org.apache.geode.admin.jmx.internal.ManagedResource {
private static final Logger logger = LogService.getLogger();
-
- /**
- * Interval in seconds between refreshes. Values less than one results in no
- * refreshing .
+
+ /**
+ * Interval in seconds between refreshes. Values less than one results in no refreshing .
*/
private int refreshInterval = 0;
-
+
/** The JMX object name of this managed resource */
private ObjectName objectName;
@@ -59,47 +55,45 @@ implements javax.management.NotificationListener,
private boolean timerInited = false;
// -------------------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// -------------------------------------------------------------------------
-
+
/**
* Constructor for the StatisticResource object
*
- * @param statResource the admin StatResource to manage/monitor
- * @param member the SystemMember owning this resource
- * @exception org.apache.geode.admin.AdminException
- * if unable to create this StatisticResource for administration
+ * @param statResource the admin StatResource to manage/monitor
+ * @param member the SystemMember owning this resource
+ * @exception org.apache.geode.admin.AdminException if unable to create this StatisticResource for
+ * administration
*/
- public StatisticResourceJmxImpl(StatResource statResource,
- SystemMemberJmx member)
- throws org.apache.geode.admin.AdminException {
+ public StatisticResourceJmxImpl(StatResource statResource, SystemMemberJmx member)
+ throws org.apache.geode.admin.AdminException {
super(statResource, member);
initializeMBean();
}
/** Create and register the MBean to manage this resource */
- private void initializeMBean()
- throws org.apache.geode.admin.AdminException {
- this.mbeanName = new StringBuffer("GemFire.Statistic:")
- .append("source=").append(MBeanUtil.makeCompliantMBeanNameProperty(this.member.getId()))
- .append(",type=").append(MBeanUtil.makeCompliantMBeanNameProperty(getType()))
- .append(",name=").append(MBeanUtil.makeCompliantMBeanNameProperty(getName()))
- .append(",uid=").append(getUniqueId()).toString();
-
+ private void initializeMBean() throws org.apache.geode.admin.AdminException {
+ this.mbeanName = new StringBuffer("GemFire.Statistic:").append("source=")
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(this.member.getId())).append(",type=")
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(getType())).append(",name=")
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(getName())).append(",uid=")
+ .append(getUniqueId()).toString();
+
this.objectName =
- MBeanUtil.createMBean(this,
- addDynamicAttributes(MBeanUtil.lookupManagedBean(this)));
+ MBeanUtil.createMBean(this, addDynamicAttributes(MBeanUtil.lookupManagedBean(this)));
// Refresh Interval
- AdminDistributedSystemJmxImpl sysJmx = (AdminDistributedSystemJmxImpl)this.member.getDistributedSystem();
- if (sysJmx.getRefreshInterval()>0)
+ AdminDistributedSystemJmxImpl sysJmx =
+ (AdminDistributedSystemJmxImpl) this.member.getDistributedSystem();
+ if (sysJmx.getRefreshInterval() > 0)
this.refreshInterval = sysJmx.getRefreshInterval();
}
// -------------------------------------------------------------------------
- // MBean attributes - accessors/mutators
+ // MBean attributes - accessors/mutators
// -------------------------------------------------------------------------
-
+
/**
* Gets the interval in seconds between statistics refreshes
*
@@ -110,11 +104,10 @@ implements javax.management.NotificationListener,
}
/**
- * Sets interval in seconds between statistic refreshes; zero or less turns
- * off auto refreshing. Manual refreshing has no effect on when the next
- * scheduled refresh will occur.
+ * Sets interval in seconds between statistic refreshes; zero or less turns off auto refreshing.
+ * Manual refreshing has no effect on when the next scheduled refresh will occur.
*
- * @param refreshInterval the new refresh interval in seconds
+ * @param refreshInterval the new refresh interval in seconds
*/
private void _setRefreshInterval(int refreshInterval) {
boolean isRegistered = MBeanUtil.isRefreshNotificationRegistered(this,
@@ -124,11 +117,9 @@ implements javax.management.NotificationListener,
return;
try {
- MBeanUtil.registerRefreshNotification(
- this, // NotificationListener
+ MBeanUtil.registerRefreshNotification(this, // NotificationListener
getMBeanName(), // User Data as MBean Name
- RefreshNotificationType.STATISTIC_RESOURCE_STATISTICS,
- refreshInterval); // int
+ RefreshNotificationType.STATISTIC_RESOURCE_STATISTICS, refreshInterval); // int
this.refreshInterval = refreshInterval;
timerInited = true;
@@ -151,51 +142,46 @@ implements javax.management.NotificationListener,
this.refreshInterval = 0; // zero out to avoid more exceptions
}
}
-
+
/**
- * RefreshInterval is now set only through the AdminDistributedSystem property
- * refreshInterval. Attempt to set refreshInterval on StatisticResourceJmx
- * MBean would result in an OperationNotSupportedException
- * Auto-refresh is enabled on demand when a call to getStatistics is made
+ * RefreshInterval is now set only through the AdminDistributedSystem property refreshInterval.
+ * Attempt to set refreshInterval on StatisticResourceJmx MBean would result in an
+ * OperationNotSupportedException Auto-refresh is enabled on demand when a call to getStatistics
+ * is made
*
- * @param refreshInterval
- * the new refresh interval in seconds
+ * @param refreshInterval the new refresh interval in seconds
* @deprecated since 6.0 use DistributedSystemConfig.refreshInterval instead
*/
@Deprecated
- public void setRefreshInterval(int refreshInterval)
- throws OperationNotSupportedException {
+ public void setRefreshInterval(int refreshInterval) throws OperationNotSupportedException {
throw new OperationNotSupportedException(
- LocalizedStrings.MANAGED_RESOURCE_REFRESH_INTERVAL_CANT_BE_SET_DIRECTLY.toLocalizedString());
+ LocalizedStrings.MANAGED_RESOURCE_REFRESH_INTERVAL_CANT_BE_SET_DIRECTLY
+ .toLocalizedString());
}
-
+
// -------------------------------------------------------------------------
- // JMX Notification listener
+ // JMX Notification listener
// -------------------------------------------------------------------------
/**
- * Handles notification to refresh. Reacts by refreshing the values of this
- * SystemMember's ConfigurationParamaters. Any other notification is ignored.
- * Given notification is handled only if there is any JMX client connected to
- * the system.
+ * Handles notification to refresh. Reacts by refreshing the values of this SystemMember's
+ * ConfigurationParamaters. Any other notification is ignored. Given notification is handled only
+ * if there is any JMX client connected to the system.
* <p>
* TODO: investigate use of NotificationFilter instead of explicit check...
*
- * @param notification
- * the JMX notification being received
- * @param hb
- * handback object is unused
+ * @param notification the JMX notification being received
+ * @param hb handback object is unused
*/
public void handleNotification(Notification notification, Object hb) {
- AdminDistributedSystemJmxImpl adminDSJmx =
- (AdminDistributedSystemJmxImpl) this.member.getDistributedSystem();
-
- String typeStatResourceStats =
- RefreshNotificationType.STATISTIC_RESOURCE_STATISTICS.getType();
-
- if (typeStatResourceStats.equals(notification.getType()) &&
- getMBeanName().equals(notification.getUserData()) &&
- !adminDSJmx.isRmiClientCountZero()) {
+ AdminDistributedSystemJmxImpl adminDSJmx =
+ (AdminDistributedSystemJmxImpl) this.member.getDistributedSystem();
+
+ String typeStatResourceStats = RefreshNotificationType.STATISTIC_RESOURCE_STATISTICS.getType();
+
+ if (typeStatResourceStats.equals(notification.getType())
+ && getMBeanName().equals(notification.getUserData())
+ && !adminDSJmx.isRmiClientCountZero()) {
try {
refresh();
@@ -212,12 +198,12 @@ implements javax.management.NotificationListener,
_setRefreshInterval(0); // zero out to avoid more exceptions
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
} catch (java.lang.Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -227,26 +213,27 @@ implements javax.management.NotificationListener,
}
}
}
-
+
// -------------------------------------------------------------------------
- // Create MBean attributes for each Statistic
+ // Create MBean attributes for each Statistic
// -------------------------------------------------------------------------
-
+
/**
* Add MBean attribute definitions for each Statistic.
*
- * @param managed the mbean definition to add attributes to
- * @return a new instance of ManagedBean copied from <code>managed</code> but
- * with the new attributes added
+ * @param managed the mbean definition to add attributes to
+ * @return a new instance of ManagedBean copied from <code>managed</code> but with the new
+ * attributes added
*/
- ManagedBean addDynamicAttributes(ManagedBean managed)
- throws org.apache.geode.admin.AdminException {
+ ManagedBean addDynamicAttributes(ManagedBean managed)
+ throws org.apache.geode.admin.AdminException {
if (managed == null) {
- throw new IllegalArgumentException(LocalizedStrings.StatisticResourceJmxImpl_MANAGEDBEAN_IS_NULL.toLocalizedString());
+ throw new IllegalArgumentException(
+ LocalizedStrings.StatisticResourceJmxImpl_MANAGEDBEAN_IS_NULL.toLocalizedString());
}
-
+
refresh(); // to get the stats...
-
+
// need to create a new instance of ManagedBean to clean the "slate"...
ManagedBean newManagedBean = new DynamicManagedBean(managed);
for (int i = 0; i < this.statistics.length; i++) {
@@ -262,7 +249,7 @@ implements javax.management.NotificationListener,
attrInfo.setWriteable(false);
attrInfo.setStat(this.statistics[i]);
-
+
newManagedBean.addAttribute(attrInfo);
}
return newManagedBean;
@@ -272,7 +259,7 @@ implements javax.management.NotificationListener,
if (!timerInited) {
// 1st call to getStatistics would trigger
// the auto-refresh if an interval is set
- if (this.refreshInterval>0) {
+ if (this.refreshInterval > 0) {
this._setRefreshInterval(this.refreshInterval);
}
}
@@ -280,8 +267,7 @@ implements javax.management.NotificationListener,
if (this.statistics == null) {
try {
this.refresh();
- }
- catch (AdminException e) {
+ } catch (AdminException e) {
this.statistics = new Statistic[0];
}
}
@@ -290,26 +276,27 @@ implements javax.management.NotificationListener,
}
// -------------------------------------------------------------------------
- // ManagedResource implementation
+ // ManagedResource implementation
// -------------------------------------------------------------------------
-
+
/** The name of the MBean that will manage this resource */
private String mbeanName;
/** The ModelMBean that is configured to manage this resource */
private ModelMBean modelMBean;
-
- public String getMBeanName() {
- return this.mbeanName;
- }
-
- public ModelMBean getModelMBean() {
- return this.modelMBean;
- }
- public void setModelMBean(ModelMBean modelMBean) {
- this.modelMBean = modelMBean;
- }
-
+
+ public String getMBeanName() {
+ return this.mbeanName;
+ }
+
+ public ModelMBean getModelMBean() {
+ return this.modelMBean;
+ }
+
+ public void setModelMBean(ModelMBean modelMBean) {
+ this.modelMBean = modelMBean;
+ }
+
public ObjectName getObjectName() {
return this.objectName;
}
@@ -317,38 +304,35 @@ implements javax.management.NotificationListener,
public ManagedResourceType getManagedResourceType() {
return ManagedResourceType.STATISTIC_RESOURCE;
}
-
+
public void cleanupResource() {
this.modelMBean = null;
this.member = null;
this.statistics = null;
this.statResource = null;
}
-
+
/**
- * Checks equality of the given object with <code>this</code> based on the
- * type (Class) and the MBean Name returned by <code>getMBeanName()</code>
- * methods.
+ * Checks equality of the given object with <code>this</code> based on the type (Class) and the
+ * MBean Name returned by <code>getMBeanName()</code> methods.
*
- * @param obj
- * object to check equality with
- * @return true if the given object is if the same type and its MBean Name is
- * same as <code>this</code> object's MBean Name, false otherwise
+ * @param obj object to check equality with
+ * @return true if the given object is if the same type and its MBean Name is same as
+ * <code>this</code> object's MBean Name, false otherwise
*/
@Override
public boolean equals(Object obj) {
- if ( !(obj instanceof StatisticResourceJmxImpl) ) {
+ if (!(obj instanceof StatisticResourceJmxImpl)) {
return false;
}
-
+
StatisticResourceJmxImpl other = (StatisticResourceJmxImpl) obj;
return this.getMBeanName().equals(other.getMBeanName());
}
/**
- * Returns hash code for <code>this</code> object which is based on the MBean
- * Name generated.
+ * Returns hash code for <code>this</code> object which is based on the MBean Name generated.
*
* @return hash code for <code>this</code> object
*/
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberBridgeServerJmxImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberBridgeServerJmxImpl.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberBridgeServerJmxImpl.java
index 0040cb0..6206340 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberBridgeServerJmxImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberBridgeServerJmxImpl.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -26,13 +24,12 @@ import javax.management.ObjectName;
import javax.management.modelmbean.ModelMBean;
/**
- * MBean representation of a {@link
- * org.apache.geode.admin.SystemMemberBridgeServer}.
+ * MBean representation of a {@link org.apache.geode.admin.SystemMemberBridgeServer}.
*
* @since GemFire 4.0
*/
-public class SystemMemberBridgeServerJmxImpl
- extends SystemMemberBridgeServerImpl implements ManagedResource {
+public class SystemMemberBridgeServerJmxImpl extends SystemMemberBridgeServerImpl
+ implements ManagedResource {
/** The object name of this managed resource */
private ObjectName objectName;
@@ -43,52 +40,48 @@ public class SystemMemberBridgeServerJmxImpl
/** The ModelMBean that is configured to manage this resource */
private ModelMBean modelMBean;
- ////////////////////// Constructors //////////////////////
+ ////////////////////// Constructors //////////////////////
/**
- * Creates a new <code>SystemMemberBridgeServerJmxImpl</code> that
- * serves the contents of the given cache.
+ * Creates a new <code>SystemMemberBridgeServerJmxImpl</code> that serves the contents of the
+ * given cache.
*/
- SystemMemberBridgeServerJmxImpl(SystemMemberCacheImpl cache,
- AdminBridgeServer bridgeInfo)
- throws AdminException {
+ SystemMemberBridgeServerJmxImpl(SystemMemberCacheImpl cache, AdminBridgeServer bridgeInfo)
+ throws AdminException {
super(cache, bridgeInfo);
initializeMBean(cache);
}
- ////////////////////// Instance Methods //////////////////////
+ ////////////////////// Instance Methods //////////////////////
- /**
+ /**
* Creates and registers the MBean to manage this resource
*/
- private void initializeMBean(SystemMemberCacheImpl cache)
- throws AdminException {
-
+ private void initializeMBean(SystemMemberCacheImpl cache) throws AdminException {
+
GemFireVM vm = cache.getVM();
- this.mbeanName = new StringBuffer("GemFire.Cache:")
- .append("name=")
- .append(MBeanUtil.makeCompliantMBeanNameProperty(cache.getName()))
- .append(",id=")
- .append(this.getBridgeId())
- .append(",owner=")
+ this.mbeanName = new StringBuffer("GemFire.Cache:").append("name=")
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(cache.getName())).append(",id=")
+ .append(this.getBridgeId()).append(",owner=")
.append(MBeanUtil.makeCompliantMBeanNameProperty(vm.getId().toString()))
.append(",type=CacheServer").toString();
-
+
this.objectName = MBeanUtil.createMBean(this);
}
public String getMBeanName() {
return this.mbeanName;
}
-
+
public ModelMBean getModelMBean() {
return this.modelMBean;
}
+
public void setModelMBean(ModelMBean modelMBean) {
this.modelMBean = modelMBean;
}
-
+
public ObjectName getObjectName() {
return this.objectName;
}
@@ -96,34 +89,30 @@ public class SystemMemberBridgeServerJmxImpl
public ManagedResourceType getManagedResourceType() {
return ManagedResourceType.SYSTEM_MEMBER_CACHE_SERVER;
}
-
+
public void cleanupResource() {}
-
+
/**
- * Checks equality of the given object with <code>this</code> based on the
- * type (Class) and the MBean Name returned by <code>getMBeanName()</code>
- * methods.
+ * Checks equality of the given object with <code>this</code> based on the type (Class) and the
+ * MBean Name returned by <code>getMBeanName()</code> methods.
*
- * @param obj
- * object to check equality with
- * @return true if the given object is if the same type and its MBean Name is
- * same as <code>this</code> object's MBean Name, false otherwise
+ * @param obj object to check equality with
+ * @return true if the given object is if the same type and its MBean Name is same as
+ * <code>this</code> object's MBean Name, false otherwise
*/
@Override
public boolean equals(Object obj) {
- if ( !(obj instanceof SystemMemberBridgeServerJmxImpl) ) {
+ if (!(obj instanceof SystemMemberBridgeServerJmxImpl)) {
return false;
}
-
- SystemMemberBridgeServerJmxImpl other =
- (SystemMemberBridgeServerJmxImpl) obj;
-
+
+ SystemMemberBridgeServerJmxImpl other = (SystemMemberBridgeServerJmxImpl) obj;
+
return this.getMBeanName().equals(other.getMBeanName());
}
/**
- * Returns hash code for <code>this</code> object which is based on the MBean
- * Name generated.
+ * Returns hash code for <code>this</code> object which is based on the MBean Name generated.
*
* @return hash code for <code>this</code> object
*/
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberCacheJmxImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberCacheJmxImpl.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberCacheJmxImpl.java
index b8cc255..ebce869 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberCacheJmxImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberCacheJmxImpl.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -44,78 +42,65 @@ import org.apache.geode.internal.logging.InternalLogWriter;
/**
* MBean representation of {@link org.apache.geode.admin.SystemMemberCache}.
*
- * @since GemFire 3.5
+ * @since GemFire 3.5
*/
-public class SystemMemberCacheJmxImpl
-extends org.apache.geode.admin.internal.SystemMemberCacheImpl
-implements org.apache.geode.admin.jmx.internal.ManagedResource {
+public class SystemMemberCacheJmxImpl extends org.apache.geode.admin.internal.SystemMemberCacheImpl
+ implements org.apache.geode.admin.jmx.internal.ManagedResource {
/** The object name of this managed resource */
private ObjectName objectName;
-
+
/** collection to collect all the resources created for this member */
- private Map<String, SystemMemberRegionJmxImpl> managedRegionResourcesMap = new HashMap<String, SystemMemberRegionJmxImpl>();
- private Map<Number, SystemMemberBridgeServerJmxImpl> managedCacheServerResourcesMap = new HashMap<Number, SystemMemberBridgeServerJmxImpl>();
+ private Map<String, SystemMemberRegionJmxImpl> managedRegionResourcesMap =
+ new HashMap<String, SystemMemberRegionJmxImpl>();
+ private Map<Number, SystemMemberBridgeServerJmxImpl> managedCacheServerResourcesMap =
+ new HashMap<Number, SystemMemberBridgeServerJmxImpl>();
// -------------------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// -------------------------------------------------------------------------
-
- /**
+
+ /**
* Constructs an instance of SystemMemberCacheJmxImpl.
*
- * @param vm
- * The vm owning the cache this object will manage
+ * @param vm The vm owning the cache this object will manage
*/
- public SystemMemberCacheJmxImpl(GemFireVM vm)
- throws org.apache.geode.admin.AdminException {
+ public SystemMemberCacheJmxImpl(GemFireVM vm) throws org.apache.geode.admin.AdminException {
super(vm);
initializeMBean();
}
/** Create and register the MBean to manage this resource */
- private void initializeMBean()
- throws org.apache.geode.admin.AdminException {
- this.mbeanName = new StringBuffer("GemFire.Cache:")
- .append("name=")
- .append(MBeanUtil.makeCompliantMBeanNameProperty(getName()))
- .append(",id=")
- .append(getId())
- .append(",owner=")
- .append(MBeanUtil.makeCompliantMBeanNameProperty(vm.getId().toString()))
+ private void initializeMBean() throws org.apache.geode.admin.AdminException {
+ this.mbeanName = new StringBuffer("GemFire.Cache:").append("name=")
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(getName())).append(",id=").append(getId())
+ .append(",owner=").append(MBeanUtil.makeCompliantMBeanNameProperty(vm.getId().toString()))
.append(",type=Cache").toString();
-
- this.objectName =
- MBeanUtil.createMBean(this,
- addDynamicAttributes(MBeanUtil.lookupManagedBean(this)));
+
+ this.objectName =
+ MBeanUtil.createMBean(this, addDynamicAttributes(MBeanUtil.lookupManagedBean(this)));
}
-
+
// -------------------------------------------------------------------------
- // Template methods overriden from superclass...
+ // Template methods overriden from superclass...
// -------------------------------------------------------------------------
/**
- * Override createSystemMemberRegion by instantiating
- * SystemMemberRegionJmxImpl. This instance is also added to the
- * managedResources collection.
+ * Override createSystemMemberRegion by instantiating SystemMemberRegionJmxImpl. This instance is
+ * also added to the managedResources collection.
*
- * @param r
- * reference to Region instance for which this JMX resource is to be
- * created
- * @return SystemMemberRegionJmxImpl - JMX Implementation of
- * SystemMemberRegion
- * @throws AdminException
- * if constructing SystemMemberRegionJmxImpl instance fails
+ * @param r reference to Region instance for which this JMX resource is to be created
+ * @return SystemMemberRegionJmxImpl - JMX Implementation of SystemMemberRegion
+ * @throws AdminException if constructing SystemMemberRegionJmxImpl instance fails
*/
- @Override
+ @Override
protected SystemMemberRegion createSystemMemberRegion(Region r)
- throws org.apache.geode.admin.AdminException {
+ throws org.apache.geode.admin.AdminException {
SystemMemberRegionJmxImpl managedSystemMemberRegion = null;
boolean needsRefresh = false;
synchronized (this.managedRegionResourcesMap) {
- /*
- * Ensuring that a single instance of System Member Region is created
- * per Region.
+ /*
+ * Ensuring that a single instance of System Member Region is created per Region.
*/
SystemMemberRegionJmxImpl managedResource = managedRegionResourcesMap.get(r.getFullPath());
if (managedResource != null) {
@@ -133,28 +118,24 @@ implements org.apache.geode.admin.jmx.internal.ManagedResource {
}
/**
- * Creates a SystemMemberBridgeServerJmxImpl instance. This instance is also
- * added to the managedResources collection.
+ * Creates a SystemMemberBridgeServerJmxImpl instance. This instance is also added to the
+ * managedResources collection.
*
- * @param bridge
- * reference to AdminBridgeServer for which this JMX resource is to
- * be created
- * @return SystemMemberBridgeServerJmxImpl - JMX Implementation of
- * SystemMemberBridgeServerImpl
- * @throws AdminException
- * if constructing SystemMemberBridgeServerJmxImpl instance fails
+ * @param bridge reference to AdminBridgeServer for which this JMX resource is to be created
+ * @return SystemMemberBridgeServerJmxImpl - JMX Implementation of SystemMemberBridgeServerImpl
+ * @throws AdminException if constructing SystemMemberBridgeServerJmxImpl instance fails
*/
- @Override
- protected SystemMemberBridgeServerImpl
- createSystemMemberBridgeServer(AdminBridgeServer bridge)
- throws AdminException {
+ @Override
+ protected SystemMemberBridgeServerImpl createSystemMemberBridgeServer(AdminBridgeServer bridge)
+ throws AdminException {
SystemMemberBridgeServerJmxImpl managedSystemMemberBridgeServer = null;
synchronized (this.managedCacheServerResourcesMap) {
- /*
- * Ensuring that a single instance of SystemMember BridgeServer is
- * created per AdminBridgeServer.
+ /*
+ * Ensuring that a single instance of SystemMember BridgeServer is created per
+ * AdminBridgeServer.
*/
- SystemMemberBridgeServerJmxImpl managedCacheServerResource = managedCacheServerResourcesMap.get(bridge.getId());
+ SystemMemberBridgeServerJmxImpl managedCacheServerResource =
+ managedCacheServerResourcesMap.get(bridge.getId());
if (managedCacheServerResource != null) {
managedSystemMemberBridgeServer = managedCacheServerResource;
} else {
@@ -166,24 +147,25 @@ implements org.apache.geode.admin.jmx.internal.ManagedResource {
}
// -------------------------------------------------------------------------
- // Create MBean attributes for each Statistic
+ // Create MBean attributes for each Statistic
// -------------------------------------------------------------------------
-
+
/**
* Add MBean attribute definitions for each Statistic.
*
- * @param managed the mbean definition to add attributes to
- * @return a new instance of ManagedBean copied from <code>managed</code> but
- * with the new attributes added
+ * @param managed the mbean definition to add attributes to
+ * @return a new instance of ManagedBean copied from <code>managed</code> but with the new
+ * attributes added
*/
ManagedBean addDynamicAttributes(ManagedBean managed)
- throws org.apache.geode.admin.AdminException {
+ throws org.apache.geode.admin.AdminException {
if (managed == null) {
- throw new IllegalArgumentException(LocalizedStrings.SystemMemberCacheJmxImpl_MANAGEDBEAN_IS_NULL.toLocalizedString());
+ throw new IllegalArgumentException(
+ LocalizedStrings.SystemMemberCacheJmxImpl_MANAGEDBEAN_IS_NULL.toLocalizedString());
}
-
+
refresh(); // to get the stats...
-
+
// need to create a new instance of ManagedBean to clean the "slate"...
ManagedBean newManagedBean = new DynamicManagedBean(managed);
for (int i = 0; i < this.statistics.length; i++) {
@@ -199,7 +181,7 @@ implements org.apache.geode.admin.jmx.internal.ManagedResource {
attrInfo.setWriteable(false);
attrInfo.setStat(this.statistics[i]);
-
+
newManagedBean.addAttribute(attrInfo);
}
@@ -207,17 +189,15 @@ implements org.apache.geode.admin.jmx.internal.ManagedResource {
}
// -------------------------------------------------------------------------
- // MBean Operations
+ // MBean Operations
// -------------------------------------------------------------------------
- /**
+ /**
* Returns the ObjectName of the Region for the specified path.
*
- * @throws AdminException
- * If no region with path <code>path</code> exists
+ * @throws AdminException If no region with path <code>path</code> exists
*/
- public ObjectName manageRegion(String path)
- throws AdminException, MalformedObjectNameException {
+ public ObjectName manageRegion(String path) throws AdminException, MalformedObjectNameException {
try {
SystemMemberRegionJmxImpl region = null;
@@ -230,143 +210,139 @@ implements org.apache.geode.admin.jmx.internal.ManagedResource {
}
if (region == null) {
- throw new AdminException(LocalizedStrings.SystemMemberCacheJmxImpl_THIS_CACHE_DOES_NOT_CONTAIN_REGION_0.toLocalizedString(path));
-
+ throw new AdminException(
+ LocalizedStrings.SystemMemberCacheJmxImpl_THIS_CACHE_DOES_NOT_CONTAIN_REGION_0
+ .toLocalizedString(path));
+
} else {
return ObjectName.getInstance(region.getMBeanName());
}
- } catch (RuntimeException e) {
+ } catch (RuntimeException e) {
MBeanUtil.logStackTrace(Level.WARN, e);
- throw e;
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
MBeanUtil.logStackTrace(Level.ERROR, e);
- throw e;
+ throw e;
}
}
/**
- * Creates a new cache server MBean and returns its
- * <code>ObjectName</code>.
+ * Creates a new cache server MBean and returns its <code>ObjectName</code>.
*
* @since GemFire 5.7
*/
- public ObjectName manageCacheServer()
- throws AdminException, MalformedObjectNameException {
+ public ObjectName manageCacheServer() throws AdminException, MalformedObjectNameException {
try {
- SystemMemberBridgeServerJmxImpl bridge =
- (SystemMemberBridgeServerJmxImpl) addCacheServer();
+ SystemMemberBridgeServerJmxImpl bridge = (SystemMemberBridgeServerJmxImpl) addCacheServer();
return ObjectName.getInstance(bridge.getMBeanName());
- } catch (AdminException e) {
- MBeanUtil.logStackTrace(Level.WARN, e);
- throw e;
- } catch (RuntimeException e) {
- MBeanUtil.logStackTrace(Level.WARN, e);
- throw e;
+ } catch (AdminException e) {
+ MBeanUtil.logStackTrace(Level.WARN, e);
+ throw e;
+ } catch (RuntimeException e) {
+ MBeanUtil.logStackTrace(Level.WARN, e);
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
- MBeanUtil.logStackTrace(Level.ERROR, e);
- throw e;
+ MBeanUtil.logStackTrace(Level.ERROR, e);
+ throw e;
}
}
/**
- * Returns the MBean <code>ObjectName</code>s for all cache servers
- * that serve this cache to clients.
+ * Returns the MBean <code>ObjectName</code>s for all cache servers that serve this cache to
+ * clients.
*
* @since GemFire 4.0
*/
- public ObjectName[] manageCacheServers()
- throws AdminException, MalformedObjectNameException {
+ public ObjectName[] manageCacheServers() throws AdminException, MalformedObjectNameException {
try {
SystemMemberCacheServer[] bridges = getCacheServers();
ObjectName[] names = new ObjectName[bridges.length];
for (int i = 0; i < bridges.length; i++) {
- SystemMemberBridgeServerJmxImpl bridge =
- (SystemMemberBridgeServerJmxImpl) bridges[i];
+ SystemMemberBridgeServerJmxImpl bridge = (SystemMemberBridgeServerJmxImpl) bridges[i];
names[i] = ObjectName.getInstance(bridge.getMBeanName());
}
return names;
- } catch (AdminException e) {
- MBeanUtil.logStackTrace(Level.WARN, e);
- throw e;
- } catch (RuntimeException e) {
- MBeanUtil.logStackTrace(Level.WARN, e);
- throw e;
+ } catch (AdminException e) {
+ MBeanUtil.logStackTrace(Level.WARN, e);
+ throw e;
+ } catch (RuntimeException e) {
+ MBeanUtil.logStackTrace(Level.WARN, e);
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
- MBeanUtil.logStackTrace(Level.ERROR, e);
+ MBeanUtil.logStackTrace(Level.ERROR, e);
throw e;
}
}
/**
- * Returns the MBean <code>ObjectName</code>s for all bridge servers
- * that serve this cache.
+ * Returns the MBean <code>ObjectName</code>s for all bridge servers that serve this cache.
*
* @since GemFire 4.0
* @deprecated as of 5.7
*/
@Deprecated
- public ObjectName[] manageBridgeServers()
- throws AdminException, MalformedObjectNameException {
+ public ObjectName[] manageBridgeServers() throws AdminException, MalformedObjectNameException {
return manageCacheServers();
}
// -------------------------------------------------------------------------
- // ManagedResource implementation
+ // ManagedResource implementation
// -------------------------------------------------------------------------
-
+
/** The name of the MBean that will manage this resource */
private String mbeanName;
/** The ModelMBean that is configured to manage this resource */
private ModelMBean modelMBean;
-
- public String getMBeanName() {
- return this.mbeanName;
- }
-
- public ModelMBean getModelMBean() {
- return this.modelMBean;
- }
- public void setModelMBean(ModelMBean modelMBean) {
- this.modelMBean = modelMBean;
- }
-
+
+ public String getMBeanName() {
+ return this.mbeanName;
+ }
+
+ public ModelMBean getModelMBean() {
+ return this.modelMBean;
+ }
+
+ public void setModelMBean(ModelMBean modelMBean) {
+ this.modelMBean = modelMBean;
+ }
+
public ObjectName getObjectName() {
return this.objectName;
}
@@ -375,61 +351,60 @@ implements org.apache.geode.admin.jmx.internal.ManagedResource {
return ManagedResourceType.SYSTEM_MEMBER_CACHE;
}
-
+
/**
- * Un-registers all the statistics & cache managed resource created for this
- * member. After un-registering the resource MBean instances, clears
- * this.memberResources collection.
+ * Un-registers all the statistics & cache managed resource created for this member. After
+ * un-registering the resource MBean instances, clears this.memberResources collection.
*
- * Creates ConfigurationParameterJmxImpl, StatisticResourceJmxImpl and
- * SystemMemberCacheJmxImpl. But cleans up only StatisticResourceJmxImpl and
- * SystemMemberCacheJmxImpl which are of type ManagedResource.
+ * Creates ConfigurationParameterJmxImpl, StatisticResourceJmxImpl and SystemMemberCacheJmxImpl.
+ * But cleans up only StatisticResourceJmxImpl and SystemMemberCacheJmxImpl which are of type
+ * ManagedResource.
*/
public void cleanupResource() {
synchronized (this.managedRegionResourcesMap) {
Collection<SystemMemberRegionJmxImpl> values = managedRegionResourcesMap.values();
-
+
for (SystemMemberRegionJmxImpl systemMemberRegionJmxImpl : values) {
MBeanUtil.unregisterMBean(systemMemberRegionJmxImpl);
}
-
+
this.managedRegionResourcesMap.clear();
}
-
+
synchronized (this.managedCacheServerResourcesMap) {
Collection<SystemMemberBridgeServerJmxImpl> values = managedCacheServerResourcesMap.values();
-
+
for (SystemMemberBridgeServerJmxImpl SystemMemberBridgeServerJmxImpl : values) {
MBeanUtil.unregisterMBean(SystemMemberBridgeServerJmxImpl);
}
-
+
this.managedCacheServerResourcesMap.clear();
}
}
/**
- * Cleans up managed resources created for the region that was (created and)
- * destroyed in a cache represented by this Managed Resource.
+ * Cleans up managed resources created for the region that was (created and) destroyed in a cache
+ * represented by this Managed Resource.
*
- * @param regionPath
- * path of the region that got destroyed
+ * @param regionPath path of the region that got destroyed
* @return a managed resource related to this region path
*/
public ManagedResource cleanupRegionResources(String regionPath) {
ManagedResource cleaned = null;
-
+
synchronized (this.managedRegionResourcesMap) {
Set<Entry<String, SystemMemberRegionJmxImpl>> entries = managedRegionResourcesMap.entrySet();
- for (Iterator<Entry<String, SystemMemberRegionJmxImpl>> it = entries.iterator(); it.hasNext();) {
+ for (Iterator<Entry<String, SystemMemberRegionJmxImpl>> it = entries.iterator(); it
+ .hasNext();) {
Entry<String, SystemMemberRegionJmxImpl> entry = it.next();
SystemMemberRegionJmxImpl managedResource = entry.getValue();
- ObjectName objName = managedResource.getObjectName();
-
+ ObjectName objName = managedResource.getObjectName();
+
String pathProp = objName.getKeyProperty("path");
if (pathProp != null && pathProp.equals(regionPath)) {
cleaned = managedResource;
it.remove();
-
+
break;
}
}
@@ -437,31 +412,28 @@ implements org.apache.geode.admin.jmx.internal.ManagedResource {
return cleaned;
}
-
+
/**
- * Checks equality of the given object with <code>this</code> based on the
- * type (Class) and the MBean Name returned by <code>getMBeanName()</code>
- * methods.
+ * Checks equality of the given object with <code>this</code> based on the type (Class) and the
+ * MBean Name returned by <code>getMBeanName()</code> methods.
*
- * @param obj
- * object to check equality with
- * @return true if the given object is if the same type and its MBean Name is
- * same as <code>this</code> object's MBean Name, false otherwise
+ * @param obj object to check equality with
+ * @return true if the given object is if the same type and its MBean Name is same as
+ * <code>this</code> object's MBean Name, false otherwise
*/
@Override
public boolean equals(Object obj) {
- if ( !(obj instanceof SystemMemberCacheJmxImpl) ) {
+ if (!(obj instanceof SystemMemberCacheJmxImpl)) {
return false;
}
-
+
SystemMemberCacheJmxImpl other = (SystemMemberCacheJmxImpl) obj;
return this.getMBeanName().equals(other.getMBeanName());
}
-
+
/**
- * Returns hash code for <code>this</code> object which is based on the MBean
- * Name generated.
+ * Returns hash code for <code>this</code> object which is based on the MBean Name generated.
*
* @return hash code for <code>this</code> object
*/