本文整理汇总了Java中javax.resource.spi.ConnectionEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectionEvent.getSource方法的具体用法?Java ConnectionEvent.getSource怎么用?Java ConnectionEvent.getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.resource.spi.ConnectionEvent
的用法示例。
在下文中一共展示了ConnectionEvent.getSource方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connectionClosed
import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
/**
* Callback for Connection Closed.
*
* @param event ConnectionEvent Object.
*/
public void connectionClosed(ConnectionEvent event) {
if (isActive) {
ManagedConnection conn = (ManagedConnection) event.getSource();
TransactionManagerImpl transManager = TransactionManagerImpl.getTransactionManager();
try {
Transaction txn = transManager.getTransaction();
if (txn == null) {
mannPoolCache.returnPooledConnectionToPool(conn);
}
} catch (Exception se) {
String exception =
"FacetsJCAConnectionManagerImpl::connectionClosed: Exception occured due to "
+ se.getMessage();
if (logger.isDebugEnabled()) {
logger.debug(exception, se);
}
}
}
}
示例2: connectionClosed
import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
/**
* Callback for Connection Closed.
*
* @param event ConnectionEvent Object.
*/
public void connectionClosed(ConnectionEvent event) {
if (isActive) {
ManagedConnection conn = (ManagedConnection) event.getSource();
XAResource xar = null;
if (xaResourcesMap.get(conn) != null)
xar = (XAResource) xaResourcesMap.get(conn);
xaResourcesMap.remove(conn);
try {
Transaction txn = transManager.getTransaction();
if (txn != null && xar != null) {
txn.delistResource(xar, XAResource.TMSUCCESS);
}
}
catch (Exception se) {
String exception = "JCAConnectionManagerImpl::connectionClosed: Exception occured due to "
+ se;
LogWriterI18n writer = TransactionUtils.getLogWriterI18n();
if (writer.fineEnabled()) writer.fine(exception, se);
}
mannPoolCache.returnPooledConnectionToPool(conn);
}
}
示例3: connectionClosed
import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
/**
* Callback for Connection Closed.
*
* @param event ConnectionEvent Object.
*/
public void connectionClosed(ConnectionEvent event) {
if (isActive) {
ManagedConnection conn = (ManagedConnection) event.getSource();
TransactionManagerImpl transManager = TransactionManagerImpl
.getTransactionManager();
try {
Transaction txn = transManager.getTransaction();
if (txn == null) {
mannPoolCache.returnPooledConnectionToPool(conn);
}
}
catch (Exception se) {
String exception = "FacetsJCAConnectionManagerImpl::connectionClosed: Exception occured due to "
+ se;
LogWriterI18n writer = TransactionUtils.getLogWriterI18n();
if (writer.fineEnabled()) writer.fine(exception, se);
}
}
}
示例4: connectionErrorOccurred
import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
/**
* 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::connectionErrorOccured: Exception occured due to " + ex;
if (logger.isDebugEnabled()) {
logger.debug(exception, ex);
}
}
}
}
示例5: connectionErrorOccurred
import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
/**
* 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);
((List) xalistThreadLocal.get()).remove(conn);
TransactionManagerImpl transManager = TransactionManagerImpl.getTransactionManager();
try {
Transaction txn = transManager.getTransaction();
if (txn == null) {
mannPoolCache.returnPooledConnectionToPool(conn);
} else {
// do nothing.
}
} catch (Exception se) {
se.printStackTrace();
}
try {
mannPoolCache.expirePooledConnection(conn);
// mannPoolCache.destroyPooledConnection(conn);
} catch (Exception ex) {
String exception =
"FacetsJCAConnectionManagerImpl::connectionErrorOccured: Exception occured due to "
+ ex.getMessage();
if (logger.isDebugEnabled()) {
logger.debug(exception, ex);
}
}
}
}
示例6: connectionErrorOccurred
import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
/**
* 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::connectionErrorOccured: Exception occured due to "
+ ex;
LogWriterI18n writer = TransactionUtils.getLogWriterI18n();
if (writer.fineEnabled()) writer.fine(exception, ex);
}
}
}
示例7: connectionErrorOccurred
import javax.resource.spi.ConnectionEvent; //导入方法依赖的package包/类
/**
* 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);
((List) xalistThreadLocal.get()).remove(conn);
TransactionManagerImpl transManager = TransactionManagerImpl
.getTransactionManager();
try {
Transaction txn = transManager.getTransaction();
if (txn == null) {
mannPoolCache.returnPooledConnectionToPool(conn);
}
else {
// do nothing.
}
}
catch (Exception se) {
se.printStackTrace();
}
try {
mannPoolCache.expirePooledConnection(conn);
//mannPoolCache.destroyPooledConnection(conn);
}
catch (Exception ex) {
String exception = "FacetsJCAConnectionManagerImpl::connectionErrorOccured: Exception occured due to "
+ ex;
LogWriterI18n writer = TransactionUtils.getLogWriterI18n();
if (writer.fineEnabled()) writer.fine(exception, ex);
}
}
}