* For a client session the accessor is stored for the duration of the transaction.
*/
public Accessor getAccessor(String poolName, AbstractSession session, DatabaseQuery query, boolean returnNullIfDead) {
Accessor accessor = null;
if (session.isClientSession()) {
ClientSession client = (ClientSession)session;
// If the client session is exclusive and has a connection then just use the existing connection.
if (client.isExclusiveIsolatedClientSession() && client.hasWriteConnection()) {
accessor = client.getWriteConnection();
} else {
accessor = client.getWriteConnections().get(poolName);
if (accessor == null) {
accessor = acquireAccessor(poolName, client.getParent(), query, returnNullIfDead);
// Assign a write connection for the duration of the transaction.
if (client.isExclusiveIsolatedClientSession() || session.isInTransaction()) {
accessor = client.addWriteConnection(poolName, accessor);
}
}
}
} else if (session.isServerSession()) {
accessor = acquireAccessor(poolName, (ServerSession)session, query, returnNullIfDead);