Skip to content

Instantly share code, notes, and snippets.

@need4spd
Last active February 13, 2019 14:21
Show Gist options
  • Save need4spd/c8033ac703f96747fb0f68ee2b1ae9cc to your computer and use it in GitHub Desktop.
Save need4spd/c8033ac703f96747fb0f68ee2b1ae9cc to your computer and use it in GitHub Desktop.
TestPool
import org.apache.commons.pool2.impl.GenericObjectPool;
public class TestPool {
public static void main(String[] args) throws Exception {
for(int i = 0; i < 10; i++) {
GenericObjectPool genericObjectPool = new GenericObjectPool(new MyPoolableObjectFactory());
MyPoolableObject obj = (MyPoolableObject)genericObjectPool.borrowObject();
System.out.println("i : " + i);
System.out.println(obj+ "id : " + obj.getId());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment