public SingletonContainer(final Object id, final SecurityService securityService) throws OpenEJBException { this.containerID = id; this.securityService = securityService; instanceManager = new SingletonInstanceManager(securityService); for (final BeanContext beanContext : deploymentRegistry.values()) { beanContext.setContainer(this); } }
@Override public void undeploy(final BeanContext beanContext) { this.instanceManager.undeploy(beanContext); final String id = (String) beanContext.getDeploymentID(); beanContext.setContainer(null); beanContext.setContainerData(null); this.deploymentRegistry.remove(id); }
@Override public void undeploy(final BeanContext beanContext) { this.instanceManager.undeploy(beanContext); final String id = (String) beanContext.getDeploymentID(); beanContext.setContainer(null); beanContext.setContainerData(null); this.deploymentRegistry.remove(id); }
public SingletonContainer(final Object id, final SecurityService securityService) throws OpenEJBException { this.containerID = id; this.securityService = securityService; instanceManager = new SingletonInstanceManager(securityService); for (final BeanContext beanContext : deploymentRegistry.values()) { beanContext.setContainer(this); } }
public void undeploy(final BeanContext beanContext) throws OpenEJBException { if (!(beanContext instanceof BeanContext)) { return; } try { instanceManager.undeploy(beanContext); } finally { beanContext.setContainer(null); beanContext.setContainerData(null); deployments.remove(beanContext.getDeploymentID()); } }
@Override public void undeploy(final BeanContext info) throws OpenEJBException { instanceManager.undeploy(info); synchronized (this) { final String id = (String) info.getDeploymentID(); deploymentRegistry.remove(id); info.setContainer(null); } }
@Override public void undeploy(final BeanContext beanContext) throws OpenEJBException { synchronized (this) { deploymentsById.remove(beanContext.getDeploymentID()); beansByClass.remove(beanContext.getCmpImplClass()); try { final Field field = beanContext.getCmpImplClass().getField("deploymentInfo"); field.set(null, null); } catch (final Exception e) { // ignore } beanContext.setContainer(null); beanContext.setContainerData(null); } }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { synchronized (this) { deploymentRegistry.put((String) beanContext.getDeploymentID(), beanContext); beanContext.setContainer(this); } instanceManager.deploy(beanContext); }
@Override public void undeploy(final BeanContext beanContext) throws OpenEJBException { synchronized (this) { deploymentsById.remove(beanContext.getDeploymentID()); beansByClass.remove(beanContext.getCmpImplClass()); try { final Field field = beanContext.getCmpImplClass().getField("deploymentInfo"); field.set(null, null); } catch (final Exception e) { // ignore } beanContext.setContainer(null); beanContext.setContainerData(null); } }
@Override public void undeploy(final BeanContext info) throws OpenEJBException { instanceManager.undeploy(info); synchronized (this) { final String id = (String) info.getDeploymentID(); deploymentRegistry.remove(id); info.setContainer(null); } }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { synchronized (this) { final Object deploymentId = beanContext.getDeploymentID(); cmpEngine.deploy(beanContext); beanContext.setContainerData(cmpEngine); beanContext.set(EJBContext.class, new EntityContext(securityService)); // try to set deploymentInfo static field on bean implementation class try { final Field field = beanContext.getCmpImplClass().getField("deploymentInfo"); field.set(null, beanContext); } catch (final Exception e) { // ignore } // add to indexes deploymentsById.put(deploymentId, beanContext); beansByClass.put(beanContext.getCmpImplClass(), beanContext); beanContext.setContainer(this); } }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { synchronized (this) { deploymentRegistry.put((String) beanContext.getDeploymentID(), beanContext); beanContext.setContainer(this); } instanceManager.deploy(beanContext); }
@Override public synchronized void undeploy(final BeanContext bean) throws OpenEJBException { final Data data = (Data) bean.getContainerData(); if (data != null) { final MBeanServer server = LocalMBeanServer.get(); for (final ObjectName objectName : data.jmxNames) { try { server.unregisterMBean(objectName); } catch (final Exception e) { logger.error("Unable to unregister MBean " + objectName); } } } deploymentsById.remove(bean.getDeploymentID()); bean.setContainer(null); bean.setContainerData(null); cache.removeAll(new CacheFilter<Instance>() { @Override public boolean matches(final Instance instance) { return bean == instance.beanContext; } }); }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { instanceManager.deploy(beanContext); final String id = (String) beanContext.getDeploymentID(); synchronized (this) { deploymentRegistry.put(id, beanContext); beanContext.setContainer(this); } }
@Override public void undeploy(final BeanContext beanContext) { final ThreadContext threadContext = new ThreadContext(beanContext, null); final ThreadContext old = ThreadContext.enter(threadContext); try { instanceManager.freeInstance(threadContext); } finally { ThreadContext.exit(old); } instanceManager.undeploy(beanContext); synchronized (this) { final String id = (String) beanContext.getDeploymentID(); beanContext.setContainer(null); beanContext.setContainerData(null); deploymentRegistry.remove(id); } }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { instanceManager.deploy(beanContext); final String id = (String) beanContext.getDeploymentID(); synchronized (this) { deploymentRegistry.put(id, beanContext); beanContext.setContainer(this); } }
@Override public synchronized void undeploy(final BeanContext beanContext) throws OpenEJBException { final Data data = (Data) beanContext.getContainerData(); final MBeanServer server = LocalMBeanServer.get(); for (final ObjectName objectName : data.jmxNames) { try { server.unregisterMBean(objectName); } catch (final Exception e) { logger.error("Unable to unregister MBean " + objectName); } } deploymentsById.remove(beanContext.getDeploymentID()); beanContext.setContainer(null); beanContext.setContainerData(null); if (!containsExtendedPersistenceContext(beanContext)) { cache.removeAll(new BeanContextFilter(beanContext.getId())); } }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { final String id = (String) beanContext.getDeploymentID(); deploymentRegistry.put(id, beanContext); beanContext.setContainer(this); // add it before starting the timer (@PostCostruct) if (StatsInterceptor.isStatsActivated()) { final StatsInterceptor stats = new StatsInterceptor(beanContext.getBeanClass()); beanContext.addFirstSystemInterceptor(stats); } }
@Override public synchronized void undeploy(final BeanContext beanContext) throws OpenEJBException { final Data data = (Data) beanContext.getContainerData(); final MBeanServer server = LocalMBeanServer.get(); for (final ObjectName objectName : data.jmxNames) { try { server.unregisterMBean(objectName); } catch (final Exception e) { logger.error("Unable to unregister MBean " + objectName); } } deploymentsById.remove(beanContext.getDeploymentID()); beanContext.setContainer(null); beanContext.setContainerData(null); if (isPassivable(beanContext)) { cache.removeAll(new BeanContextFilter(beanContext.getId())); } }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { final String id = (String) beanContext.getDeploymentID(); deploymentRegistry.put(id, beanContext); beanContext.setContainer(this); // add it before starting the timer (@PostCostruct) if (StatsInterceptor.isStatsActivated()) { final StatsInterceptor stats = new StatsInterceptor(beanContext.getBeanClass()); beanContext.addFirstSystemInterceptor(stats); } }