use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class AbstractConnectorAllocator method cleanup.
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);
}
}
use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class LocalTxConnectorAllocator method createResource.
public ResourceHandle createResource() throws PoolingException {
try {
ManagedConnection mc = mcf.createManagedConnection(subject, reqInfo);
ResourceHandle resource = createResourceHandle(mc, spec, this, info);
ConnectionEventListener l = new LocalTxConnectionEventListener(resource);
mc.addConnectionEventListener(l);
resource.setListener(l);
XAResource xares = new ConnectorXAResource(resource, spec, this, info);
resource.fillInResourceObjects(null, xares);
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);
}
}
use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class LocalTxConnectorAllocator method destroyResource.
public void destroyResource(ResourceHandle resource) throws PoolingException {
try {
ManagedConnection mc = (ManagedConnection) resource.getResource();
ConnectorXAResource.freeListener(mc);
XAResource xares = resource.getXAResource();
forceTransactionCompletion(xares);
mc.destroy();
if (_logger.isLoggable(Level.FINEST)) {
_logger.finest("destroyResource for LocalTxConnectorAllocator done");
}
} catch (Exception ex) {
throw new PoolingException(ex);
}
}
use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class LocalTxConnectorAllocator method fillInResourceObjects.
public void fillInResourceObjects(ResourceHandle resource) throws PoolingException {
try {
ManagedConnection mc = (ManagedConnection) resource.getResource();
Object con = mc.getConnection(subject, reqInfo);
ConnectorXAResource xares = (ConnectorXAResource) resource.getXAResource();
xares.setUserHandle(con);
resource.fillInResourceObjects(con, xares);
} catch (ResourceException ex) {
throw new PoolingException(ex);
}
}
use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.
the class ListDataStructure method addResource.
/**
* creates a new resource and adds to the datastructure.
*
* @param allocator ResourceAllocator
* @param count Number (units) of resources to create
* @return int number of resources added
*/
public int addResource(ResourceAllocator allocator, int count) throws PoolingException {
int numResAdded = 0;
for (int i = 0; i < count && resources.size() < maxSize; i++) {
boolean lockAcquired = dynSemaphore.tryAcquire();
if (lockAcquired) {
try {
ResourceHandle handle = handler.createResource(allocator);
synchronized (resources) {
synchronized (free) {
free.add(handle);
resources.add(handle);
numResAdded++;
}
}
} catch (Exception e) {
dynSemaphore.release();
PoolingException pe = new PoolingException(e.getMessage());
pe.initCause(e);
throw pe;
}
}
}
return numResAdded;
}
Aggregations