Work on Object Pool example.

This commit is contained in:
Ilkka Seppälä
2015-05-24 14:13:07 +03:00
parent 7f334e7024
commit 9122c7f0e6
3 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package com.iluwatar;
public abstract class ObjectPool<T> {
protected abstract T create();
public synchronized T checkOut() {
return null;
}
public synchronized void checkIn(T instance) {
}
}

View File

@ -0,0 +1,5 @@
package com.iluwatar;
public class Oliphaunt {
}

View File

@ -0,0 +1,9 @@
package com.iluwatar;
public class OliphauntPool extends ObjectPool<Oliphaunt> {
@Override
protected Oliphaunt create() {
return new Oliphaunt();
}
}