@Override public Object processInvocation(InterceptorContext context) throws Exception { PooledComponent<ComponentInstance> component = (PooledComponent<ComponentInstance>) getComponent(context, EJBComponent.class); ComponentInstance instance = component.getPool().get(); context.putPrivateData(ComponentInstance.class, instance); boolean discarded = false; component.getPool().discard(instance); component.getPool().discard(instance); throw e; } catch (final Throwable t) { discarded = true; component.getPool().discard(instance); throw new RuntimeException(t); } finally { if (!discarded) { component.getPool().release(instance);
protected void executeWriteAttribute(String attributeName, OperationContext context, ModelNode operation, T component, PathAddress address) throws OperationFailedException { if (componentType.hasPool() && POOL_MAX_SIZE.getName().equals(attributeName)) { int newSize = POOL_MAX_SIZE.resolveValue(context, operation.get(VALUE)).asInt(); final Pool<?> pool = componentType.getPool(component); final int oldSize = pool.getMaxSize(); componentType.getPool(component).setMaxSize(newSize); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { pool.setMaxSize(oldSize); } }); } else { // Bug; we were registered for an attribute but there is no code for handling it throw EjbLogger.ROOT_LOGGER.unknownAttribute(attributeName); } }
@Override public void init() { super.init(); if(this.pool!=null){ this.pool.start(); } }
final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getAvailableCount()); final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getCreateCount()); final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getRemoveCount()); final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getCurrentSize()); final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getMaxSize());
@Override public void handleRollback(OperationContext context, ModelNode operation) { pool.setMaxSize(oldSize); } });
public EntityBeanComponentInstance acquireUnAssociatedInstance() { if (pool != null) { return pool.get(); } else { return factory.create(); } }
public void releaseEntityBeanInstance(final EntityBeanComponentInstance instance) { if (pool != null) { pool.release(instance); } else { factory.destroy(instance); } }
final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getAvailableCount()); final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getCreateCount()); final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getRemoveCount()); final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getCurrentSize()); final ModelNode result = context.getResult(); if (pool != null) { result.set(pool.getMaxSize());
@Override public void handleRollback(OperationContext context, ModelNode operation) { pool.setMaxSize(oldSize); } });
@Override public Object processInvocation(InterceptorContext context) throws Exception { PooledComponent<ComponentInstance> component = (PooledComponent<ComponentInstance>) getComponent(context, EJBComponent.class); ComponentInstance instance = component.getPool().get(); context.putPrivateData(ComponentInstance.class, instance); boolean discarded = false; component.getPool().discard(instance); component.getPool().discard(instance); throw e; } catch (final Throwable t) { discarded = true; component.getPool().discard(instance); throw new RuntimeException(t); } finally { if (!discarded) { component.getPool().release(instance);
protected void executeWriteAttribute(String attributeName, OperationContext context, ModelNode operation, T component, PathAddress address) throws OperationFailedException { if (componentType.hasPool() && POOL_MAX_SIZE.getName().equals(attributeName)) { int newSize = POOL_MAX_SIZE.resolveModelAttribute(context, operation).asInt(); final Pool<?> pool = componentType.getPool(component); final int oldSize = pool.getMaxSize(); componentType.getPool(component).setMaxSize(newSize); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { pool.setMaxSize(oldSize); } }); } else { // Bug; we were registered for an attribute but there is no code for handling it throw MESSAGES.unknownAttribute(attributeName); } }
@Override public void init() { if (endpoint == null) { throw EjbLogger.ROOT_LOGGER.endpointUnAvailable(this.getComponentName()); } super.init(); suspendController.registerActivity(serverActivity); if (this.pool != null) { this.pool.start(); } }
@Override public void start() { getShutDownInterceptorFactory().start(); super.start(); if(this.pool!=null){ this.pool.start(); } }
@Override public void start() { if (endpoint == null) { throw MESSAGES.endpointUnAvailable(this.getComponentName()); } getShutDownInterceptorFactory().start(); super.start(); ClassLoader oldTccl = SecurityActions.getContextClassLoader(); try { SecurityActions.setContextClassLoader(classLoader); this.endpoint.activate(endpointFactory, activationSpec); } catch (ResourceException e) { throw new RuntimeException(e); } finally { SecurityActions.setContextClassLoader(oldTccl); } if (this.pool != null) { this.pool.start(); } }