Author: bstansberry(a)jboss.com
Date: 2008-01-14 16:43:41 -0500 (Mon, 14 Jan 2008)
New Revision: 5126
Modified:
pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
Log:
Avoid NPE if asked to send a notification before plainCacheWrapper is assigned
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java 2008-01-14
16:02:58 UTC (rev 5125)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java 2008-01-14
21:43:41 UTC (rev 5126)
@@ -934,17 +934,20 @@
*/
private void sendStateChangeNotification(int oldState, int newState, String msg,
Throwable t)
{
- long now = System.currentTimeMillis();
-
- AttributeChangeNotification stateChangeNotification = new
AttributeChangeNotification(
- this,
- plainCacheWrapper.getNextNotificationSequenceNumber(), now, msg,
- "State", "java.lang.Integer",
- new Integer(oldState), new Integer(newState)
- );
- stateChangeNotification.setUserData(t);
-
- plainCacheWrapper.sendNotification(stateChangeNotification);
+ if (plainCacheWrapper != null)
+ {
+ long now = System.currentTimeMillis();
+
+ AttributeChangeNotification stateChangeNotification = new
AttributeChangeNotification(
+ this,
+ plainCacheWrapper.getNextNotificationSequenceNumber(), now, msg,
+ "State", "java.lang.Integer",
+ new Integer(oldState), new Integer(newState)
+ );
+ stateChangeNotification.setUserData(t);
+
+ plainCacheWrapper.sendNotification(stateChangeNotification);
+ }
}
/**
Show replies by date