KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > resource > ResourcePool


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.resource;
24
25
26 import javax.transaction.Transaction JavaDoc;
27 import com.sun.enterprise.connectors.ConnectorConnectionPool;
28
29 /**
30  * @author Tony Ng
31  */

32 public interface ResourcePool {
33
34     // start IASRI 4649256
35
// Modify getResource() to throw PoolingException
36
public ResourceHandle getResource(ResourceSpec spec,
37                                       ResourceAllocator alloc,
38                                       Transaction JavaDoc tran) throws PoolingException;
39     // end IASRI 4649256
40

41     public void resourceClosed(ResourceHandle resource);
42
43     public void resourceErrorOccurred(ResourceHandle resource);
44
45     public void addResource(ResourceSpec spec,
46                             ResourceHandle resource);
47
48     public void resourceEnlisted(Transaction JavaDoc tran, ResourceHandle resource);
49
50     public void transactionCompleted(Transaction JavaDoc tran, int status);
51
52     public void resizePool(boolean forced);
53
54     // forcefully destroy all connections in the pool even if
55
// connections have transactions in progress
56
public void emptyPool();
57
58
59     //reconfig the pool's properties
60
public void reconfigPoolProperties( ConnectorConnectionPool ccp )
61             throws PoolingException;
62
63     //toggle monitoring
64
public void disableMonitoring();
65     public void setMonitoringEnabledHigh();
66     public void setMonitoringEnabledLow();
67     public boolean isMonitoringEnabled();
68
69     //cancel the resizer task in the pool
70
public void cancelResizerTask();
71
72     public void switchOnMatching();
73
74     public String JavaDoc getPoolName();
75
76     public void emptyFreeConnectionsInPool();
77
78     //accessors for self mgmt
79
/**
80      * Gets the max-pool-size attribute of this pool. Envisaged to be
81      * used by the Self management framework to query the pool size
82      * attribute for tweaking it using the setMaxPoolSize method
83      *
84      * @return max-pool-size value for this pool
85      * @see setMaxPoolSize
86      */

87     public int getMaxPoolSize();
88     
89     /**
90      * Gets the steady-pool-size attribute of this pool. Envisaged to be
91      * used by the Self management framework to query the pool size
92      * attribute for tweaking it using the setSteadyPoolSize method
93      *
94      * @return steady-pool-size value for this pool
95      * @see setSteadyPoolSize
96      */

97     public int getSteadyPoolSize();
98
99     //mutators for self mgmt
100
/**
101      * Sets the max-pool-size value for this pool. This attribute is
102      * expected to be set by the self-management framework for an optimum
103      * max-pool-size. The corresponding accessor gets this value.
104      *
105      * @param size - The new max-pool-size value
106      * @see getMaxPoolSize
107      */

108     public void setMaxPoolSize( int size );
109     
110     /**
111      * Sets the steady-pool-size value for this pool. This attribute is
112      * expected to be set by the self-management framework for an optimum
113      * steady-pool-size. The corresponding accessor gets this value.
114      *
115      * @param size - The new steady-pool-size value
116      * @see getSteadyPoolSize
117      */

118     public void setSteadyPoolSize( int size );
119
120     /**
121      * Sets/Resets the flag indicating if this pool is self managed.
122      * This method would be typically called by the self management
123      * framework to indicate to the world (and this pool) that this
124      * pool is self managed. Its very important that the self mgmt
125      * framework properly sets this flag to control the dynamic reconfig
126      * behavior of this pool. If this flag is set to true, all dynamic
127      * reconfigs affecting the max/steady pool size of this pool will
128      * be ignored.
129      *
130      * @param selfManaged - true to switch on self management, false otherwise
131      */

132     public void setSelfManaged( boolean selfManaged );
133 }
134
135
136
Popular Tags