use of javax.resource.spi.ManagedConnection in project wildfly by wildfly.
the class HelloWorldManagedConnectionFactory method matchManagedConnections.
/**
* Returns a matched connection from the candidate set of connections.
*
* @param connectionSet candidate connection set
* @param subject Caller's security information
* @param cxRequestInfo Additional resource adapter specific connection request information
* @throws ResourceException generic exception
* @return ManagedConnection if resource adapter finds an acceptable match otherwise null
*/
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
ManagedConnection result = null;
Iterator it = connectionSet.iterator();
while (result == null && it.hasNext()) {
ManagedConnection mc = (ManagedConnection) it.next();
if (mc instanceof HelloWorldManagedConnection) {
HelloWorldManagedConnection hwmc = (HelloWorldManagedConnection) mc;
result = hwmc;
}
}
return result;
}
use of javax.resource.spi.ManagedConnection in project wildfly by wildfly.
the class MultipleManagedConnectionFactory2 method matchManagedConnections.
/**
* Returns a matched connection from the candidate set of connections.
*
* @param connectionSet Candidate connection set
* @param subject Caller's security information
* @param cxRequestInfo Additional resource adapter specific connection request information
* @return ManagedConnection if resource adapter finds an acceptable match otherwise null
* @throws ResourceException generic exception
*/
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
log.trace("matchManagedConnections()");
ManagedConnection result = null;
Iterator it = connectionSet.iterator();
while (result == null && it.hasNext()) {
ManagedConnection mc = (ManagedConnection) it.next();
if (mc instanceof MultipleManagedConnection2) {
result = mc;
}
}
return result;
}
use of javax.resource.spi.ManagedConnection in project wildfly by wildfly.
the class MultipleManagedConnectionFactory2 method matchManagedConnections.
/**
* Returns a matched connection from the candidate set of connections.
*
* @param connectionSet Candidate connection set
* @param subject Caller's security information
* @param cxRequestInfo Additional resource adapter specific connection request information
* @return ManagedConnection if resource adapter finds an acceptable match otherwise null
* @throws ResourceException generic exception
*/
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
log.trace("matchManagedConnections()");
ManagedConnection result = null;
Iterator it = connectionSet.iterator();
while (result == null && it.hasNext()) {
ManagedConnection mc = (ManagedConnection) it.next();
if (mc instanceof MultipleManagedConnection2) {
result = mc;
}
}
return result;
}
use of javax.resource.spi.ManagedConnection in project wildfly by wildfly.
the class LazyManagedConnectionFactory method matchManagedConnections.
@Override
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo connectionRequestInfo) throws ResourceException {
logger.trace("#LazyManagedConnectionFactory.matchManagedConnections");
ManagedConnection result = null;
Iterator it = connectionSet.iterator();
while (result == null && it.hasNext()) {
ManagedConnection mc = (ManagedConnection) it.next();
if (mc instanceof LazyManagedConnection) {
result = mc;
}
}
return result;
}
use of javax.resource.spi.ManagedConnection in project geode by apache.
the class JCAConnectionManagerImpl method connectionErrorOccurred.
/**
* CallBack for Connection Error.
*
* @param event ConnectionEvent
*/
public void connectionErrorOccurred(ConnectionEvent event) {
if (isActive) {
// If its an XAConnection
ManagedConnection conn = (ManagedConnection) event.getSource();
XAResource xar = (XAResource) xaResourcesMap.get(conn);
xaResourcesMap.remove(conn);
TransactionManagerImpl transManager = TransactionManagerImpl.getTransactionManager();
try {
Transaction txn = transManager.getTransaction();
if (txn != null && xar != null)
txn.delistResource(xar, XAResource.TMSUCCESS);
} catch (SystemException se) {
se.printStackTrace();
}
try {
mannPoolCache.expirePooledConnection(conn);
// mannPoolCache.destroyPooledConnection(conn);
} catch (Exception ex) {
String exception = "JCAConnectionManagerImpl::connectionErrorOccurred: Exception occurred due to " + ex;
if (logger.isDebugEnabled()) {
logger.debug(exception, ex);
}
}
}
}
Aggregations