/** * Constructs a pool of connections to the notification servers. * * Apple servers recommend using a pooled connection up to * 15 concurrent persistent connections to the gateways. * * Note: This option has no effect when using non-blocking * connections. */ public ApnsServiceBuilder asPool(int maxConnections) { return asPool(Executors.newFixedThreadPool(maxConnections), maxConnections); }
private void configureConnectionStrategy(ApnsServiceBuilder builder) { if (getConnectionStrategy() == ConnectionStrategy.POOL) { AssertUtils.isTrue(poolSize >= MIN_POOL_SIZE, "Pool size needs to be greater than: " + MIN_POOL_SIZE); AssertUtils.isTrue(poolSize <= MAX_POOL_SIZE, "Pool size needs to be lower than: " + MAX_POOL_SIZE); } if (getConnectionStrategy() == null) { return; } switch (getConnectionStrategy()) { case QUEUE: builder.asQueued(); break; case POOL: builder.asPool(getPoolSize()); break; default: break; } }