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

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

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

ConnectionEvent.getId介绍

[英]Get the type of event
[中]获取事件的类型

代码示例

代码示例来源:origin: apache/cxf

private void sendEventToListener(ConnectionEventListener listener,
    ConnectionEvent coEvent) {
  if (coEvent.getId() == ConnectionEvent.CONNECTION_CLOSED) {
    listener.connectionClosed(coEvent);
  }
  if (coEvent.getId() == ConnectionEvent.LOCAL_TRANSACTION_COMMITTED) {
    listener.localTransactionCommitted(coEvent);
  }
  if (coEvent.getId() == ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK) {
    listener.localTransactionRolledback(coEvent);
  }
  if (coEvent.getId() == ConnectionEvent.LOCAL_TRANSACTION_STARTED) {
    listener.localTransactionStarted(coEvent);
  }
  if (coEvent.getId() == ConnectionEvent.CONNECTION_ERROR_OCCURRED) {
    listener.connectionErrorOccurred(coEvent);
  }
}

代码示例来源:origin: apache/cxf

protected void sendEventToListener(ConnectionEvent coEvent, ConnectionEventListener listener) {
  if (coEvent.getId() == ConnectionEvent.CONNECTION_CLOSED) {
    listener.connectionClosed(coEvent);
    LOG.log(Level.FINE, "CONNECTION_CLOSED_EVENT_FIRED", new Object[] {listener});
  }
  if (coEvent.getId() == ConnectionEvent.LOCAL_TRANSACTION_COMMITTED) {
    listener.localTransactionCommitted(coEvent);
    LOG.log(Level.FINE, "LOCAL_TX_COMMITTED_EVENT_FIRED", new Object[] {listener});
  }
  if (coEvent.getId() == ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK) {
    listener.localTransactionRolledback(coEvent);
    LOG.log(Level.FINE, "LOCAL_TX_ROLLEDBACK_EVENT_FIRED", new Object[] {listener});
  }
  if (coEvent.getId() == ConnectionEvent.LOCAL_TRANSACTION_STARTED) {
    listener.localTransactionStarted(coEvent);
    LOG.log(Level.FINE, "LOCAL_TX_STARTED_EVENT_FIRED", new Object[] {listener});
  }
  if (coEvent.getId() == ConnectionEvent.CONNECTION_ERROR_OCCURRED) {
    listener.connectionErrorOccurred(coEvent);
    LOG.log(Level.FINE, "CTX_ERROR_OCURRED_EVENT_FIRED", new Object[] {listener});
  }
}

代码示例来源:origin: net.sf.tsl2nano/tsl2.nano.serviceaccess

/**
 * Fire an event.
 * 
 * @param event the event
 */
protected void fireConnectionEvent(ConnectionEvent event) {
  for (final ConnectionEventListener l : listeners) {
    switch (event.getId()) {
    case ConnectionEvent.CONNECTION_CLOSED:
      l.connectionClosed(event);
      break;
    case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
      l.connectionErrorOccurred(event);
      break;
    case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
      l.localTransactionCommitted(event);
      break;
    case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
      l.localTransactionRolledback(event);
      break;
    case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
      l.localTransactionStarted(event);
      break;
    default:
      LOG.error("unknown event id=" + event.getId());
    }
  }
}

代码示例来源:origin: org.apache.qpid/qpid-jca

int type = event.getId();

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jca

/**
 * Send event.
 */
private void sendEvent(ConnectionEvent event) {
  synchronized (listeners) {
    for (Iterator<ConnectionEventListener> i = listeners.iterator(); i.hasNext();) {
      ConnectionEventListener listener = i.next();
      switch (event.getId()) {
        case ConnectionEvent.CONNECTION_CLOSED:
          listener.connectionClosed(event);
          break;
        case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
          listener.connectionErrorOccurred(event);
          break;
        case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
          listener.localTransactionCommitted(event);
          break;
        case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
          listener.localTransactionRolledback(event);
          break;
        case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
          listener.localTransactionStarted(event);
          break;
        default:
          // Unknown event, skip
      }
    }
  }
}

代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar

int type = event.getId();

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

int type = event.getId();

代码示例来源:origin: apache/jackrabbit

/**
 * Send event.
 */
private void sendEvent(ConnectionEvent event) {
  synchronized (listeners) {
    for (Iterator<ConnectionEventListener> i = listeners.iterator(); i.hasNext();) {
      ConnectionEventListener listener = i.next();
      switch (event.getId()) {
        case ConnectionEvent.CONNECTION_CLOSED:
          listener.connectionClosed(event);
          break;
        case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
          listener.connectionErrorOccurred(event);
          break;
        case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
          listener.localTransactionCommitted(event);
          break;
        case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
          listener.localTransactionRolledback(event);
          break;
        case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
          listener.localTransactionStarted(event);
          break;
        default:
          // Unknown event, skip
      }
    }
  }
}

代码示例来源:origin: apache/activemq-artemis

int type = event.getId();

代码示例来源:origin: org.apache.activemq/artemis-ra

int type = event.getId();

代码示例来源:origin: net.java.xadisk/xadisk

private void raiseConnectionEvent(ConnectionEvent ce) {
  invalidateCache();
  for (ConnectionEventListener cel : listeners) {
    switch (ce.getId()) {
      case ConnectionEvent.CONNECTION_CLOSED:
        cel.connectionClosed(ce);
        break;
      case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
        cel.connectionErrorOccurred(ce);
        break;
      case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
        cel.localTransactionStarted(ce);
        break;
      case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
        cel.localTransactionCommitted(ce);
        break;
      case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
        cel.localTransactionRolledback(ce);
        break;
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-storage-sql

/**
 * Notifies the application server, through the {@link ConnectionEventListener}s it has registered with us, of what
 * happens with this connection.
 */
private void sendEvent(ConnectionEvent event) {
  for (Object object : listeners.getListeners()) {
    ConnectionEventListener listener = (ConnectionEventListener) object;
    switch (event.getId()) {
    case ConnectionEvent.CONNECTION_CLOSED:
      listener.connectionClosed(event);
      break;
    case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
      listener.localTransactionStarted(event);
      break;
    case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
      listener.localTransactionCommitted(event);
      break;
    case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
      listener.localTransactionRolledback(event);
      break;
    case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
      listener.connectionErrorOccurred(event);
      break;
    }
  }
}

相关文章