forked from tada/pljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectPool.java
More file actions
50 lines (46 loc) · 1.43 KB
/
Copy pathObjectPool.java
File metadata and controls
50 lines (46 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Copyright (c) 2004-2019 Tada AB and other contributors, as listed below.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the The BSD 3-Clause License
* which accompanies this distribution, and is available at
* http://opensource.org/licenses/BSD-3-Clause
*
* Contributors:
* Tada AB
* Purdue University
*/
package org.postgresql.pljava;
import java.sql.SQLException;
/**
* A pool of objects of a single class.
* Obtain an <code>ObjectPool</code> from the {@link Session} by calling
* {@link Session#getObjectPool getObjectPool} with a {@link Class} object
* for the class to be pooled, which must implement {@link PooledObject}.
* @author Thomas Hallgren
*/
public interface ObjectPool<T extends PooledObject>
{
/**
* Obtain a pooled object, calling its {@link PooledObject#activate()}
* method. A new instance is created if needed. The pooled
* object is removed from the pool and activated.
*
* @return A new object or an object found in the pool.
*/
T activateInstance()
throws SQLException;
/**
* Call the {@link PooledObject#passivate()} method and return the object
* to the pool.
* @param instance The instance to passivate.
*/
void passivateInstance(T instance)
throws SQLException;
/**
* Call the {@link PooledObject#remove()} method and evict the object
* from the pool.
*/
void removeInstance(T instance)
throws SQLException;
}