File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
main/java/com/iluwatar/object/pool
test/java/com/iluwatar/object/pool Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 5
5
* When it is necessary to work with a large number of objects that are particularly expensive to instantiate
6
6
* and each object is only needed for a short period of time, the performance of an entire application may be
7
7
* adversely affected. An object pool design pattern may be deemed desirable in cases such as these.
8
- *
8
+ * <p>
9
9
* The object pool design pattern creates a set of objects that may be reused. When a new object is needed, it
10
10
* is requested from the pool. If a previously prepared object is available it is returned immediately, avoiding
11
11
* the instantiation cost. If no objects are present in the pool, a new item is created and returned. When the
12
12
* object has been used and is no longer needed, it is returned to the pool, allowing it to be used again in the
13
13
* future without repeating the computationally expensive instantiation process. It is important to note that
14
14
* once an object has been used and returned, existing references will become invalid.
15
- *
16
- * In this example we have created OliphauntPool inheriting from generic ObjectPool. Oliphaunts can be checked
15
+ * <p>
16
+ * In this example we have created {@link OliphauntPool} inheriting from generic {@link ObjectPool}. {@link Oliphaunt}s can be checked
17
17
* out from the pool and later returned to it. The pool tracks created instances and their status (available,
18
18
* inUse).
19
19
*
20
20
*/
21
21
public class App {
22
22
23
+ /**
24
+ * Program entry point
25
+ * @param args command line args
26
+ */
23
27
public static void main ( String [] args ) {
24
28
OliphauntPool pool = new OliphauntPool ();
25
29
System .out .println (pool );
Original file line number Diff line number Diff line change 4
4
5
5
import com .iluwatar .object .pool .App ;
6
6
7
+ /**
8
+ *
9
+ * Application test
10
+ *
11
+ */
7
12
public class AppTest {
8
13
9
14
@ Test
You can’t perform that action at this time.
0 commit comments