Beispiel #1
0
  private void cancelTimers(final ThreadContext threadContext) {
    final BeanContext beanContext = threadContext.getBeanContext();
    final Object primaryKey = threadContext.getPrimaryKey();

    // stop timers
    if (primaryKey != null && beanContext.getEjbTimerService() != null) {
      final EjbTimerService timerService = beanContext.getEjbTimerService();
      if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
        for (final Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
          timer.cancel();
        }
      }
    }
  }
Beispiel #2
0
 @Override
 public void start(final BeanContext beanContext) throws OpenEJBException {
   final EjbTimerService timerService = beanContext.getEjbTimerService();
   if (timerService != null) {
     timerService.start();
   }
 }
  public void deploy(BeanContext beanContext) throws OpenEJBException {
    String id = (String) beanContext.getDeploymentID();
    synchronized (this) {
      deploymentRegistry.put(id, beanContext);
      beanContext.setContainer(this);
    }

    EjbTimerService timerService = beanContext.getEjbTimerService();
    if (timerService != null) {
      timerService.start();
    }
  }
  public void undeploy(BeanContext beanContext) {

    EjbTimerService timerService = beanContext.getEjbTimerService();
    if (timerService != null) {
      timerService.stop();
    }

    instanceManager.undeploy(beanContext);

    synchronized (this) {
      String id = (String) beanContext.getDeploymentID();
      beanContext.setContainer(null);
      beanContext.setContainerData(null);
      deploymentRegistry.remove(id);
    }
  }
  public void undeploy(BeanContext beanContext) {
    ThreadContext threadContext = new ThreadContext(beanContext, null);
    ThreadContext old = ThreadContext.enter(threadContext);
    try {
      instanceManager.freeInstance(threadContext);
    } finally {
      ThreadContext.exit(old);
    }

    EjbTimerService timerService = beanContext.getEjbTimerService();
    if (timerService != null) {
      timerService.stop();
    }

    instanceManager.undeploy(beanContext);

    synchronized (this) {
      String id = (String) beanContext.getDeploymentID();
      beanContext.setContainer(null);
      beanContext.setContainerData(null);
      deploymentRegistry.remove(id);
    }
  }