Java Code Examples for javax.resource.spi.ConnectionEvent#setConnectionHandle()

The following examples show how to use javax.resource.spi.ConnectionEvent#setConnectionHandle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JCAManagedConnection.java    From gemfirexd-oss with Apache License 2.0 7 votes vote down vote up
public void onClose(GFConnectionImpl conn) throws ResourceException
{
  conn.invalidate();
  this.connections.remove(conn);
  synchronized (this.listeners) {
    Iterator<ConnectionEventListener> itr = this.listeners.iterator();
    ConnectionEvent ce = new ConnectionEvent(this,
        ConnectionEvent.CONNECTION_CLOSED);
    ce.setConnectionHandle(conn);
    while (itr.hasNext()) {
      itr.next().connectionClosed(ce);
    }
  }
  if (this.connections.isEmpty()) {
    // safe to dissociate this managedconnection so that it can go to pool
    if (this.initDone && !this.cache.isClosed()) {
      this.localTran = new JCALocalTransaction(this.cache, this.gfTxMgr);
    }
    else {
      this.localTran = new JCALocalTransaction();
    }
  }

}
 
Example 2
Source File: JCAManagedConnection.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
private void onError(Exception e)
{

  this.localTran = null;

  synchronized (this.connections) {
    Iterator<GFConnectionImpl> connsItr = this.connections.iterator();
    while (connsItr.hasNext()) {
      GFConnectionImpl conn = connsItr.next();
      conn.invalidate();
      synchronized (this.listeners) {
        Iterator<ConnectionEventListener> itr = this.listeners.iterator();
        ConnectionEvent ce = new ConnectionEvent(this,
            ConnectionEvent.CONNECTION_ERROR_OCCURRED, e);
        ce.setConnectionHandle(conn);
        while (itr.hasNext()) {
          itr.next().connectionErrorOccurred(ce);
        }
      }
      connsItr.remove();
    }
  }

}
 
Example 3
Source File: JCAManagedConnection.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public void onClose(GFConnectionImpl conn) throws ResourceException
{
  conn.invalidate();
  this.connections.remove(conn);
  synchronized (this.listeners) {
    Iterator<ConnectionEventListener> itr = this.listeners.iterator();
    ConnectionEvent ce = new ConnectionEvent(this,
        ConnectionEvent.CONNECTION_CLOSED);
    ce.setConnectionHandle(conn);
    while (itr.hasNext()) {
      itr.next().connectionClosed(ce);
    }
  }
  if (this.connections.isEmpty()) {
    // safe to dissociate this managedconnection so that it can go to pool
    if (this.initDone && !this.cache.isClosed()) {
      this.localTran = new JCALocalTransaction(this.cache, this.gfTxMgr);
    }
    else {
      this.localTran = new JCALocalTransaction();
    }
  }

}
 
Example 4
Source File: HelloWorldManagedConnectionImpl.java    From ci.maven with Apache License 2.0 5 votes vote down vote up
public void close() {

		Enumeration list = listeners.elements();
		ConnectionEvent event =
			new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
		event.setConnectionHandle(connection);
		while (list.hasMoreElements()) {
			((ConnectionEventListener) list.nextElement()).connectionClosed(event);
		}
	}
 
Example 5
Source File: HelloWorldManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Close handle
 * @param handle The handle
 */
void closeHandle(HelloWorldConnection handle)
{
   connections.remove((HelloWorldConnectionImpl)handle);

   ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   event.setConnectionHandle(handle);

   for (ConnectionEventListener cel : listeners)
   {
      cel.connectionClosed(event);
   }
}
 
Example 6
Source File: HelloWorldManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Close handle
 * @param handle The handle
 */
void closeHandle(HelloWorldConnection handle)
{
   connections.remove((HelloWorldConnectionImpl)handle);

   ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   event.setConnectionHandle(handle);

   for (ConnectionEventListener cel : listeners)
   {
      cel.connectionClosed(event);
   }
}
 
Example 7
Source File: HelloWorldManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Close handle
 * @param handle The handle
 */
void closeHandle(HelloWorldConnection handle)
{
   connections.remove((HelloWorldConnectionImpl)handle);

   ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   event.setConnectionHandle(handle);

   for (ConnectionEventListener cel : listeners)
   {
      cel.connectionClosed(event);
   }
}
 
Example 8
Source File: TestManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Close handle
 *
 * @param handle The handle
 */
void closeHandle(TestConnection handle)
{
   connections.remove((TestConnectionImpl)handle);
   ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   event.setConnectionHandle(handle);
   for (ConnectionEventListener cel : listeners)
   {
      cel.connectionClosed(event);
   }
}
 
Example 9
Source File: TxLogManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Error handle
 *
 * @param handle The handle
 * @param exception The exception
 */
void errorHandle(TxLogConnection handle, Exception exception)
{
   connections.remove((TxLogConnectionImpl)handle);

   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);
   }
}
 
Example 10
Source File: SampleManagedConnection.java    From tomee with Apache License 2.0 5 votes vote down vote up
void closeHandle(SampleConnection handle) {
    ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
    event.setConnectionHandle(handle);
    for (ConnectionEventListener cel : listeners) {
        cel.connectionClosed(event);
    }
}
 
Example 11
Source File: JcaExecutorServiceManagedConnection.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
void closeHandle(JcaExecutorServiceConnection handle) {
  ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
  event.setConnectionHandle(handle);
  for (ConnectionEventListener cel : listeners) {
    cel.connectionClosed(event);
  }

}
 
Example 12
Source File: PerfManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Close handle
 */
void closeHandle()
{
   ConnectionEvent closeEvent = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   closeEvent.setConnectionHandle(connection);

   List<ConnectionEventListener> copy = new ArrayList<ConnectionEventListener>(listeners);
   for (ConnectionEventListener cel : copy)
   {
      cel.connectionClosed(closeEvent);
   }
}
 
Example 13
Source File: LazyManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Close handle
 *
 * @param handle The handle
 */
void closeHandle(LazyConnection handle)
{
   ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   event.setConnectionHandle(handle);
   for (ConnectionEventListener cel : listeners)
   {
      cel.connectionClosed(event);
   }
}
 
Example 14
Source File: WorkManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Close handle
 *
 * @param handle The handle
 */
void closeHandle(WorkConnection handle)
{
   ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
   event.setConnectionHandle(handle);
   for (ConnectionEventListener cel : listeners)
   {
      cel.connectionClosed(event);
   }

}
 
Example 15
Source File: UnifiedSecurityManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Error handle
 *
 * @param handle The handle
 * @param exception The exception
 */
void errorHandle(UnifiedSecurityConnection handle, Exception exception)
{
   connectionSet.remove(handle);

   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);
   }
}
 
Example 16
Source File: UnifiedSecurityManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Close handle
 *
 * @param handle The handle
 */
void closeHandle(UnifiedSecurityConnection handle)
{
   connectionSet.remove(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);
   }

}
 
Example 17
Source File: AbstractManagedConnectionImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void close(Object closingHandle) throws ResourceException {
    LOG.fine("Closing handle: " + closingHandle);

    ConnectionEvent coEvent = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
    coEvent.setConnectionHandle(closingHandle);
    sendEvent(coEvent);
}
 
Example 18
Source File: ManagedConnectionImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Object handleCloseMethod(Object proxy, Method method,
        Object[] args) {

    handles.remove(proxy);
    associatedHandle = null;
    ConnectionEvent event = new ConnectionEvent(ManagedConnectionImpl.this,
            ConnectionEvent.CONNECTION_CLOSED);
    event.setConnectionHandle(proxy);
    sendEvent(event);

    return null;
}
 
Example 19
Source File: ManagedTransactionAssistance.java    From genericconnector with Apache License 2.0 5 votes vote down vote up
public void close(TransactionAssistant handle) {
    ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
    event.setConnectionHandle(handle);
    for(ConnectionEventListener l : listeners){
        l.connectionClosed(event);
    }
}
 
Example 20
Source File: AutoConnectionTrackerTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
void closeHandle(final FakeConnection handle) {
    final ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
    event.setConnectionHandle(handle);
    for (ConnectionEventListener cel : listeners) {
        cel.connectionClosed(event);
    }
}