use of org.eclipse.persistence.sessions.server.ConnectionPool in project eclipselink by eclipse-ee4j.
the class Server method login.
public void login() {
this.serverSession.login();
ConnectionPool cp = this.serverSession.getConnectionPool("default");
try {
// close off one of the connections. This part of the test sees if our reconnect on the fly works.
cp.getConnectionsAvailable().get(0).getConnection().close();
} catch (java.sql.SQLException e) {
e.printStackTrace(System.out);
}
}
use of org.eclipse.persistence.sessions.server.ConnectionPool in project eclipselink by eclipse-ee4j.
the class Server1 method login.
public void login() {
this.serverSession.login();
ConnectionPool cp = this.serverSession.getConnectionPool("default");
try {
// close off one of the connections. This part of the test sees if our reconnect on the fly works.
cp.getConnectionsAvailable().get(0).getConnection().close();
} catch (java.sql.SQLException e) {
e.printStackTrace(System.out);
}
}
use of org.eclipse.persistence.sessions.server.ConnectionPool in project eclipselink by eclipse-ee4j.
the class ClientServerTest method verify.
@Override
public void verify() {
try {
int counter = 0;
ConnectionPool pool = server.serverSession.getConnectionPools().get("default");
List<Accessor> connections = pool.getConnectionsAvailable();
for (Iterator<Accessor> iterator = connections.iterator(); iterator.hasNext(); ) {
if (iterator.next().isConnected()) {
counter = counter + 1;
}
}
if (counter < minimumConnections) {
throw new TestErrorException("too many connections are disconnected!!");
}
if (counter > minimumConnections) {
throw new TestErrorException("not enough connections are disconected!!");
}
if (connections.size() < minimumConnections) {
throw new TestErrorException("too many connections are released!!");
}
if (connections.size() > minimumConnections) {
throw new TestErrorException("not enough connections are released!!");
}
} catch (Exception ex) {
if ((ex instanceof ValidationException) && (((ValidationException) ex).getErrorCode() == 7090)) {
}
}
}
use of org.eclipse.persistence.sessions.server.ConnectionPool in project eclipselink by eclipse-ee4j.
the class RuntimeServices method getAvailableConnectionPools.
/**
* This method will return the available Connection pools within this Server Session
* @return java.util.List the available pools.
*/
public List getAvailableConnectionPools() {
Vector list = null;
if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
Map<String, ConnectionPool> pools = ((ServerSession) getSession()).getConnectionPools();
list = new Vector(pools.size());
Iterator<String> poolNames = pools.keySet().iterator();
while (poolNames.hasNext()) {
list.add(poolNames.next());
}
} else {
list = new Vector();
}
return list;
}
use of org.eclipse.persistence.sessions.server.ConnectionPool in project eclipselink by eclipse-ee4j.
the class RuntimeServices method updatePoolSize.
/**
* This method allows the client to set the pool size for a particular pool, based on the pool name
* @param poolName the name of the pool to be updated.
* @param maxSize the new maximum number of connections
* @param minSize the new minimum number of connections
*/
public void updatePoolSize(String poolName, int maxSize, int minSize) {
if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
ConnectionPool connectionPool = ((ServerSession) getSession()).getConnectionPool(poolName);
if (connectionPool != null) {
connectionPool.setMaxNumberOfConnections(maxSize);
connectionPool.setMinNumberOfConnections(minSize);
}
}
}
Aggregations