use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class UnpooledResource method getUnenlistedResource.
@Override
protected ResourceHandle getUnenlistedResource(ResourceSpec spec, ResourceAllocator alloc, Transaction tran) throws PoolingException {
ResourceHandle handle = null;
if (incrementPoolSize()) {
try {
handle = createSingleResource(alloc);
} catch (PoolingException ex) {
decrementPoolSize();
throw ex;
}
ResourceState state = new ResourceState();
handle.setResourceState(state);
state.setEnlisted(false);
setResourceStateToBusy(handle);
return handle;
}
String msg = localStrings.getStringWithDefault("poolmgr.max.pool.size.reached", "In-use connections equal max-pool-size therefore cannot allocate any more connections.");
throw new PoolingException(msg);
}
use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class DataStructureFactory method initializeCustomDataStructureInPrivilegedMode.
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);
}
}
use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class SystemResourceManagerImpl method enlistResource.
/**
* Register the <code>ResourceHandle</code> in the transaction
*
* @param handle <code>ResourceHandle</code> object
* @exception <code>PoolingException</code> If there is any error while
* enlisting.
*/
public void enlistResource(ResourceHandle handle) throws PoolingException {
try {
JavaEETransactionManager tm = ConnectorRuntime.getRuntime().getTransactionManager();
Transaction tran = tm.getTransaction();
if (tran != null) {
tm.enlistResource(tran, handle);
}
} catch (Exception ex) {
_logger.log(Level.SEVERE, "poolmgr.unexpected_exception", ex);
throw new PoolingException(ex.toString(), ex);
}
}
use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class ConnectorAllocator method destroyResource.
public void destroyResource(ResourceHandle resource) throws PoolingException {
try {
closeUserConnection(resource);
} catch (Exception ex) {
// ignore error
}
try {
ManagedConnection mc = (ManagedConnection) resource.getResource();
mc.destroy();
} catch (Exception ex) {
throw new PoolingException(ex);
}
}
use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class ConnectorAllocator method createResource.
public ResourceHandle createResource() throws PoolingException {
try {
ManagedConnection mc = mcf.createManagedConnection(subject, reqInfo);
ResourceHandle resource = createResourceHandle(mc, spec, this, info);
ConnectionEventListener l = new ConnectionListenerImpl(resource);
mc.addConnectionEventListener(l);
return resource;
} catch (ResourceException ex) {
Object[] params = new Object[] { spec.getPoolInfo(), ex.toString() };
_logger.log(Level.WARNING, "poolmgr.create_resource_error", params);
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Resource Exception while creating resource", ex);
}
if (ex.getLinkedException() != null) {
_logger.log(Level.WARNING, "poolmgr.create_resource_linked_error", ex.getLinkedException().toString());
}
throw new PoolingException(ex);
}
}
Aggregations