Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*     */ package org.jboss.ejb3;
  /*     */ 
  /*     */ import java.lang.reflect.Method;
  /*     */ import javax.ejb.TimerService;
  /*     */ import org.jboss.system.ServiceMBeanSupport;
  /*     */ 
  /*     */ @Deprecated
 /*     */ public class ServiceDelegateWrapper extends ServiceMBeanSupport
 /*     */   implements ServiceDelegateWrapperMBean
 /*     */ {
 /*     */   private Object delegate;
 /*     */   private Method createMethod;
 /*     */   private Method startMethod;
 /*     */   private Method stopMethod;
 /*     */   private Method destroyMethod;
 /*     */ 
 /*     */   public ServiceDelegateWrapper(Object delegate)
 /*     */   {
 /*  52 */     this.delegate = delegate;
 /*     */     try
 /*     */     {
 /*  55 */       this.createMethod = delegate.getClass().getMethod("create"new Class[0]);
 /*     */     }
 /*     */     catch (NoSuchMethodException ignored)
 /*     */     {
 /*     */     }
 /*     */     try
 /*     */     {
 /*  62 */       this.startMethod = delegate.getClass().getMethod("start"new Class[0]);
 /*     */     }
 /*     */     catch (NoSuchMethodException ignored)
 /*     */     {
 /*     */     }
 /*     */     try
 /*     */     {
 /*  69 */       this.stopMethod = delegate.getClass().getMethod("stop"new Class[0]);
 /*     */     }
 /*     */     catch (NoSuchMethodException ignored)
 /*     */     {
 /*     */     }
 /*     */     try
 /*     */     {
 /*  76 */       this.destroyMethod = delegate.getClass().getMethod("destroy"new Class[0]);
 /*     */     }
 /*     */     catch (NoSuchMethodException ignored)
 /*     */     {
 /*     */     }
 /*     */   }
 /*     */ 
 /*     */   protected void createService()
 /*     */     throws Exception
 /*     */   {
 /*  87 */     super.createService();
 /*     */     try
 /*     */     {
 /*  90 */       if (this.createMethod != nullthis.createMethod.invoke(this.delegate, new Object[0]);
 /*     */     }
 /*     */     catch (InvocationTargetException e)
 /*     */     {
 /*  94 */       Throwable t = e.getCause();
 /*  95 */       if ((t instanceof Exception)) throw ((Exception)t);
 /*  96 */       throw new RuntimeException(t);
 /*     */     }
 /*     */   }
 /*     */ 
 /*     */   protected void startService()
 /*     */     throws Exception
 /*     */   {
 /* 103 */     super.startService();
 /*     */     try
 /*     */     {
 /* 106 */       if (this.startMethod != nullthis.startMethod.invoke(this.delegate, new Object[0]);
 /*     */     }
 /*     */     catch (InvocationTargetException e)
 /*     */     {
 /* 110 */       Throwable t = e.getCause();
 /* 111 */       if ((t instanceof Exception)) throw ((Exception)t);
 /* 112 */       throw new RuntimeException(t);
 /*     */     }
 /*     */   }
 /*     */ 
 /*     */   protected void stopService()
 /*     */     throws Exception
 /*     */   {
 /* 119 */     super.stopService();
 /*     */     try
 /*     */     {
 /* 122 */       if (this.stopMethod != nullthis.stopMethod.invoke(this.delegate, new Object[0]);
 /*     */     }
 /*     */     catch (InvocationTargetException e)
 /*     */     {
 /* 126 */       Throwable t = e.getCause();
 /* 127 */       if ((t instanceof Exception)) throw ((Exception)t);
 /* 128 */       throw new RuntimeException(t);
 /*     */     }
 /*     */   }
 /*     */ 
/*     */   protected void destroyService()
/*     */     throws Exception
/*     */   {
/* 136 */     super.destroyService();
/*     */     try
/*     */     {
/* 139 */       if (this.destroyMethod != nullthis.destroyMethod.invoke(this.delegate, new Object[0]);
/*     */     }
/*     */     catch (InvocationTargetException e)
/*     */     {
/* 143 */       Throwable t = e.getCause();
/* 144 */       if ((t instanceof Exception)) throw ((Exception)t);
/* 145 */       throw new RuntimeException(t);
/*     */     }
/*     */   }
/*     */ 
/*     */   public TimerService getTimerService(Object pKey)
/*     */   {
/* 152 */     return ((Container)this.delegate).getTimerService(pKey);
/*     */   }
/*     */ 
/*     */   public InvocationStatistics getInvokeStats()
/*     */   {
/* 157 */     return ((Container)this.delegate).getInvokeStats();
/*     */   }
/*     */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
 * Qualified Name:     org.jboss.ejb3.ServiceDelegateWrapper
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X