Accessor accessor = clientSession.getLogin().buildAccessor(); clientSession.connect(accessor); clientSession.addWriteConnection(ServerSession.NOT_POOLED, accessor);
/** * INTERNAL: * Allocate the client's connection resource. */ public void acquireClientConnection(ClientSession clientSession) throws DatabaseException, ConcurrencyException { if (clientSession.getConnectionPolicy().isPooled()) { ConnectionPool pool = this.connectionPools.get(clientSession.getConnectionPolicy().getPoolName()); Accessor accessor = pool.acquireConnection(); clientSession.addWriteConnection(pool.getName(), accessor); } else { if (this.maxNumberOfNonPooledConnections != NO_MAX) { synchronized (this) { while (this.numberOfNonPooledConnectionsUsed >= this.maxNumberOfNonPooledConnections) { try { wait();// Notify is called when connections are released. } catch (InterruptedException exception) { throw ConcurrencyException.waitFailureOnServerSession(exception); } } this.numberOfNonPooledConnectionsUsed++; } } Accessor accessor = clientSession.getLogin().buildAccessor(); clientSession.connect(accessor); clientSession.addWriteConnection(ServerSession.NOT_POOLED, accessor); } }
clientSession.setWriteConnection(clientSession.getLogin().buildAccessor());