@Override protected void onExceptionHook(final String objectName, final CMIReferenceable<T> cmiReferenceable) throws Exception { try { clusterViewManager.getPool(objectName).discard(cmiReferenceable); } catch (Exception e) { logger.debug("Cannot discard the reference {0}", cmiReferenceable, e); } }
@Override protected void onExceptionHook(final String objectName, final CMIReferenceable<T> cmiReferenceable) throws Exception { try { clusterViewManager.getPool(objectName).discard(cmiReferenceable); } catch (Exception e) { LOGGER.debug("Cannot discard the reference {0}", cmiReferenceable, e); } }
throws Throwable { try { clusterViewManager.getPool(objectName).discard(cmiReferenceable); } catch (Exception e) { logger.debug("Cannot discard the reference {0}", cmiReferenceable, e);
/** * Remove from the factory's pool the bean found in the current invocation * context. * @param invocationContext the context of the current invocation * @throws PoolException if removal is failing */ @SuppressWarnings("unchecked") protected void discard(final EasyBeansInvocationContext invocationContext) throws PoolException { Object target = invocationContext.getTarget(); // factory is a stateful factory ? if (target instanceof EasyBeansSFSB) { // Gets the factory Factory factory = invocationContext.getFactory(); // get pool Pool<EasyBeansSFSB, Long> pool = factory.getPool(); // Bean is a stateful bean EasyBeansSFSB bean = (EasyBeansSFSB) invocationContext.getTarget(); // discard instance pool.discard(bean); } else { this.logger.debug("Instance not discarded as it is not a stateful bean"); } }
pool.discard(this.statefulBean); } catch (PoolException pe) { throw new EJBException("Unable to discard the instance", pe);