/**
  * 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);
   }
 }
Ejemplo n.º 3
0
  /**
   * 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);
    }
  }
Ejemplo n.º 4
0
  /**
   * 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);
    }
  }
Ejemplo n.º 5
0
  /** {@inheritDoc} */
  public void rollback() throws ResourceException {
    log.trace("rollback()");

    txState.append(TX_LOCAL_ROLLBACK);

    ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);

    for (ConnectionEventListener cel : listeners) {
      cel.localTransactionRolledback(ce);
    }
  }
Ejemplo n.º 6
0
  /** {@inheritDoc} */
  public void commit() throws ResourceException {
    log.trace("commit()");

    txState.append(TX_LOCAL_COMMIT);

    ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);

    for (ConnectionEventListener cel : listeners) {
      cel.localTransactionCommitted(ce);
    }
  }
Ejemplo n.º 7
0
  /** {@inheritDoc} */
  public void begin() throws ResourceException {
    log.trace("begin()");

    txState.append(TX_LOCAL_BEGIN);

    ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_STARTED);

    for (ConnectionEventListener cel : listeners) {
      cel.localTransactionStarted(ce);
    }
  }
Ejemplo n.º 8
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);
     }
   }
 }