User: user57
Date: 02/02/16 19:34:28
Modified: src/main/org/jboss/ha/hasessionstate/server
HASessionStateImpl.java HASessionStateService.java
Log:
o logging changes, still needs work garuding debugs and dropping
printStackTrace() usage
o using ServiceMBeanSupport features where it is a subclass, should
use it as a delegate for those that don't sc it.
Revision Changes Path
1.6 +32 -26
jbossmx/src/main/org/jboss/ha/hasessionstate/server/HASessionStateImpl.java
Index: HASessionStateImpl.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/hasessionstate/server/HASessionStateImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HASessionStateImpl.java 4 Feb 2002 21:26:32 -0000 1.5
+++ HASessionStateImpl.java 17 Feb 2002 03:34:27 -0000 1.6
@@ -53,7 +53,7 @@
* @see HASessionState
* @author [EMAIL PROTECTED]
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*
* <p><b>Revisions:</b><br>
* <p><b>2002/01/09: billb</b>
@@ -68,15 +68,15 @@
HAPartition.HAPartitionStateTransfer
{
- protected String _sessionStateName = null;
- protected Logger log = null;
- protected HAPartition hapGeneral = null;
- protected String sessionStateIdentifier = null;
- protected String myNodeName = null;
+ protected String _sessionStateName;
+ protected Logger log;
+ protected HAPartition hapGeneral;
+ protected String sessionStateIdentifier;
+ protected String myNodeName;
protected long beanCleaningDelay;
- protected String haPartitionName = null;
- protected String haPartitionJndiName = null;
+ protected String haPartitionName;
+ protected String haPartitionJndiName;
protected final String DEFAULT_PARTITION_JNDI_NAME =
org.jboss.metadata.ClusterConfigMetaData.DEFAULT_PARTITION;
protected final String JNDI_FOLDER_NAME_FOR_HASESSIONSTATE =
org.jboss.metadata.ClusterConfigMetaData.JNDI_PREFIX_FOR_SESSION_STATE;
@@ -114,7 +114,7 @@
public void init () throws Exception
{
- this.log = Logger.getLogger ("HASessionState-" + this._sessionStateName);
+ this.log = Logger.getLogger(HASessionStateImpl.class.getName() + "." +
this._sessionStateName);
// let's first find the HAPartition
//
@@ -128,9 +128,6 @@
this.hapGeneral.registerRPCHandler (this.sessionStateIdentifier, this);
this.hapGeneral.subscribeToStateTransferEvents
(this.HA_SESSION_STATE_STATE_TRANSFER, this);
this.bind (this._sessionStateName, this, HASessionStateImpl.class, ctx);
-
- log.info ("...HAPartition initialized.");
-
}
protected void bind (String jndiName, Object who, Class classType, Context ctx)
throws Exception
@@ -148,7 +145,7 @@
}
catch (NameNotFoundException e)
{
- log.info ("creating Subcontext" + ctxName);
+ log.debug ("creating Subcontext" + ctxName);
ctx = ctx.createSubcontext (ctxName);
}
n = n.getSuffix (1);
@@ -165,7 +162,7 @@
public void start () throws Exception
{
this.myNodeName = this.hapGeneral.getNodeName ();
- log.info ("HASessionState node name : " + this.myNodeName );
+ log.debug ("HASessionState node name : " + this.myNodeName );
}
public void stop () throws Exception
@@ -202,9 +199,11 @@
try
{
result = deflate (this.appSessions);
- } catch (Exception displayed)
- { displayed.printStackTrace (); }
-
+ }
+ catch (Exception e)
+ {
+ log.error("operation failed", e);
+ }
}
return result;
}
@@ -222,9 +221,11 @@
{
this.appSessions.clear (); // hope to facilitate the job of the GC
this.appSessions = (Hashtable)inflate ((byte[])newState);
- } catch (Exception displayed)
- { displayed.printStackTrace (); }
-
+ }
+ catch (Exception e)
+ {
+ log.error("operation failed", e);
+ }
}
}
@@ -343,8 +344,10 @@
{
this.hapGeneral.callMethodOnCluster (this.sessionStateIdentifier,
"_setState", args, true);
}
- catch (Exception displayed)
- { displayed.printStackTrace (); }
+ catch (Exception e)
+ {
+ log.error("operation failed", e);
+ }
}
}
}
@@ -422,8 +425,11 @@
{
answers = this.hapGeneral.callMethodOnCluster
(this.sessionStateIdentifier, "_setOwnership", args, true);
}
- catch (Exception displayed)
- { displayed.printStackTrace (); }
+ catch (Exception e)
+ {
+ log.error("operation failed", e);
+ }
+
if (answers != null && answers.contains (Boolean.FALSE))
throw new java.rmi.RemoteException ("Concurent calls on session
object.");
else
@@ -488,8 +494,8 @@
{
this.hapGeneral.callMethodOnCluster
(this.sessionStateIdentifier, "_removeSession", args, true);
}
- catch (Exception displayed)
- { displayed.printStackTrace (); }
+ catch (Exception e)
+ { log.error("operation failed", e); }
}
}
}
1.7 +11 -19
jbossmx/src/main/org/jboss/ha/hasessionstate/server/HASessionStateService.java
Index: HASessionStateService.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/hasessionstate/server/HASessionStateService.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- HASessionStateService.java 15 Feb 2002 00:46:51 -0000 1.6
+++ HASessionStateService.java 17 Feb 2002 03:34:27 -0000 1.7
@@ -22,7 +22,7 @@
*
* @see HASessionState
* @author [EMAIL PROTECTED]
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*
* <p><b>Revisions:</b><br>
*/
@@ -31,12 +31,11 @@
extends ServiceMBeanSupport
implements HASessionStateServiceMBean
{
-
- protected String jndiName = null;
- protected String haPartitionName = null;
+ protected String jndiName;
+ protected String haPartitionName;
protected long beanCleaningDelay = 0;
- protected HASessionStateImpl sessionState = null;
+ protected HASessionStateImpl sessionState;
public String getName ()
{
@@ -76,16 +75,16 @@
// ******************************************************************
- public ObjectName getObjectName (MBeanServer server, ObjectName name)
- throws javax.management.MalformedObjectNameException
+ protected ObjectName getObjectName (MBeanServer server, ObjectName name)
+ throws MalformedObjectNameException
{
- return OBJECT_NAME;
+ return name == null ? OBJECT_NAME : name;
}
// ******************************************************************
- public void createService()
+ protected void createService()
throws Exception
{
this.sessionState = new HASessionStateImpl (this.jndiName,
this.haPartitionName,
@@ -98,17 +97,10 @@
this.sessionState.start ();
}
- public void stopService()
+ protected void stopService() throws Exception
{
- try
- {
- this.sessionState.stop ();
- this.sessionState = null;
- }
- catch (Exception ignored)
- {
- ignored.printStackTrace ();
- }
+ this.sessionState.stop ();
+ this.sessionState = null;
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development