--- modules/grizzly/src/main/java/com/sun/grizzly/connectioncache/client/CacheableConnectorHandlerPool.java (original) +++ modules/grizzly/src/main/java/com/sun/grizzly/connectioncache/client/CacheableConnectorHandlerPool.java (working copy) @@ -71,16 +71,27 @@ public CacheableConnectorHandlerPool(Controller controller, int highWaterMark, int numberToReclaim, int maxParallel, ConnectionFinder connectionFinder) { + this(controller, highWaterMark, numberToReclaim, maxParallel, connectionFinder, null); + } + + public CacheableConnectorHandlerPool(Controller controller, int highWaterMark, + int numberToReclaim, int maxParallel, ConnectionFinder connectionFinder, + OutboundConnectionFactory factory) { this.controller = controller; - this.outboundConnectionCache = - ConnectionCacheFactory.makeBlockingOutboundConnectionCache( - "Grizzly outbound connection cache", highWaterMark, - numberToReclaim, maxParallel, Controller.logger()); + if (factory == null){ + this.outboundConnectionCache = + ConnectionCacheFactory.makeBlockingOutboundConnectionCache( + "Grizzly outbound connection cache", highWaterMark, + numberToReclaim, maxParallel, Controller.logger()); + }else{ + this.outboundConnectionCache = factory.makeBlockingOutboundConnectionCache( + highWaterMark, numberToReclaim, maxParallel, Controller.logger()); + } this.connectionFinder = connectionFinder; protocolConnectorHandlerPool = new DefaultConnectorHandlerPool(controller); connectorInstanceHandler = new CacheableConnectorInstanceHandler(); } - + public CacheableConnectorHandler acquireConnectorHandler(Protocol protocol) { CacheableConnectorHandler connectorHandler = connectorInstanceHandler.acquire(); connectorHandler.protocol(protocol);