Last active
February 13, 2019 14:21
-
-
Save need4spd/c8033ac703f96747fb0f68ee2b1ae9cc to your computer and use it in GitHub Desktop.
TestPool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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