"'sessionFactory' cannot be a 'DelegatingSessionFactory'; cache each delegate instead"); this.sessionFactory = sessionFactory; this.pool = new SimplePool<Session<F>>(sessionCacheSize, new SimplePool.PoolItemCallback<Session<F>>() { @Override public Session<F> createForPool() {
private SimplePool<String> stringPool(int size, final Set<String> strings, final AtomicBoolean stale) { SimplePool<String> pool = new SimplePool<String>(size, new SimplePool.PoolItemCallback<String>() { private int i; @Override public String createForPool() { String string = "String" + i++; strings.add(string); return string; } @Override public boolean isStale(String item) { if (stale.get()) { strings.remove(item); } return stale.get(); } @Override public void removedFromPool(String item) { strings.remove(item); } }); return pool; }
this.pool = new SimplePool<TcpConnectionSupport>(poolSize, new SimplePool.PoolItemCallback<TcpConnectionSupport>() {
/** * Set the pool size for deserialization buffers. * @param size the size, -1 for unlimited. * @since 4.3 */ public void setPoolSize(int size) { Assert.isNull(this.pool, "Cannot change pool size once set"); this.pool = new SimplePool<byte[]>(size, new PoolItemCallback<byte[]>() { @Override public byte[] createForPool() { return new byte[getMaxMessageSize()]; } @Override public boolean isStale(byte[] item) { return false; // never stale } @Override public void removedFromPool(byte[] item) { } }); this.pool.setWaitTimeout(this.poolWaitTimeout); }
this.pool = new SimplePool<TcpConnectionSupport>(poolSize, new SimplePool.PoolItemCallback<TcpConnectionSupport>() {
/** * Set the pool size for deserialization buffers. * @param size the size, -1 for unlimited. * @since 4.3 */ public void setPoolSize(int size) { Assert.isNull(this.pool, "Cannot change pool size once set"); this.pool = new SimplePool<byte[]>(size, new PoolItemCallback<byte[]>() { @Override public byte[] createForPool() { return new byte[getMaxMessageSize()]; } @Override public boolean isStale(byte[] item) { return false; // never stale } @Override public void removedFromPool(byte[] item) { } }); this.pool.setWaitTimeout(this.poolWaitTimeout); }