/** * Create and initialize a pool of threads to serve clients requests. * * @param routingTable the Routing Table used to find WS. */ public PoolClientConnection(RoutingTable routingTable) { super(); PoolClientConnection.routingTable = routingTable; PoolClientConnection.mailBox = new MailBoxImpl(); // Pool creation and initialisation // Max threads int sizeMax = Integer.parseInt(DispatcherMSG.CONFIGURATION.getProperty("clients.max")); pool = new PooledExecutor(sizeMax); // Min threads int sizeMin = Integer.parseInt(DispatcherMSG.CONFIGURATION.getProperty("clients.min")); pool.setMinimumPoolSize(sizeMin); // Keep alive time long keepAliveTime = Long.parseLong(DispatcherMSG.CONFIGURATION.getProperty("clients.keepAliveTime")); pool.setKeepAliveTime(keepAliveTime); // Pre-start threads int preCreateThread = Integer.parseInt(DispatcherMSG.CONFIGURATION.getProperty("clients.preCreateThreads")); pool.createThreads(preCreateThread); // Set the policy for blocked execution to be to wait until a thread is // available pool.waitWhenBlocked(); }