protected void enlist( JavaEETransactionManager tm, Transaction tran, ResourceHandle h ) throws PoolingException { try { tm.enlistResource( tran, h ); } catch( Exception e ) { PoolingException pe = new PoolingException( e.getMessage() ); pe.initCause( e ); throw pe; } }
private static ResourceGateway initializeCustomResourceGatewayInPrivilegedMode(final String className) throws PoolingException { Object result = AccessController.doPrivileged(new PrivilegedAction() { public Object run() { Object result = null; try { result = initializeCustomResourceGateway(className); } catch (Exception e) { _logger.log(Level.WARNING, "pool.resource.gateway.init.failure", className); _logger.log(Level.WARNING, "pool.resource.gateway.init.failure", e); } return result; } }); if (result != null) { return (ResourceGateway) result; } else { throw new PoolingException("Unable to initalize custom ResourceGateway : " + className); } }
/** * Reinitialize connections established in the connection pool and * bring the pool to steady pool size. * * @throws com.sun.appserv.connectors.internal.api.PoolingException */ public synchronized boolean flushConnectionPool() throws PoolingException { logFine("Flush Connection Pool entered"); if(!poolInitialized) { _logger.log(Level.WARNING, "poolmgr.flush_noop_pool_not_initialized", getPoolInfo()); throw new PoolingException("Flush Connection Pool failed for " + getPoolInfo() + ". Please see server.log for more details."); } try { killExtraResources(ds.getResourcesSize()); increaseSteadyPoolSize(steadyPoolSize); } catch(PoolingException ex) { _logger.log(Level.WARNING, "pool.flush_pool_failure", new Object[] {getPoolInfo(), ex.getMessage()}); throw ex; } logFine("Flush Connection Pool done"); return true; }
/** * Flush Connection pool by reinitializing the connections * established in the pool. * @param poolInfo * @throws com.sun.appserv.connectors.internal.api.ConnectorRuntimeException */ public boolean flushConnectionPool(PoolInfo poolInfo) throws ConnectorRuntimeException { PoolManager poolMgr = _runtime.getPoolManager(); try { return poolMgr.flushConnectionPool( poolInfo ); } catch (PoolingException ex) { throw new ConnectorRuntimeException(ex.getMessage()); } }
private static PoolWaitQueue initializeCustomWaitQueueInPrivilegedMode(final String className) throws PoolingException { Object result = AccessController.doPrivileged(new PrivilegedAction() { public Object run() { Object result = null; try { result = initializeCustomWaitQueue(className); } catch (Exception e) { _logger.log(Level.WARNING, "pool.waitqueue.init.failure", className); _logger.log(Level.WARNING, "pool.waitqueue.init.failure.exception", e); } return result; } }); if (result != null) { return (PoolWaitQueue) result; } else { throw new PoolingException("Unable to initalize custom PoolWaitQueue : " + className); } }
/** * Make sure that steady pool size is maintained after all idle-timed-out, * invalid and scale-down resource removals. */ private void ensureSteadyPool() { if (ds.getResourcesSize() < pool.getSteadyPoolSize()) { // Create resources to match the steady pool size for (int i = ds.getResourcesSize(); i < pool.getSteadyPoolSize(); i++) { try { handler.createResourceAndAddToPool(); } catch (PoolingException ex) { Object[] params = new Object[]{poolInfo, ex.getMessage()}; _logger.log(Level.WARNING, "resource_pool.resize_pool_error", params); } } } }
/** * {@inheritDoc} */ public int addResource(ResourceAllocator allocator, int count) throws PoolingException { int numResAdded = 0; writeLock.lock(); //for now, coarser lock. finer lock needs "resources.size() < maxSize()" once more. try { for (int i = 0; i < count && resources.size() < maxSize; i++) { ResourceHandle handle = handler.createResource(allocator); resources.add(handle); numResAdded++; } } catch (Exception e) { PoolingException pe = new PoolingException(e.getMessage()); pe.initCause(e); throw pe; } finally { writeLock.unlock(); } return numResAdded; }
private static DataStructure initializeCustomDataStructureInPrivilegedMode(final String className, final String parameters, final int maxPoolSize, final ResourceHandler handler, final String strategyClass) throws PoolingException { Object result = AccessController.doPrivileged(new PrivilegedAction() { public Object run() { Object result = null; try { result = initializeDataStructure(className, parameters, maxPoolSize, handler, strategyClass); } catch (Exception e) { _logger.log(Level.WARNING, "pool.datastructure.init.failure", className); _logger.log(Level.WARNING, "pool.datastructure.init.failure.exception", e); } return result; } }); if (result != null) { return (DataStructure) result; } else { throw new PoolingException("Unable to initalize custom DataStructure : " + className); } }
Object[] params = new Object[]{poolInfo, ex}; getLogger().log(Level.WARNING, "poolmgr.get_connection_failure", params); String i18nMsg = getLocalStrings().getString("con_mgr.error_creating_connection", ex.getMessage()); ResourceAllocationException rae = new ResourceAllocationException(i18nMsg); rae.initCause(ex);
PoolingException pe = new PoolingException(e.getMessage()); pe.initCause(e); throw pe;
public void cleanup(ResourceHandle h) throws PoolingException { try { ManagedConnection mc = (ManagedConnection) h.getResource(); mc.cleanup(); } catch (Exception ex) { _logger.log(Level.WARNING, "managed_con.cleanup-failed", ex); throw new PoolingException(ex.toString(), ex); } }
poolMgr.reconfigPoolProperties(ccp); } catch (PoolingException pe) { throw new ConnectorRuntimeException(pe.getMessage());
public ResourceHandle createResource(XAResource xaResource) throws PoolingException { ResourceHandle resourceHandle = null; ResourceSpec spec = new ResourceSpec(JMS_RESOURCE_FACTORY, ResourceSpec.JMS); if (xaResource != null) { logger.logp(Level.FINEST, "BasicResourceAllocator", "createResource", "NOT NULL", xaResource); try { resourceHandle = new ResourceHandle( null, //no object present spec, this, null); if (logger.isLoggable(Level.FINEST)) { xaResource = new XAResourceWrapper(xaResource); } resourceHandle.fillInResourceObjects(null, xaResource); } catch (Exception e) { throw (PoolingException) (new PoolingException()).initCause(e); } } else { logger.logp(Level.FINEST, "BasicResourceAllocator", "createResource", "NULL"); } return resourceHandle; }
/** * Returns the transaction component is participating. * * @return Handle to the <code>Transaction</code> object. * @exception <code>PoolingException<code> If exception is thrown * while getting the transaction. */ public Transaction getTransaction() throws PoolingException { try { return ConnectorRuntime.getRuntime().getTransaction(); } catch (Exception ex) { _logger.log(Level.SEVERE,"poolmgr.unexpected_exception",ex); throw new PoolingException(ex.toString(), ex); } }
throw(PoolingException) (new PoolingException().initCause(ex)); } catch (Exception ex) { throw(PoolingException) (new PoolingException().initCause(ex));
public void destroyResource(ResourceHandle resource) throws PoolingException { try { ManagedConnection mc = (ManagedConnection) resource.getResource(); mc.destroy(); } catch (Exception ex) { throw new PoolingException(ex); } }
} catch (ResourceException e) { putbackDirectToPool(handle, spec.getPoolInfo()); PoolingException pe = new PoolingException( e.getMessage()); pe.initCause(e); throw pe; logFine("rm.enlistResource threw Exception. Returning resource to pool"); throw new PoolingException(e);
public void closeUserConnection(ResourceHandle resource) throws PoolingException { try { ManagedConnection mc = (ManagedConnection) resource.getResource(); mc.cleanup(); } catch (ResourceException ex) { throw new PoolingException(ex); } }
/** * Flush Connection pool by reinitializing the connections * established in the pool. * @param poolInfo * @throws com.sun.appserv.connectors.internal.api.PoolingException */ public boolean flushConnectionPool(PoolInfo poolInfo) throws PoolingException { boolean result = false; ResourcePool pool = getPool( poolInfo ); if(pool != null) { result = pool.flushConnectionPool(); } else { _logger.log(Level.WARNING, "poolmgr.flush_noop_pool_not_initialized", poolInfo); throw new PoolingException("Flush Connection Pool for pool " + poolInfo + " failed. Please see server.log for more details."); } return result; }
public void fillInResourceObjects(ResourceHandle resource) throws PoolingException { try { ManagedConnection mc = (ManagedConnection) resource.getResource(); Object con = mc.getConnection(subject, reqInfo); resource.fillInResourceObjects(con, null); } catch (ResourceException ex) { throw new PoolingException(ex); } }