You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by mb...@apache.org on 2016/10/21 20:30:47 UTC
[08/51] [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/SystemMemberJmx.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmx.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmx.java
index dd52a4e..06b0be9 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmx.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmx.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;
@@ -32,46 +30,42 @@ import javax.naming.OperationNotSupportedException;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * Defines methods that all <code>SystemMember</code> MBeans should
- * implement.
+ * Defines methods that all <code>SystemMember</code> MBeans should implement.
*
* @since GemFire 4.0
*/
-public interface SystemMemberJmx
- extends SystemMember, NotificationListener {
- /**
- * Notification type for indicating a cache got created on a member of this
- * distributed system.
+public interface SystemMemberJmx extends SystemMember, NotificationListener {
+ /**
+ * Notification type for indicating a cache got created on a member of this distributed system.
*/
public static final String NOTIF_CACHE_CREATED =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.cache.created";
- /**
- * Notification type for indicating a cache is closed on a member of this
- * distributed system.
+ /**
+ * Notification type for indicating a cache is closed on a member of this distributed system.
*/
public static final String NOTIF_CACHE_CLOSED =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.cache.closed";
- /**
- * Notification type for indicating a region is created in a cache on a member
- * of this distributed system.
+ /**
+ * Notification type for indicating a region is created in a cache on a member of this distributed
+ * system.
*/
public static final String NOTIF_REGION_CREATED =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.cache.region.created";
- /**
- * Notification type for indicating a region was removed from a cache on a
- * member of this distributed system.
+ /**
+ * Notification type for indicating a region was removed from a cache on a member of this
+ * distributed system.
*/
public static final String NOTIF_REGION_LOST =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.cache.region.lost";
-
+
/** Notification type for indicating client joined */
public static final String NOTIF_CLIENT_JOINED =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.cache.client.joined";
-
+
/** Notification type for indicating client left */
public static final String NOTIF_CLIENT_LEFT =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.cache.client.left";
-
+
/** Notification type for indicating client crashed */
public static final String NOTIF_CLIENT_CRASHED =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.cache.client.crashed";
@@ -84,61 +78,54 @@ public interface SystemMemberJmx
public int getRefreshInterval();
/**
- * RefreshInterval is now set only through the AdminDistributedSystem property
- * refreshInterval. Attempt to set refreshInterval on SystemMemberJmx MBean
- * would result in an OperationNotSupportedException Auto-refresh is enabled
- * on demand when a call to refreshConfig is made
+ * RefreshInterval is now set only through the AdminDistributedSystem property refreshInterval.
+ * Attempt to set refreshInterval on SystemMemberJmx MBean would result in an
+ * OperationNotSupportedException Auto-refresh is enabled on demand when a call to refreshConfig
+ * 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;
/**
- * Sets the refresh interval field.
- * Sets interval in seconds between config refreshes; zero or less turns
- * off auto refreshing. Manual refreshing has no effect on when the next
- * scheduled refresh will occur.
+ * Sets the refresh interval field. Sets interval in seconds between config refreshes; zero or
+ * less turns off auto refreshing. Manual refreshing has no effect on when the next scheduled
+ * refresh will occur.
*/
public void _setRefreshInterval(int refreshInterval);
- /**
+ /**
* Gets this member's cache.
*
* @return <code>ObjectName</code> for this member's cache
*
- * @throws AdminException
- * If this system member does not host a cache
+ * @throws AdminException If this system member does not host a cache
*/
- public ObjectName manageCache()
- throws AdminException, MalformedObjectNameException;
+ public ObjectName manageCache() throws AdminException, MalformedObjectNameException;
- /**
+ /**
* Gets all active StatisticResources for this manager.
*
* @return array of ObjectName instances
*/
- public ObjectName[] manageStats()
- throws AdminException, MalformedObjectNameException;
+ public ObjectName[] manageStats() throws AdminException, MalformedObjectNameException;
- /**
- * Gets the active StatisticResources for this manager, based on the
- * typeName as the key
+ /**
+ * Gets the active StatisticResources for this manager, based on the typeName as the key
*
* @return ObjectName of StatisticResourceJMX instance
*/
- public ObjectName[] manageStat(String statisticsTypeName)
- throws AdminException, MalformedObjectNameException;
+ public ObjectName[] manageStat(String statisticsTypeName)
+ throws AdminException, MalformedObjectNameException;
/**
- * Handles notification to refresh. Reacts by refreshing the values of this
- * GemFireManager's ConfigurationParamaters. Any other notification is
- * ignored.
+ * Handles notification to refresh. Reacts by refreshing the values of this GemFireManager's
+ * ConfigurationParamaters. Any other notification is ignored.
*
- * @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);
@@ -146,83 +133,71 @@ public interface SystemMemberJmx
* Add MBean attribute definitions for each ConfigurationParameter.
*
* @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
+ * @return a new instance of ManagedBean copied from <code>managed</code> but with the new
+ * attributes added
*/
- public ManagedBean addDynamicAttributes(ManagedBean managed)
- throws AdminException;
+ public ManagedBean addDynamicAttributes(ManagedBean managed) throws AdminException;
/**
- * Implementation should handle creation of cache by extracting the details
- * from the given event object.
+ * Implementation should handle creation of cache by extracting the details from the given event
+ * object.
*
- * @param event
- * event object corresponding to the creation of the cache
+ * @param event event object corresponding to the creation of the cache
*/
public void handleCacheCreate(SystemMemberCacheEvent event);
/**
- * Implementation should handle closure of cache by extracting the details
- * from the given event object.
+ * Implementation should handle closure of cache by extracting the details from the given event
+ * object.
*
- * @param event
- * event object corresponding to the closure of the cache
+ * @param event event object corresponding to the closure of the cache
*/
public void handleCacheClose(SystemMemberCacheEvent event);
/**
- * Implementation should handle creation of region by extracting the details
- * from the given event object.
+ * Implementation should handle creation of region by extracting the details from the given event
+ * object.
*
- * @param event
- * event object corresponding to the creation of a region
+ * @param event event object corresponding to the creation of a region
*/
public void handleRegionCreate(SystemMemberRegionEvent event);
/**
- * Implementation should handle loss of region by extracting the details
- * from the given event object.
+ * Implementation should handle loss of region by extracting the details from the given event
+ * object.
*
- * @param event
- * event object corresponding to the loss of a region
+ * @param event event object corresponding to the loss of a region
*/
public void handleRegionLoss(SystemMemberRegionEvent event);
/**
* Implementation should handle client membership changes.
*
- * @param clientId
- * id of the client for whom membership change happened
- * @param eventType
- * membership change type; one of
- * {@link ClientMembershipMessage#JOINED},
- * {@link ClientMembershipMessage#LEFT},
- * {@link ClientMembershipMessage#CRASHED}
+ * @param clientId id of the client for whom membership change happened
+ * @param eventType membership change type; one of {@link ClientMembershipMessage#JOINED},
+ * {@link ClientMembershipMessage#LEFT}, {@link ClientMembershipMessage#CRASHED}
*/
public void handleClientMembership(String clientId, int eventType);
- ////////////////////// Inner Classess //////////////////////
+ ////////////////////// Inner Classess //////////////////////
/**
- * A helper class that provides implementation of the
- * <code>SystemMemberJmx</code> interface as static methods.
+ * A helper class that provides implementation of the <code>SystemMemberJmx</code> interface as
+ * static methods.
*/
public static class Helper {
private static final Logger logger = LogService.getLogger();
-
+
private static AtomicInteger notificationSequenceNumber = new AtomicInteger();
- public static int setAndReturnRefreshInterval(SystemMemberJmx member,
- int refreshInterval) {
+ public static int setAndReturnRefreshInterval(SystemMemberJmx member, int refreshInterval) {
int ret = refreshInterval;
-
+
try {
- MBeanUtil.registerRefreshNotification(
- member, // NotificationListener
- ((ManagedResource)member).getMBeanName(), // User Data
- RefreshNotificationType.SYSTEM_MEMBER_CONFIG,
- refreshInterval); // int
+ MBeanUtil.registerRefreshNotification(member, // NotificationListener
+ ((ManagedResource) member).getMBeanName(), // User Data
+ RefreshNotificationType.SYSTEM_MEMBER_CONFIG, refreshInterval); // int
} catch (RuntimeException e) {
logger.warn(e.getMessage(), e); // dead in water, print, and then ignore
@@ -230,12 +205,12 @@ public interface SystemMemberJmx
} 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) {
// 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:
@@ -243,116 +218,113 @@ public interface SystemMemberJmx
logger.error(e.getMessage(), e); // dead in water, print, and then ignore
ret = 0; // zero out to avoid more exceptions
}
-
+
return ret;
}
- public static ObjectName manageCache(SystemMemberJmx member)
- throws AdminException, MalformedObjectNameException {
+ public static ObjectName manageCache(SystemMemberJmx member)
+ throws AdminException, MalformedObjectNameException {
boolean IthrewIt = false;
try {
SystemMemberCache cache = member.getCache();
if (cache == null) {
IthrewIt = true;
- throw new AdminException(LocalizedStrings.SystemMemberJmx_THIS_SYSTEM_MEMBER_DOES_NOT_HAVE_A_CACHE.toLocalizedString());
+ throw new AdminException(
+ LocalizedStrings.SystemMemberJmx_THIS_SYSTEM_MEMBER_DOES_NOT_HAVE_A_CACHE
+ .toLocalizedString());
}
-// Assert.assertTrue(cache != null); (cannot be null)
+ // Assert.assertTrue(cache != null); (cannot be null)
SystemMemberCacheJmxImpl cacheJmx = (SystemMemberCacheJmxImpl) cache;
return ObjectName.getInstance(cacheJmx.getMBeanName());
- } catch (AdminException e) {
+ } catch (AdminException e) {
if (!IthrewIt) {
- logger.warn(e.getMessage(), e);
+ logger.warn(e.getMessage(), e);
}
- throw e;
- } catch (RuntimeException e) {
+ throw e;
+ } catch (RuntimeException e) {
logger.warn(e.getMessage(), 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();
- logger.error(e.getMessage(), e);
- throw e;
+ logger.error(e.getMessage(), e);
+ throw e;
}
}
- public static ObjectName[] manageStats(SystemMemberJmx member)
- throws AdminException, MalformedObjectNameException {
- try {
- StatisticResource[] stats = member.getStats();
- ObjectName[] onames = new ObjectName[stats.length];
- for (int i = 0; i < stats.length; i++) {
- StatisticResourceJmxImpl stat =
- (StatisticResourceJmxImpl) stats[i];
- onames[i] = ObjectName.getInstance(stat.getMBeanName());
- }
- return onames;
- } catch (AdminException e) {
- logger.warn(e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
- logger.warn(e.getMessage(), e);
- throw e;
- } catch (VirtualMachineError err) {
- SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
- // now, so don't let this thread continue.
- throw err;
- } catch (Error e) {
- // Whenever you catch Error or Throwable, you must also
- // 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();
- logger.error(e.getMessage(), e);
- throw e;
+ public static ObjectName[] manageStats(SystemMemberJmx member)
+ throws AdminException, MalformedObjectNameException {
+ try {
+ StatisticResource[] stats = member.getStats();
+ ObjectName[] onames = new ObjectName[stats.length];
+ for (int i = 0; i < stats.length; i++) {
+ StatisticResourceJmxImpl stat = (StatisticResourceJmxImpl) stats[i];
+ onames[i] = ObjectName.getInstance(stat.getMBeanName());
}
+ return onames;
+ } catch (AdminException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
+ } catch (RuntimeException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
+ } catch (VirtualMachineError err) {
+ SystemFailure.initiateFailure(err);
+ // If this ever returns, rethrow the error. We're poisoned
+ // now, so don't let this thread continue.
+ throw err;
+ } catch (Error e) {
+ // Whenever you catch Error or Throwable, you must also
+ // 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();
+ logger.error(e.getMessage(), e);
+ throw e;
}
+ }
- public static ObjectName[] manageStat(SystemMemberJmx member, String statisticsTypeName)
- throws AdminException, MalformedObjectNameException {
+ public static ObjectName[] manageStat(SystemMemberJmx member, String statisticsTypeName)
+ throws AdminException, MalformedObjectNameException {
try {
StatisticResource[] stats = member.getStat(statisticsTypeName);
- if (stats==null)
+ if (stats == null)
return null;
else {
- ObjectName[] statNames = new ObjectName[stats.length];
- for (int i=0; i<stats.length; i++) {
+ ObjectName[] statNames = new ObjectName[stats.length];
+ for (int i = 0; i < stats.length; i++) {
StatisticResourceJmxImpl statJMX = (StatisticResourceJmxImpl) stats[i];
- statNames[i] = ObjectName.getInstance(statJMX.getMBeanName());
+ statNames[i] = ObjectName.getInstance(statJMX.getMBeanName());
}
return statNames;
}
- } catch (AdminException e) {
- logger.warn(e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
- logger.warn(e.getMessage(), e);
+ } catch (AdminException e) {
+ logger.warn(e.getMessage(), e);
throw e;
- } catch (Error e) {
- logger.error(e.getMessage(), e);
+ } catch (RuntimeException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
+ } catch (Error e) {
+ logger.error(e.getMessage(), e);
throw e;
}
}
- public static void handleNotification(SystemMemberJmx member,
- Notification notification,
- Object hb) {
- if (RefreshNotificationType.SYSTEM_MEMBER_CONFIG.
- getType().equals(notification.getType()) &&
- ((ManagedResource)member).getMBeanName().
- equals(notification.getUserData())
- ) {
-
+ public static void handleNotification(SystemMemberJmx member, Notification notification,
+ Object hb) {
+ if (RefreshNotificationType.SYSTEM_MEMBER_CONFIG.getType().equals(notification.getType())
+ && ((ManagedResource) member).getMBeanName().equals(notification.getUserData())) {
+
try {
member.refreshConfig();
@@ -369,12 +341,12 @@ public interface SystemMemberJmx
} 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:
@@ -385,33 +357,32 @@ public interface SystemMemberJmx
}
}
- public static ManagedBean
- addDynamicAttributes(SystemMemberJmx member, ManagedBean managed)
- throws AdminException {
+ public static ManagedBean addDynamicAttributes(SystemMemberJmx member, ManagedBean managed)
+ throws AdminException {
if (managed == null) {
- throw new IllegalArgumentException(LocalizedStrings.SystemMemberJmx_MANAGEDBEAN_IS_NULL.toLocalizedString());
+ throw new IllegalArgumentException(
+ LocalizedStrings.SystemMemberJmx_MANAGEDBEAN_IS_NULL.toLocalizedString());
}
-
+
member.refreshConfig(); // to get the config parms...
-
+
// need to create a new instance of ManagedBean to clean the "slate"...
ManagedBean newManagedBean = new DynamicManagedBean(managed);
ConfigurationParameter[] params = member.getConfiguration();
for (int i = 0; i < params.length; i++) {
- ConfigurationParameterJmxImpl parm =
- (ConfigurationParameterJmxImpl) params[i];
+ ConfigurationParameterJmxImpl parm = (ConfigurationParameterJmxImpl) params[i];
ConfigAttributeInfo attrInfo = new ConfigAttributeInfo(parm);
attrInfo.setName(parm.getName());
attrInfo.setDisplayName(parm.getName());
attrInfo.setDescription(parm.getDescription());
attrInfo.setType(parm.getJmxValueType().getName());
-
+
attrInfo.setIs(false);
attrInfo.setReadable(true);
attrInfo.setWriteable(parm.isModifiable());
-
+
newManagedBean.addAttribute(attrInfo);
}
return newManagedBean;
@@ -422,53 +393,45 @@ public interface SystemMemberJmx
*
* @return the notificationSequenceNumber
*/
- /*default*/static int getNextNotificationSequenceNumber() {
+ /* default */static int getNextNotificationSequenceNumber() {
return notificationSequenceNumber.incrementAndGet();
}
-
+
/**
- * Returns the cache event details extracted from the given
- * SystemMemberCacheEvent
+ * Returns the cache event details extracted from the given SystemMemberCacheEvent
*
- * @param event
- * SystemMemberCacheEvent instance
- * @return the cache event details extracted from the given
- * SystemMemberCacheEvent
+ * @param event SystemMemberCacheEvent instance
+ * @return the cache event details extracted from the given SystemMemberCacheEvent
*/
- /*default*/static String getCacheEventDetails(SystemMemberCacheEvent event) {
- String memberId = event.getMemberId();
+ /* default */static String getCacheEventDetails(SystemMemberCacheEvent event) {
+ String memberId = event.getMemberId();
Operation operation = event.getOperation();
-
- return "CacheEvent[MemberId: "+memberId+", operation: "+operation+"]";
+
+ return "CacheEvent[MemberId: " + memberId + ", operation: " + operation + "]";
}
-
+
/**
- * Returns the region event details extracted from the given
- * SystemMemberRegionEvent
+ * Returns the region event details extracted from the given SystemMemberRegionEvent
*
- * @param event
- * SystemMemberRegionEvent instance
- * @return the cache event details extracted from the given
- * SystemMemberRegionEvent
- */
- /*default*/static String getRegionEventDetails(SystemMemberRegionEvent event) {
- String memberId = event.getMemberId();
+ * @param event SystemMemberRegionEvent instance
+ * @return the cache event details extracted from the given SystemMemberRegionEvent
+ */
+ /* default */static String getRegionEventDetails(SystemMemberRegionEvent event) {
+ String memberId = event.getMemberId();
Operation operation = event.getOperation();
-
- return "RegionEvent[MemberId: " + memberId + ", operation: " + operation
- + ", region:" + event.getRegionPath() + "]";
+
+ return "RegionEvent[MemberId: " + memberId + ", operation: " + operation + ", region:"
+ + event.getRegionPath() + "]";
}
/**
* Sends the given notification.
*
- * @param notif
- * notification to send
+ * @param notif notification to send
*
- * @throws NullPointerException
- * if resource or ModelMBean for resource is null
+ * @throws NullPointerException if resource or ModelMBean for resource is null
*/
- /*default*/static void sendNotification(ManagedResource resource, Notification notif) {
+ /* default */static void sendNotification(ManagedResource resource, Notification notif) {
try {
if (MBeanUtil.isRegistered(resource.getObjectName())) {
resource.getModelMBean().sendNotification(notif);
@@ -477,17 +440,19 @@ public interface SystemMemberJmx
}
}
} catch (RuntimeOperationsException e) {
- logger.info(LocalizedMessage.create(
- LocalizedStrings.SystemMemberJmx_FAILED_TO_SEND_0_NOTIFICATION_FOR_1,
- new Object[] { "'" + notif.getType() + "'",
- "'" + notif.getMessage() + "'" }),
- e);
+ logger
+ .info(
+ LocalizedMessage.create(
+ LocalizedStrings.SystemMemberJmx_FAILED_TO_SEND_0_NOTIFICATION_FOR_1,
+ new Object[] {"'" + notif.getType() + "'", "'" + notif.getMessage() + "'"}),
+ e);
} catch (MBeanException e) {
- logger.info(LocalizedMessage.create(
- LocalizedStrings.SystemMemberJmx_FAILED_TO_SEND_0_NOTIFICATION_FOR_1,
- new Object[] { "'" + notif.getType() + "'",
- "'" + notif.getMessage() + "'" }),
- e);
+ logger
+ .info(
+ LocalizedMessage.create(
+ LocalizedStrings.SystemMemberJmx_FAILED_TO_SEND_0_NOTIFICATION_FOR_1,
+ new Object[] {"'" + notif.getType() + "'", "'" + notif.getMessage() + "'"}),
+ e);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmxImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmxImpl.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmxImpl.java
index 2f5fca9..0241302 100755
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmxImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberJmxImpl.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;
@@ -53,66 +51,59 @@ import org.apache.geode.internal.logging.LogService;
/**
* Provides MBean support for managing a SystemMember application.
* <p>
- * TODO: refactor to implement SystemMember and delegate to SystemMemberImpl.
- * Wrap all delegate calls w/ e.printStackTrace() since the HttpAdaptor devours
- * them
+ * TODO: refactor to implement SystemMember and delegate to SystemMemberImpl. Wrap all delegate
+ * calls w/ e.printStackTrace() since the HttpAdaptor devours them
*
- * @since GemFire 3.5
+ * @since GemFire 3.5
*
*/
-public class SystemMemberJmxImpl
-extends org.apache.geode.admin.internal.SystemMemberImpl
-implements SystemMemberJmx, javax.management.NotificationListener,
- org.apache.geode.admin.jmx.internal.ManagedResource {
+public class SystemMemberJmxImpl extends org.apache.geode.admin.internal.SystemMemberImpl
+ implements SystemMemberJmx, javax.management.NotificationListener,
+ org.apache.geode.admin.jmx.internal.ManagedResource {
private static final Logger logger = LogService.getLogger();
-
- /**
- * Interval in seconds between refreshes. Value less than one results in no
- * refreshing
+
+ /**
+ * Interval in seconds between refreshes. Value less than one results in no refreshing
*/
private int refreshInterval = 0;
-
+
/** The JMX object name of this managed resource */
private ObjectName objectName;
/** Reference to the cache MBean representing a Cache in the Cache VM Member */
private SystemMemberCacheJmxImpl managedSystemMemberCache;
-
+
/** collection to collect all the resources created for this member */
- private Map<StatResource, StatisticResourceJmxImpl> managedStatisticsResourcesMap = new HashMap<StatResource, StatisticResourceJmxImpl>();
+ private Map<StatResource, StatisticResourceJmxImpl> managedStatisticsResourcesMap =
+ new HashMap<StatResource, StatisticResourceJmxImpl>();
// -------------------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// -------------------------------------------------------------------------
-
- /**
+
+ /**
* Constructs an instance of SystemMemberJmxImpl.
*
- * @param system the distributed system this SystemMember is a member of
+ * @param system the distributed system this SystemMember is a member of
* @param application the internal admin application to delegate actual work
*/
- public SystemMemberJmxImpl(AdminDistributedSystemJmxImpl system,
- ApplicationVM application)
- throws org.apache.geode.admin.AdminException {
+ public SystemMemberJmxImpl(AdminDistributedSystemJmxImpl system, ApplicationVM application)
+ throws org.apache.geode.admin.AdminException {
super(system, application);
initializeMBean();
}
-
+
/**
- * Constructs the instance of SystemMember using the corresponding
- * InternalDistributedMember instance of a DS member for the given
- * AdminDistributedSystem.
+ * Constructs the instance of SystemMember using the corresponding InternalDistributedMember
+ * instance of a DS member for the given AdminDistributedSystem.
+ *
+ * @param system Current AdminDistributedSystem instance
+ * @param member InternalDistributedMember instance for which a SystemMember instance is to be
+ * constructed.
+ * @throws AdminException if construction of SystemMember fails
*
- * @param system
- * Current AdminDistributedSystem instance
- * @param member
- * InternalDistributedMember instance for which a SystemMember
- * instance is to be constructed.
- * @throws AdminException
- * if construction of SystemMember fails
- *
* @since GemFire 6.5
*/
protected SystemMemberJmxImpl(AdminDistributedSystemJmxImpl system,
@@ -122,27 +113,25 @@ implements SystemMemberJmx, javax.management.NotificationListener,
}
/** Create and register the MBean to manage this resource */
- private void initializeMBean()
- throws org.apache.geode.admin.AdminException {
- //initialize Managed Resources for stats & cache first.
-// initializeManagedResources();
+ private void initializeMBean() throws org.apache.geode.admin.AdminException {
+ // initialize Managed Resources for stats & cache first.
+ // initializeManagedResources();
this.mbeanName = new StringBuffer("GemFire.Member:id=")
- .append(MBeanUtil.makeCompliantMBeanNameProperty(getId()))
- .append(",type=").append(MBeanUtil.makeCompliantMBeanNameProperty(getType().getName())).toString();
-
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(getId())).append(",type=")
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(getType().getName())).toString();
+
this.objectName =
- MBeanUtil.createMBean(this,
- addDynamicAttributes(MBeanUtil.lookupManagedBean(this)));
+ MBeanUtil.createMBean(this, addDynamicAttributes(MBeanUtil.lookupManagedBean(this)));
// Refresh Interval
- AdminDistributedSystemJmxImpl sysJmx = (AdminDistributedSystemJmxImpl)system;
+ AdminDistributedSystemJmxImpl sysJmx = (AdminDistributedSystemJmxImpl) system;
if (sysJmx.getRefreshInterval() > 0)
this.refreshInterval = sysJmx.getRefreshInterval();
}
-
+
// -------------------------------------------------------------------------
- // MBean attributes - accessors/mutators
+ // MBean attributes - accessors/mutators
// -------------------------------------------------------------------------
/**
@@ -153,31 +142,28 @@ implements SystemMemberJmx, javax.management.NotificationListener,
public int getRefreshInterval() {
return this.refreshInterval;
}
-
+
/**
- * RefreshInterval is now set only through the AdminDistributedSystem property
- * refreshInterval. Attempt to set refreshInterval on SystemMemberJmx MBean
- * would result in an OperationNotSupportedException Auto-refresh is enabled
- * on demand when a call to refreshConfig is made
+ * RefreshInterval is now set only through the AdminDistributedSystem property refreshInterval.
+ * Attempt to set refreshInterval on SystemMemberJmx MBean would result in an
+ * OperationNotSupportedException Auto-refresh is enabled on demand when a call to refreshConfig
+ * 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());
}
/**
- * Sets interval in seconds between member config 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 member config 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
*/
public void _setRefreshInterval(int refreshInterval) {
boolean isRegistered = MBeanUtil.isRefreshNotificationRegistered(this,
@@ -186,12 +172,11 @@ implements SystemMemberJmx, javax.management.NotificationListener,
if (isRegistered && (getRefreshInterval() == refreshInterval))
return;
- this.refreshInterval = Helper.setAndReturnRefreshInterval(this,
- refreshInterval);
+ this.refreshInterval = Helper.setAndReturnRefreshInterval(this, refreshInterval);
}
-
+
// -------------------------------------------------------------------------
- // MBean Operations
+ // MBean Operations
// -------------------------------------------------------------------------
public void refreshConfig() throws org.apache.geode.admin.AdminException {
@@ -203,141 +188,129 @@ implements SystemMemberJmx, javax.management.NotificationListener,
super.refreshConfig();
}
-
+
/**
* Initializes Cache & Statistics managed resources.
*
- * @throws AdminException
- * if initialization of managed resources fails
+ * @throws AdminException if initialization of managed resources fails
*/
-// private void initializeManagedResources() throws AdminException {
-// try {
-// manageCache();
-// } catch (MalformedObjectNameException e) {
-// throw new AdminException(LocalizedStrings.SystemMemberJmxImpl_EXCEPTION_OCCURRED_WHILE_INITIALIZING_0_MBEANS_FOR_1.toLocalizedString(
-// new Object[] {"Cache", getId()}),
-// e);
-// } catch (AdminException ae) {
-// if (LocalizedStrings.SystemMemberJmx_THIS_SYSTEM_MEMBER_DOES_NOT_HAVE_A_CACHE.toLocalizedString().equals(ae.getMessage())) {
-// //ignore this exception for a cache-less peer
-// } else {
-// throw ae;
-// }
-// }
-// try {
-// manageStats();
-// } catch (MalformedObjectNameException e) {
-// throw new AdminException(LocalizedStrings.SystemMemberJmxImpl_EXCEPTION_OCCURRED_WHILE_INITIALIZING_0_MBEANS_FOR_1.toLocalizedString(
-// new Object[] {"Statistics", getId()}),
-// e);
-// }
-// }
-
- /**
+ // private void initializeManagedResources() throws AdminException {
+ // try {
+ // manageCache();
+ // } catch (MalformedObjectNameException e) {
+ // throw new
+ // AdminException(LocalizedStrings.SystemMemberJmxImpl_EXCEPTION_OCCURRED_WHILE_INITIALIZING_0_MBEANS_FOR_1.toLocalizedString(
+ // new Object[] {"Cache", getId()}),
+ // e);
+ // } catch (AdminException ae) {
+ // if
+ // (LocalizedStrings.SystemMemberJmx_THIS_SYSTEM_MEMBER_DOES_NOT_HAVE_A_CACHE.toLocalizedString().equals(ae.getMessage()))
+ // {
+ // //ignore this exception for a cache-less peer
+ // } else {
+ // throw ae;
+ // }
+ // }
+ // try {
+ // manageStats();
+ // } catch (MalformedObjectNameException e) {
+ // throw new
+ // AdminException(LocalizedStrings.SystemMemberJmxImpl_EXCEPTION_OCCURRED_WHILE_INITIALIZING_0_MBEANS_FOR_1.toLocalizedString(
+ // new Object[] {"Statistics", getId()}),
+ // e);
+ // }
+ // }
+
+ /**
* Gets this member's cache.
*
* @return <code>ObjectName</code> for this member's cache
*
- * @throws AdminException
- * If this system member does not host a cache
+ * @throws AdminException If this system member does not host a cache
*/
- public ObjectName manageCache()
- throws AdminException, MalformedObjectNameException {
+ public ObjectName manageCache() throws AdminException, MalformedObjectNameException {
return Helper.manageCache(this);
}
-
- /**
+
+ /**
* Gets all active StatisticResources for this manager.
*
* @return array of ObjectName instances
*/
- public ObjectName[] manageStats()
- throws AdminException, MalformedObjectNameException {
+ public ObjectName[] manageStats() throws AdminException, MalformedObjectNameException {
return Helper.manageStats(this);
}
-
- /**
- * Gets the active StatisticResources for this manager, based on the
- * typeName as the key
+
+ /**
+ * Gets the active StatisticResources for this manager, based on the typeName as the key
*
* @return ObjectName of StatisticResourceJMX instance
*/
- public ObjectName[] manageStat(String statisticsTypeName)
- throws AdminException, MalformedObjectNameException {
-
+ public ObjectName[] manageStat(String statisticsTypeName)
+ throws AdminException, MalformedObjectNameException {
+
return Helper.manageStat(this, statisticsTypeName);
}
-
+
// -------------------------------------------------------------------------
- // 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.
*
- * @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 systemJmx =
- (AdminDistributedSystemJmxImpl) this.system;
-
+ AdminDistributedSystemJmxImpl systemJmx = (AdminDistributedSystemJmxImpl) this.system;
+
if (!systemJmx.isRmiClientCountZero()) {
Helper.handleNotification(this, notification, hb);
}
}
// -------------------------------------------------------------------------
- // Template methods overriden from superclass...
+ // Template methods overriden from superclass...
// -------------------------------------------------------------------------
/**
- * Template method for creating instance of ConfigurationParameter.
- * Overridden to return ConfigurationParameterJmxImpl.
+ * Template method for creating instance of ConfigurationParameter. Overridden to return
+ * ConfigurationParameterJmxImpl.
*/
@Override
- protected ConfigurationParameter createConfigurationParameter(String name,
- String description,
- Object value,
- Class type,
- boolean userModifiable) {
- return new ConfigurationParameterJmxImpl(
- name, description, value, type, userModifiable);
+ protected ConfigurationParameter createConfigurationParameter(String name, String description,
+ Object value, Class type, boolean userModifiable) {
+ return new ConfigurationParameterJmxImpl(name, description, value, type, userModifiable);
}
/**
- * Override createStatisticResource by instantiating StatisticResourceJmxImpl
- * if it was not created earlier otherwise returns the same instance.
+ * Override createStatisticResource by instantiating StatisticResourceJmxImpl if it was not
+ * created earlier otherwise returns the same instance.
*
- * @param stat
- * StatResource reference for which this JMX resource is to be created
+ * @param stat StatResource reference for which this JMX resource is to be created
* @return StatisticResourceJmxImpl - JMX Implementation of StatisticResource
- * @throws AdminException
- * if constructing StatisticResourceJmxImpl instance fails
+ * @throws AdminException if constructing StatisticResourceJmxImpl instance fails
*/
@Override
protected StatisticResource createStatisticResource(StatResource stat)
- throws org.apache.geode.admin.AdminException {
+ throws org.apache.geode.admin.AdminException {
StatisticResourceJmxImpl managedStatisticResource = null;
-
+
synchronized (this.managedStatisticsResourcesMap) {
- /*
- * Ensuring that a single instance of Statistic Resource is created per
- * StatResource.
+ /*
+ * Ensuring that a single instance of Statistic Resource is created per StatResource.
*/
StatisticResourceJmxImpl statisticResourceJmxImpl = managedStatisticsResourcesMap.get(stat);
if (statisticResourceJmxImpl != null) {
managedStatisticResource = statisticResourceJmxImpl;
} else {
managedStatisticResource = new StatisticResourceJmxImpl(stat, this);
- managedStatisticResource.getStatistics();//inits timer
+ managedStatisticResource.getStatistics();// inits timer
managedStatisticsResourcesMap.put(stat, managedStatisticResource);
}
}
@@ -345,18 +318,16 @@ implements SystemMemberJmx, javax.management.NotificationListener,
}
/**
- * Override createSystemMemberCache by instantiating SystemMemberCacheJmxImpl
- * if it was not created earlier.
+ * Override createSystemMemberCache by instantiating SystemMemberCacheJmxImpl if it was not
+ * created earlier.
*
- * @param vm
- * GemFireVM reference for which this JMX resource is to be created
+ * @param vm GemFireVM reference for which this JMX resource is to be created
* @return SystemMemberCacheJmxImpl - JMX Implementation of SystemMemberCache
- * @throws AdminException
- * if constructing SystemMemberCacheJmxImpl instance fails
+ * @throws AdminException if constructing SystemMemberCacheJmxImpl instance fails
*/
@Override
protected SystemMemberCache createSystemMemberCache(GemFireVM vm)
- throws org.apache.geode.admin.AdminException {
+ throws org.apache.geode.admin.AdminException {
if (managedSystemMemberCache == null) {
managedSystemMemberCache = new SystemMemberCacheJmxImpl(vm);
}
@@ -364,43 +335,43 @@ implements SystemMemberJmx, javax.management.NotificationListener,
}
// -------------------------------------------------------------------------
- // Create MBean attributes for each ConfigurationParameter
+ // Create MBean attributes for each ConfigurationParameter
// -------------------------------------------------------------------------
-
+
/**
* Add MBean attribute definitions for each ConfigurationParameter.
*
* @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
+ * @return a new instance of ManagedBean copied from <code>managed</code> but with the new
+ * attributes added
*/
- public ManagedBean addDynamicAttributes(ManagedBean managed)
- throws AdminException {
+ public ManagedBean addDynamicAttributes(ManagedBean managed) throws AdminException {
return Helper.addDynamicAttributes(this, managed);
}
// -------------------------------------------------------------------------
- // 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;
}
@@ -408,11 +379,10 @@ implements SystemMemberJmx, javax.management.NotificationListener,
public ManagedResourceType getManagedResourceType() {
return ManagedResourceType.SYSTEM_MEMBER;
}
-
+
/**
- * Un-registers all the statistics & cache managed resource created for this
- * member. After un-registering the resource MBean instances, clears
- * managedStatisticsResourcesMap collection.
+ * Un-registers all the statistics & cache managed resource created for this member. After
+ * un-registering the resource MBean instances, clears managedStatisticsResourcesMap collection.
*/
public void cleanupResource() {
synchronized (this.managedStatisticsResourcesMap) {
@@ -425,12 +395,13 @@ implements SystemMemberJmx, javax.management.NotificationListener,
}
this.parms.clear();
- Collection<StatisticResourceJmxImpl> statisticResources = managedStatisticsResourcesMap.values();
-
+ Collection<StatisticResourceJmxImpl> statisticResources =
+ managedStatisticsResourcesMap.values();
+
for (StatisticResourceJmxImpl statisticResource : statisticResources) {
MBeanUtil.unregisterMBean(statisticResource);
}
-
+
this.managedStatisticsResourcesMap.clear();
}
MBeanUtil.unregisterMBean(managedSystemMemberCache);
@@ -438,53 +409,48 @@ implements SystemMemberJmx, javax.management.NotificationListener,
/**
- * Cleans up Managed Resources created for the client that was connected to
- * the server represented by this class.
+ * Cleans up Managed Resources created for the client that was connected to the server represented
+ * by this class.
*
- * @param clientId
- * id of the client to be removed
- * @return List of ManagedResources associated with the client of given client
- * id
+ * @param clientId id of the client to be removed
+ * @return List of ManagedResources associated with the client of given client id
*/
/*
- * This clean up is for the clients. The clients are started with a loner DM.
- * Hence the clientId is not supposed to contain '/' as per
- * InternalDistributedMember.toString().
+ * This clean up is for the clients. The clients are started with a loner DM. Hence the clientId
+ * is not supposed to contain '/' as per InternalDistributedMember.toString().
*/
public List<ManagedResource> cleanupBridgeClientResources(String clientId) {
List<ManagedResource> returnedResources = new ArrayList<ManagedResource>();
- String compatibleId = "id_"+MBeanUtil.makeCompliantMBeanNameProperty(clientId);
+ String compatibleId = "id_" + MBeanUtil.makeCompliantMBeanNameProperty(clientId);
synchronized (this.managedStatisticsResourcesMap) {
- Set<Entry<StatResource, StatisticResourceJmxImpl>> entrySet = this.managedStatisticsResourcesMap.entrySet();
-
- for (Iterator<Entry<StatResource, StatisticResourceJmxImpl>> it = entrySet.iterator(); it.hasNext();) {
+ Set<Entry<StatResource, StatisticResourceJmxImpl>> entrySet =
+ this.managedStatisticsResourcesMap.entrySet();
+
+ for (Iterator<Entry<StatResource, StatisticResourceJmxImpl>> it = entrySet.iterator(); it
+ .hasNext();) {
Entry<StatResource, StatisticResourceJmxImpl> entry = it.next();
StatisticResourceJmxImpl resource = entry.getValue();
if (resource.getMBeanName().contains(compatibleId)) {
- it.remove(); //remove matching entry
+ it.remove(); // remove matching entry
returnedResources.add(resource);
}
}
}
return returnedResources;
}
-
+
/**
* Implementation handles client membership changes.
*
- * @param clientId
- * id of the client for whom membership change happened
- * @param eventType
- * membership change type; one of
- * {@link ClientMembershipMessage#JOINED},
- * {@link ClientMembershipMessage#LEFT},
- * {@link ClientMembershipMessage#CRASHED}
+ * @param clientId id of the client for whom membership change happened
+ * @param eventType membership change type; one of {@link ClientMembershipMessage#JOINED},
+ * {@link ClientMembershipMessage#LEFT}, {@link ClientMembershipMessage#CRASHED}
*/
public void handleClientMembership(String clientId, int eventType) {
- String notifType = null;
+ String notifType = null;
List<ManagedResource> cleanedUp = null;
-
+
if (eventType == ClientMembershipMessage.LEFT) {
notifType = NOTIF_CLIENT_LEFT;
cleanedUp = cleanupBridgeClientResources(clientId);
@@ -494,96 +460,79 @@ implements SystemMemberJmx, javax.management.NotificationListener,
} else if (eventType == ClientMembershipMessage.JOINED) {
notifType = NOTIF_CLIENT_JOINED;
}
-
+
if (cleanedUp != null) {
for (ManagedResource resource : cleanedUp) {
MBeanUtil.unregisterMBean(resource);
}
}
- Helper.sendNotification(this,
- new Notification(notifType, this.modelMBean,
- Helper.getNextNotificationSequenceNumber(),
- clientId));
+ Helper.sendNotification(this, new Notification(notifType, this.modelMBean,
+ Helper.getNextNotificationSequenceNumber(), clientId));
}
-
+
/**
- * Implementation handles creation of cache by extracting the details from the
- * given event object and sending the
- * {@link SystemMemberJmx#NOTIF_CACHE_CREATED} notification to the connected
- * JMX Clients.
+ * Implementation handles creation of cache by extracting the details from the given event object
+ * and sending the {@link SystemMemberJmx#NOTIF_CACHE_CREATED} notification to the connected JMX
+ * Clients.
*
- * @param event
- * event object corresponding to the creation of the cache
+ * @param event event object corresponding to the creation of the cache
*/
public void handleCacheCreate(SystemMemberCacheEvent event) {
- Helper.sendNotification(this,
- new Notification(NOTIF_CACHE_CREATED, this.modelMBean,
- Helper.getNextNotificationSequenceNumber(),
- Helper.getCacheEventDetails(event)));
- }
+ Helper.sendNotification(this, new Notification(NOTIF_CACHE_CREATED, this.modelMBean,
+ Helper.getNextNotificationSequenceNumber(), Helper.getCacheEventDetails(event)));
+ }
/**
- * Implementation handles closure of cache by extracting the details from the
- * given event object and sending the
- * {@link SystemMemberJmx#NOTIF_CACHE_CLOSED} notification to the connected
- * JMX Clients.
+ * Implementation handles closure of cache by extracting the details from the given event object
+ * and sending the {@link SystemMemberJmx#NOTIF_CACHE_CLOSED} notification to the connected JMX
+ * Clients.
*
- * @param event
- * event object corresponding to the closure of the cache
+ * @param event event object corresponding to the closure of the cache
*/
public void handleCacheClose(SystemMemberCacheEvent event) {
- Helper.sendNotification(this,
- new Notification(NOTIF_CACHE_CLOSED, this.modelMBean,
- Helper.getNextNotificationSequenceNumber(),
- Helper.getCacheEventDetails(event)));
+ Helper.sendNotification(this, new Notification(NOTIF_CACHE_CLOSED, this.modelMBean,
+ Helper.getNextNotificationSequenceNumber(), Helper.getCacheEventDetails(event)));
}
/**
- * Implementation handles creation of region by extracting the details from
- * the given event object and sending the
- * {@link SystemMemberJmx#NOTIF_REGION_CREATED} notification to the connected
- * JMX Clients. Region Path is set as User Data in Notification.
+ * Implementation handles creation of region by extracting the details from the given event object
+ * and sending the {@link SystemMemberJmx#NOTIF_REGION_CREATED} notification to the connected JMX
+ * Clients. Region Path is set as User Data in Notification.
*
- * @param event
- * event object corresponding to the creation of a region
+ * @param event event object corresponding to the creation of a region
*/
public void handleRegionCreate(SystemMemberRegionEvent event) {
- Notification notification = new Notification(NOTIF_REGION_CREATED, this.modelMBean,
- Helper.getNextNotificationSequenceNumber(),
- Helper.getRegionEventDetails(event));
-
+ Notification notification = new Notification(NOTIF_REGION_CREATED, this.modelMBean,
+ Helper.getNextNotificationSequenceNumber(), Helper.getRegionEventDetails(event));
+
notification.setUserData(event.getRegionPath());
Helper.sendNotification(this, notification);
}
/**
- * Implementation should handle loss of region by extracting the details from
- * the given event object and sending the
- * {@link SystemMemberJmx#NOTIF_REGION_LOST} notification to the connected
- * JMX Clients. Region Path is set as User Data in Notification. Additionally,
- * it also clears the ManagedResources created for the region that is lost.
+ * Implementation should handle loss of region by extracting the details from the given event
+ * object and sending the {@link SystemMemberJmx#NOTIF_REGION_LOST} notification to the connected
+ * JMX Clients. Region Path is set as User Data in Notification. Additionally, it also clears the
+ * ManagedResources created for the region that is lost.
*
- * @param event
- * event object corresponding to the loss of a region
+ * @param event event object corresponding to the loss of a region
*/
public void handleRegionLoss(SystemMemberRegionEvent event) {
SystemMemberCacheJmxImpl cacheResource = this.managedSystemMemberCache;
-
+
if (cacheResource != null) {
- ManagedResource cleanedUp =
- cacheResource.cleanupRegionResources(event.getRegionPath());
-
+ ManagedResource cleanedUp = cacheResource.cleanupRegionResources(event.getRegionPath());
+
if (cleanedUp != null) {
MBeanUtil.unregisterMBean(cleanedUp);
}
}
-
- Notification notification = new Notification(NOTIF_REGION_LOST, this.modelMBean,
- Helper.getNextNotificationSequenceNumber(),
- Helper.getRegionEventDetails(event));
-
+
+ Notification notification = new Notification(NOTIF_REGION_LOST, this.modelMBean,
+ Helper.getNextNotificationSequenceNumber(), Helper.getRegionEventDetails(event));
+
notification.setUserData(event.getRegionPath());
Helper.sendNotification(this, notification);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberRegionJmxImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberRegionJmxImpl.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberRegionJmxImpl.java
index 9ee3153..cc5621e 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberRegionJmxImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/SystemMemberRegionJmxImpl.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;
@@ -24,75 +22,70 @@ import javax.management.ObjectName;
import javax.management.modelmbean.ModelMBean;
/**
- * MBean representation of {@link
- * org.apache.geode.admin.SystemMemberRegion}.
+ * MBean representation of {@link org.apache.geode.admin.SystemMemberRegion}.
*
- * @since GemFire 3.5
+ * @since GemFire 3.5
*/
-public class SystemMemberRegionJmxImpl
-extends org.apache.geode.admin.internal.SystemMemberRegionImpl
-implements org.apache.geode.admin.jmx.internal.ManagedResource {
+public class SystemMemberRegionJmxImpl
+ extends org.apache.geode.admin.internal.SystemMemberRegionImpl
+ implements org.apache.geode.admin.jmx.internal.ManagedResource {
/** The object name of this managed resource */
private ObjectName objectName;
// -------------------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// -------------------------------------------------------------------------
- /**
+ /**
* Constructs an instance of SystemMemberRegionJmxImpl.
*
- * @param cache the cache this region belongs to
- * @param region internal region to delegate real work to
+ * @param cache the cache this region belongs to
+ * @param region internal region to delegate real work to
*/
- public SystemMemberRegionJmxImpl(SystemMemberCacheImpl cache,
- Region region)
- throws org.apache.geode.admin.AdminException {
+ public SystemMemberRegionJmxImpl(SystemMemberCacheImpl cache, Region region)
+ throws org.apache.geode.admin.AdminException {
super(cache, region);
initializeMBean(cache);
}
/** Create and register the MBean to manage this resource */
private void initializeMBean(SystemMemberCacheImpl cache)
- throws org.apache.geode.admin.AdminException {
-
+ throws org.apache.geode.admin.AdminException {
+
GemFireVM vm = cache.getVM();
- this.mbeanName = new StringBuffer("GemFire.Cache:")
- .append("path=")
- .append(MBeanUtil.makeCompliantMBeanNameProperty(getFullPath()))
- .append(",name=")
- .append(MBeanUtil.makeCompliantMBeanNameProperty(cache.getName()))
- .append(",id=")
- .append(cache.getId())
- .append(",owner=")
+ this.mbeanName = new StringBuffer("GemFire.Cache:").append("path=")
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(getFullPath())).append(",name=")
+ .append(MBeanUtil.makeCompliantMBeanNameProperty(cache.getName())).append(",id=")
+ .append(cache.getId()).append(",owner=")
.append(MBeanUtil.makeCompliantMBeanNameProperty(vm.getId().toString()))
.append(",type=Region").toString();
-
+
this.objectName = MBeanUtil.createMBean(this);
}
-
+
// -------------------------------------------------------------------------
- // 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;
}
@@ -100,33 +93,30 @@ implements org.apache.geode.admin.jmx.internal.ManagedResource {
public ManagedResourceType getManagedResourceType() {
return ManagedResourceType.SYSTEM_MEMBER_REGION;
}
-
+
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 SystemMemberRegionJmxImpl) ) {
+ if (!(obj instanceof SystemMemberRegionJmxImpl)) {
return false;
}
-
- SystemMemberRegionJmxImpl other = (SystemMemberRegionJmxImpl) obj;
-
+
+ SystemMemberRegionJmxImpl other = (SystemMemberRegionJmxImpl) 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
*/