FileDocCategorySizeDatePackage
ServiceDelegateWrapper.javaAPI DocJBoss 4.2.14218Fri Jul 13 20:54:00 BST 2007org.jboss.ejb3

ServiceDelegateWrapper

public class ServiceDelegateWrapper extends org.jboss.system.ServiceMBeanSupport implements ServiceDelegateWrapperMBean
Comment
author
Bill Burke
version
$Revision: 60233 $

Fields Summary
protected Object
delegate
private Method
createMethod
private Method
startMethod
private Method
stopMethod
private Method
destroyMethod
Constructors Summary
public ServiceDelegateWrapper(Object delegate)

      this.delegate = delegate;
      try
      {
         createMethod = delegate.getClass().getMethod("create");
      }
      catch (NoSuchMethodException ignored)
      {
      }
      try
      {
         startMethod = delegate.getClass().getMethod("start");
      }
      catch (NoSuchMethodException ignored)
      {
      }
      try
      {
         stopMethod = delegate.getClass().getMethod("stop");
      }
      catch (NoSuchMethodException ignored)
      {
      }
      try
      {
         destroyMethod = delegate.getClass().getMethod("destroy");
      }
      catch (NoSuchMethodException ignored)
      {
      }

   
Methods Summary
protected voidcreateService()

      super.createService();
      try
      {
         if (createMethod != null) createMethod.invoke(delegate);
      }
      catch (InvocationTargetException e)
      {
         Throwable t = e.getCause();
         if (t instanceof Exception) throw (Exception)t;
         else throw new RuntimeException(t);
      }
   
protected voiddestroyService()

      super.destroyService();
      try
      {
         if (destroyMethod != null) destroyMethod.invoke(delegate);
      }
      catch (InvocationTargetException e)
      {
         Throwable t = e.getCause();
         if (t instanceof Exception) throw (Exception)t;
         else throw new RuntimeException(t);
      }
   
public org.jboss.ejb3.statistics.InvocationStatisticsgetInvokeStats()

      return ((Container) delegate).getInvokeStats();
   
public javax.ejb.TimerServicegetTimerService(java.lang.Object pKey)

      return ((Container) delegate).getTimerService(pKey);
   
protected voidstartService()

      super.startService();
      try
      {
         if (startMethod != null) startMethod.invoke(delegate);
      }
      catch (InvocationTargetException e)
      {
         Throwable t = e.getCause();
         if (t instanceof Exception) throw (Exception)t;
         else throw new RuntimeException(t);
      }
   
protected voidstopService()

      super.stopService();
      try
      {
         if (stopMethod != null) stopMethod.invoke(delegate);
      }
      catch (InvocationTargetException e)
      {
         Throwable t = e.getCause();
         if (t instanceof Exception) throw (Exception)t;
         else throw new RuntimeException(t);
      }