User: user57
Date: 02/02/12 23:51:18
Modified: src/main/org/jboss/util CounterService.java
Log:
o ServiceMBeanSupport stopService() and destroyService() are now
declared to throw Exceptions. This frees uncaring services
from dealing with exceptions that might occur here.
o State is now private to keep concrete impl from messing with it
(as well as keep the sub-classes namespace cleaner)
o renamed mServiceName to serviceName to be consistent with the rest
of the fields in that class
o Added/updated javadoc
o Updated CounterService deal with exceptions (or rather not deal with
them) per the above changes.
Revision Changes Path
1.4 +20 -24 jboss/src/main/org/jboss/util/CounterService.java
Index: CounterService.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/CounterService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CounterService.java 11 Sep 2001 18:35:04 -0000 1.3
+++ CounterService.java 13 Feb 2002 07:51:18 -0000 1.4
@@ -1,3 +1,10 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
package org.jboss.util;
import java.text.DecimalFormat;
@@ -11,10 +18,13 @@
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.naming.NonSerializableFactory;
-/** A service offering accumulator style counters to help in diagnosing
- * performance issues.
- * @author <a href="mailto:[EMAIL PROTECTED]">Dan Christopherson</href>
- * */
+/**
+ * A service offering accumulator style counters to help in diagnosing
+ * performance issues.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Dan Christopherson</href>
+ * @version $Revision: 1.4 $
+ */
public class CounterService
extends ServiceMBeanSupport
implements CounterServiceMBean
@@ -39,10 +49,8 @@
counter.addToCount(add);
}
- protected void startService() throws java.lang.Exception
+ protected void startService() throws Exception
{
- super.startService();
-
InitialContext ctx = new InitialContext();
//bind myself into JNDI, at java:/CounterService
@@ -51,24 +59,12 @@
Reference ref = new Reference(this.getClass().getName(), addr,
NonSerializableFactory.class.getName(), null);
ctx.bind("java:/CounterService", ref);
}
- protected void stopService()
- {
- super.stopService();
- try
- {
- InitialContext ctx = new InitialContext();
- ctx.unbind("java:/CounterService");
- NonSerializableFactory.unbind("java:/CounterService");
- }
- catch (NamingException ne)
- {
- log.error("Coulnd't unbind CounterService", ne);
- }
- }
- public String getName()
+ protected void stopService() throws Exception
{
- return "Counter Service";
+ InitialContext ctx = new InitialContext();
+ ctx.unbind("java:/CounterService");
+ NonSerializableFactory.unbind("java:/CounterService");
}
public String list()
@@ -127,4 +123,4 @@
entries++;
}
}
-}
\ No newline at end of file
+}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development