Refine search
void closeHandle(JcaExecutorServiceConnection handle) { ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED); event.setConnectionHandle(handle); for (ConnectionEventListener cel : listeners) { cel.connectionClosed(event); } } public PrintWriter getLogWriter() throws ResourceException {
/** * Callback for Connection Closed. * * @param event ConnectionEvent Object. */ @Override public void connectionClosed(ConnectionEvent event) { if (isActive) { ManagedConnection conn = (ManagedConnection) event.getSource(); XAResource xar = null; if (xaResourcesMap.get(conn) != null) xar = (XAResource) xaResourcesMap.get(conn); xaResourcesMap.remove(conn); try { Transaction txn = transManager.getTransaction(); if (txn != null && xar != null) { txn.delistResource(xar, XAResource.TMSUCCESS); } } catch (Exception se) { String exception = "JCAConnectionManagerImpl::connectionClosed: Exception occurred due to " + se; if (logger.isDebugEnabled()) { logger.debug(exception, se); } } mannPoolCache.returnPooledConnectionToPool(conn); } }
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); } }
public void fireConnectionEvent(int event) { ConnectionEvent connnectionEvent = new ConnectionEvent(this, event); connnectionEvent.setConnectionHandle(this.executorConnection); 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); } } }
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; } }
void notifyTxRollback(PersistenceManagerImpl handle) { ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK, null); ce.setConnectionHandle(handle); Collection localCels = null; synchronized (cels) { localCels = new ArrayList(cels); } for (Iterator i = localCels.iterator(); i.hasNext(); ) { ((ConnectionEventListener)i.next()).localTransactionRolledback(ce); } }
void notifyTxCommit(PersistenceManagerImpl handle) { ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED, null); ce.setConnectionHandle(handle); Collection localCels = null; synchronized (cels) { localCels = new ArrayList(cels); } for (Iterator i = localCels.iterator(); i.hasNext(); ) { ((ConnectionEventListener)i.next()).localTransactionCommitted(ce); } }
void notifyTxBegin(PersistenceManagerImpl handle) { ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_STARTED, null); ce.setConnectionHandle(handle); Collection localCels = null; synchronized (cels) { localCels = new ArrayList(cels); } for (Iterator i = localCels.iterator(); i.hasNext(); ) { ((ConnectionEventListener)i.next()).localTransactionStarted(ce); } }
/** * When closed, the item is not put into the idle pool. */ void killPool() { if (_listener != null) { ConnectionEvent event; event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED); _listener.connectionErrorOccurred(event); } }
protected void localTransactionRollback(boolean isSPI) throws ResourceException { if (!isSPI) { ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK); for (int i = 0; i < listeners.size(); i++) { ConnectionEventListener listener = listeners.get(i); listener.localTransactionRolledback(event); } } }
protected void localTransactionStart(boolean isSPI) throws ResourceException { if (!isSPI) { ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_STARTED); for (int i = listeners.size() - 1; i >= 0; i--) { ConnectionEventListener listener = listeners.get(i); listener.localTransactionStarted(event); } } }
protected void localTransactionCommit(boolean isSPI) throws ResourceException { if (!isSPI) { ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED); for (int i = listeners.size() - 1; i >= 0; i--) { ConnectionEventListener listener = listeners.get(i); listener.localTransactionCommitted(event); } } }
public void error(Exception ex) { LOG.warning(ex.toString()); sendEvent(new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, ex)); } }
/** * Resource adapters will signal that the connection being closed is bad. * @param evt ConnectionEvent */ public void badConnectionClosed(ConnectionEvent evt){ Object connectionHandle = evt.getConnectionHandle(); ResourceHandle handle = resource; if (associatedHandles.containsKey(connectionHandle)) { handle = (ResourceHandle) associatedHandles.get(connectionHandle); } ManagedConnection mc = (ManagedConnection) evt.getSource(); mc.removeConnectionEventListener(this); poolMgr.badResourceClosed(handle); }
/** * <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); } }
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); } }
public void connectionClosed(ConnectionEvent evt) { Object connectionHandle = evt.getConnectionHandle(); ResourceHandle handle = resource; if (associatedHandles.containsKey(connectionHandle)) { handle = (ResourceHandle) associatedHandles.get(connectionHandle); } poolMgr.resourceClosed(handle); }
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}); } }
public void fireConnectionEvent(int event) { ConnectionEvent connnectionEvent = new ConnectionEvent(this, event); connnectionEvent.setConnectionHandle(this.remoteConnection); 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); } } }
public FBLocalTransaction(FBManagedConnection mc, FBConnection c) { this.mc = mc; if (c == null) { beginEvent = null; commitEvent = null; rollbackEvent = null; } else { beginEvent = new ConnectionEvent(mc, ConnectionEvent.LOCAL_TRANSACTION_STARTED, null); beginEvent.setConnectionHandle(c); commitEvent = new ConnectionEvent(mc, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED, null); commitEvent.setConnectionHandle(c); rollbackEvent = new ConnectionEvent(mc, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK, null); rollbackEvent.setConnectionHandle(c); } }