javax.resource.spi.ConnectionEvent.getException()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中javax.resource.spi.ConnectionEvent.getException()方法的一些代码示例,展示了ConnectionEvent.getException()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConnectionEvent.getException()方法的具体详情如下:
包路径:javax.resource.spi.ConnectionEvent
类名称:ConnectionEvent
方法名:getException

ConnectionEvent.getException介绍

[英]Get the exception. May be null.
[中]获取异常。可能为空。

代码示例

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

public void connectionErrorOccurred(ConnectionEvent ce)
{
  if (state == NORMAL)
  {
   if (ce != null)
   {
     Throwable t = ce.getException();
     if (t == null)
      t = new Exception("No exception was reported");
     log.warn("Connection error occured: " + this, t);
   }
   else
   {
     Throwable t = new Exception("No exception was reported");
     log.warn("Unknown Connection error occured: " + this, t);
   }
  }
  try
  {
   unregisterConnections();
  }
  catch (Throwable t)
  {
   //ignore, it wasn't checked out.
  }
  if (ce != null && ce.getSource() != getManagedConnection())
   log.warn("Notified of error on a different managed connection?");
  returnManagedConnection(this, true);
}

代码示例来源:origin: org.firebirdsql.jdbc/jaybird-jdk17

/**
 * <code>javax.resource.spi.ConnectionEventListener</code> callback for 
 * when a Local Transaction was rolled back within the context of a
 * <code>ManagedConnection</code>.
 *
 * @param ce contains information about the connection 
 */
public void connectionErrorOccurred(ConnectionEvent ce) {
  if (log!=null) log.debug("ConnectionErrorOccurred, ", ce.getException());
  try {
    ((FBManagedConnection)ce.getSource()).destroy();
  }
  catch (ResourceException e) {
    if (log!=null) log.debug("further problems destroying connection: ", e);
  }
}

代码示例来源:origin: org.firebirdsql.jdbc/jaybird-jdk18

/**
 * <code>javax.resource.spi.ConnectionEventListener</code> callback for 
 * when a Local Transaction was rolled back within the context of a
 * <code>ManagedConnection</code>.
 *
 * @param ce contains information about the connection 
 */
public void connectionErrorOccurred(ConnectionEvent ce) {
  if (log!=null) log.debug("ConnectionErrorOccurred, ", ce.getException());
  try {
    ((FBManagedConnection)ce.getSource()).destroy();
  }
  catch (ResourceException e) {
    if (log!=null) log.debug("further problems destroying connection: ", e);
  }
}

代码示例来源:origin: org.apache.geronimo.components/geronimo-connector

public void connectionErrorOccurred(ConnectionEvent connectionEvent) {
  if (connectionEvent.getSource() != managedConnectionInfo.getManagedConnection()) {
    throw new IllegalArgumentException(
        "ConnectionError event received from wrong ManagedConnection. Expected "
        + managedConnectionInfo.getManagedConnection()
        + ", actual "
        + connectionEvent.getSource());
  }
  log.warn("connectionErrorOccurred called with " + connectionEvent.getConnectionHandle(), connectionEvent.getException());
  boolean errorOccurred = this.errorOccurred;
  this.errorOccurred = true;
  if (!errorOccurred) {
    ConnectionInfo ci = new ConnectionInfo(managedConnectionInfo);
    ci.setConnectionHandle(connectionEvent.getConnectionHandle());
    stack.returnConnection(ci, ConnectionReturnAction.DESTROY);
  }
}

代码示例来源:origin: org.jboss.ironjacamar/ironjacamar-core-impl

Exception cause = event.getException();
if (cause == null)

相关文章