/** * INTERNAL: * Release the read connection back into the read pool. */ public void releaseReadConnection(Accessor connection) { //if connection is using external connection pooling then the event has been risen right before it disconnected. if (!connection.usesExternalConnectionPooling()) { if (this.eventManager != null) { this.eventManager.preReleaseConnection(connection); } } this.readConnectionPool.releaseConnection(connection); }
/** * INTERNAL: * Release the read connection back into the read pool. */ public void releaseReadConnection(Accessor connection) { //if connection is using external connection pooling then the event has been risen right before it disconnected. if (!connection.usesExternalConnectionPooling()) { if (this.eventManager != null) { this.eventManager.preReleaseConnection(connection); } } this.readConnectionPool.releaseConnection(connection); }
/** * INTERNAL: * Return a read connection from the read pool. * Note that depending on the type of pool this may be a shared or exclusive connection. * Each query execution is assigned a read connection. */ public Accessor allocateReadConnection() { Accessor connection = this.readConnectionPool.acquireConnection(); //if connection is using external connection pooling then the event will be risen right after it connects. if (!connection.usesExternalConnectionPooling()) { if (this.eventManager != null) { this.eventManager.postAcquireConnection(connection); } } return connection; }
/** * INTERNAL: * Return a read connection from the read pool. * Note that depending on the type of pool this may be a shared or exclusive connection. * Each query execution is assigned a read connection. */ public Accessor allocateReadConnection() { Accessor connection = this.readConnectionPool.acquireConnection(); //if connection is using external connection pooling then the event will be risen right after it connects. if (!connection.usesExternalConnectionPooling()) { if (this.eventManager != null) { this.eventManager.postAcquireConnection(connection); } } return connection; }
/** * INTERNAL: * Release the read connection back into the read pool. */ public void releaseReadConnection(Accessor connection) { //if connection is using external connection pooling then the event has been risen right before it disconnected. if (!connection.usesExternalConnectionPooling()) { if (this.eventManager != null) { this.eventManager.preReleaseConnection(connection); } } getReadConnectionPool().releaseConnection(connection); }
/** * INTERNAL: * Return a read connection from the read pool. * Note that depending on the type of pool this may be a shared or exclusive connection. * Each query execution is assigned a read connection. */ public Accessor allocateReadConnection() { Accessor connection = getReadConnectionPool().acquireConnection(); //if connection is using external connection pooling then the event will be risen right after it connects. if (!connection.usesExternalConnectionPooling()) { if (this.eventManager != null) { this.eventManager.postAcquireConnection(connection); } } return connection; }
/** * INTERNAL: * Release any invalid connection in the client session. */ public void releaseInvalidClientSession(ClientSession clientSession) throws DatabaseException { for (Iterator<Accessor> accessors = clientSession.getWriteConnections().values().iterator(); accessors.hasNext(); ) { Accessor accessor = accessors.next(); if (!accessor.isValid()) { if (clientSession.getConnectionPolicy().isPooled()) { try { accessor.getPool().releaseConnection(accessor); } catch (Exception ignore) {} } else { if (!accessor.usesExternalConnectionPooling()) { clientSession.disconnect(accessor); } else { accessor.closeConnection(); } if (this.maxNumberOfNonPooledConnections != NO_MAX) { synchronized (this) { this.numberOfNonPooledConnectionsUsed--; notify(); } } } accessors.remove(); } } }
/** * INTERNAL: * Add the connection to the client session. * Multiple connections are supported to allow data partitioning and replication. * The accessor is returned, as if detected to be dead it may be replaced. */ public Accessor addWriteConnection(String poolName, Accessor writeConnection) { getWriteConnections().put(poolName, writeConnection); writeConnection.createCustomizer(this); //if connection is using external connection pooling then the event will be risen right after it connects. if (!writeConnection.usesExternalConnectionPooling()) { postAcquireConnection(writeConnection); } // Transactions are lazily started on connections. if (isInTransaction()) { basicBeginTransaction(writeConnection); } return getWriteConnections().get(poolName); }
} else { try { if (!accessor.usesExternalConnectionPooling()) { clientSession.disconnect(accessor); } else {
/** * INTERNAL: * Add the connection to the client session. * Multiple connections are supported to allow data partitioning and replication. * The accessor is returned, as if detected to be dead it may be replaced. */ public Accessor addWriteConnection(String poolName, Accessor writeConnection) { getWriteConnections().put(poolName, writeConnection); writeConnection.createCustomizer(this); //if connection is using external connection pooling then the event will be risen right after it connects. if (!writeConnection.usesExternalConnectionPooling()) { postAcquireConnection(writeConnection); } // Transactions are lazily started on connections. if (isInTransaction()) { basicBeginTransaction(writeConnection); } return getWriteConnections().get(poolName); }
for (Accessor accessor : clientSession.getWriteConnections().values()) { if(!accessor.usesExternalConnectionPooling()) { clientSession.preReleaseConnection(accessor); for (Accessor accessor : clientSession.getWriteConnections().values()) { if(!accessor.usesExternalConnectionPooling()) { clientSession.preReleaseConnection(accessor); try {
for (Accessor accessor : clientSession.getWriteConnections().values()) { if(!accessor.usesExternalConnectionPooling()) { clientSession.preReleaseConnection(accessor); for (Accessor accessor : clientSession.getWriteConnections().values()) { if(!accessor.usesExternalConnectionPooling()) { clientSession.preReleaseConnection(accessor); try {
/** * INTERNAL: * Release (if required) connection after call. * @param query */ public void releaseConnectionAfterCall(DatabaseQuery query) { RuntimeException exception = null; for (Accessor accessor : query.getAccessors()) { //if connection is using external connection pooling then the event has been risen right before it disconnected. try { if (!accessor.usesExternalConnectionPooling()) { preReleaseConnection(accessor); } accessor.getPool().releaseConnection(accessor); } catch (RuntimeException ex) { if (exception == null) { exception = ex; } } } query.setAccessors(null); if (exception != null) { throw exception; } }
/** * INTERNAL: * Release (if required) connection after call. * @param query */ public void releaseConnectionAfterCall(DatabaseQuery query) { RuntimeException exception = null; for (Accessor accessor : query.getAccessors()) { //if connection is using external connection pooling then the event has been risen right before it disconnected. try { if (!accessor.usesExternalConnectionPooling()) { preReleaseConnection(accessor); } accessor.getPool().releaseConnection(accessor); } catch (RuntimeException ex) { if (exception == null) { exception = ex; } } } query.setAccessors(null); if (exception != null) { throw exception; } }
getWriteConnections().remove(poolName); if (!writeConnection.usesExternalConnectionPooling()) { preReleaseConnection(writeConnection); writeConnection.createCustomizer(this); if (!writeConnection.usesExternalConnectionPooling()) { postAcquireConnection(writeConnection);
getWriteConnections().remove(poolName); if (!writeConnection.usesExternalConnectionPooling()) { preReleaseConnection(writeConnection); writeConnection.createCustomizer(this); if (!writeConnection.usesExternalConnectionPooling()) { postAcquireConnection(writeConnection);
clientSession.setWriteConnection(connection); if (!connection.usesExternalConnectionPooling()) { if (clientSession.hasEventManager()) { clientSession.getEventManager().postAcquireConnection(connection); if(!clientSession.getWriteConnection().usesExternalConnectionPooling()) { clientSession.connect(); clientSession.getEventManager().postAcquireConnection(clientSession.getWriteConnection());
for (Accessor accessor : accessors) { if (!accessor.usesExternalConnectionPooling()) { this.eventManager.postAcquireConnection(accessor);
ConnectionPool pool = (ConnectionPool)getConnectionPools().get(clientSession.getConnectionPolicy().getPoolName()); if (!clientSession.getWriteConnection().usesExternalConnectionPooling()) { if (clientSession.hasEventManager()) { clientSession.getEventManager().preReleaseConnection(clientSession.getWriteConnection()); } else { if(!clientSession.getWriteConnection().usesExternalConnectionPooling()) { clientSession.getEventManager().preReleaseConnection(clientSession.getWriteConnection()); if (clientSession.isExclusiveIsolatedClientSession()) {
for (Accessor accessor : accessors) { if (!accessor.usesExternalConnectionPooling()) { this.eventManager.postAcquireConnection(accessor);