/**
  * Close handle
  *
  * @param handle The handle
  */
 void closeHandle(StatisticsConnection handle) {
   ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   event.setConnectionHandle(handle);
   for (ConnectionEventListener cel : listeners) {
     cel.connectionClosed(event);
   }
 }
 /**
  * Close handle
  *
  * @param handle The handle
  */
 public void closeHandle(MultipleConnection2 handle) {
   ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   event.setConnectionHandle(handle);
   for (ConnectionEventListener cel : listeners) {
     cel.connectionClosed(event);
   }
 }
  /**
   * Close handle
   *
   * @param handle The handle
   */
  void closeHandle(TxLogConnection handle) {
    ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
    event.setConnectionHandle(handle);

    List<ConnectionEventListener> copy = new ArrayList<ConnectionEventListener>(listeners);
    for (ConnectionEventListener cel : copy) {
      cel.connectionClosed(event);
    }
  }
  /**
   * Error handle
   *
   * @param handle The handle
   * @param exception The exception
   */
  void errorHandle(TxLogConnection handle, Exception exception) {
    ConnectionEvent event =
        new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, exception);
    event.setConnectionHandle(handle);

    List<ConnectionEventListener> copy = new ArrayList<ConnectionEventListener>(listeners);
    for (ConnectionEventListener cel : copy) {
      cel.connectionErrorOccurred(event);
    }
  }
예제 #5
0
 public void fireConnectionEvent(int event) {
   ConnectionEvent connnectionEvent = new ConnectionEvent(this, event);
   connnectionEvent.setConnectionHandle(this.fileConnection);
   for (ConnectionEventListener listener : this.listeners) {
     switch (event) {
       case LOCAL_TRANSACTION_STARTED:
         listener.localTransactionStarted(connnectionEvent);
         break;
       case LOCAL_TRANSACTION_COMMITTED:
         listener.localTransactionCommitted(connnectionEvent);
         break;
       case LOCAL_TRANSACTION_ROLLEDBACK:
         listener.localTransactionRolledback(connnectionEvent);
         break;
       case CONNECTION_CLOSED:
         listener.connectionClosed(connnectionEvent);
         break;
       default:
         throw new IllegalArgumentException("Unknown event: " + event);
     }
   }
 }