Skip to content

Commit 9122c7f

Browse files
committed
Work on Object Pool example.
1 parent 7f334e7 commit 9122c7f

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.iluwatar;
2+
3+
public abstract class ObjectPool<T> {
4+
5+
protected abstract T create();
6+
7+
public synchronized T checkOut() {
8+
return null;
9+
}
10+
11+
public synchronized void checkIn(T instance) {
12+
13+
}
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.iluwatar;
2+
3+
public class Oliphaunt {
4+
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.iluwatar;
2+
3+
public class OliphauntPool extends ObjectPool<Oliphaunt> {
4+
5+
@Override
6+
protected Oliphaunt create() {
7+
return new Oliphaunt();
8+
}
9+
}

0 commit comments

Comments
 (0)