01: /*
02: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03: *
04: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
05: *
06: * The contents of this file are subject to the terms of either the GNU
07: * General Public License Version 2 only ("GPL") or the Common Development
08: * and Distribution License("CDDL") (collectively, the "License"). You
09: * may not use this file except in compliance with the License. You can obtain
10: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
11: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
12: * language governing permissions and limitations under the License.
13: *
14: * When distributing the software, include this License Header Notice in each
15: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
16: * Sun designates this particular file as subject to the "Classpath" exception
17: * as provided by Sun in the GPL Version 2 section of the License file that
18: * accompanied this code. If applicable, add the following below the License
19: * Header, with the fields enclosed by brackets [] replaced by your own
20: * identifying information: "Portions Copyrighted [year]
21: * [name of copyright owner]"
22: *
23: * Contributor(s):
24: *
25: * If you wish your version of this file to be governed by only the CDDL or
26: * only the GPL Version 2, indicate your decision by adding "[Contributor]
27: * elects to include this software in this distribution under the [CDDL or GPL
28: * Version 2] license." If you don't indicate a single choice of license, a
29: * recipient has the option to distribute your version of this file under
30: * either the CDDL, the GPL Version 2 or to extend the choice of license to
31: * its licensees as provided above. However, if you add GPL Version 2 code
32: * and therefore, elected the GPL Version 2 license, then the option applies
33: * only if the new code is made subject to such option by the copyright
34: * holder.
35: */
36:
37: package com.sun.xml.ws.transport.tcp.connectioncache.spi.transport;
38:
39: /** A connection cache manages a group of connections which may be re-used
40: * for sending and receiving messages.
41: */
42: public interface ConnectionCache<C extends Connection> {
43: /** User-provided indentifier for an instance of the
44: * OutboundConnectionCache.
45: */
46: String getCacheType();
47:
48: /** Total number of connections currently managed by the cache.
49: */
50: long numberOfConnections();
51:
52: /** Number of idle connections; that is, connections for which the number of
53: * get/release or responseReceived/responseProcessed calls are equal.
54: */
55: long numberOfIdleConnections();
56:
57: /** Number of non-idle connections. Normally, busy+idle==total, but this
58: * may not be strictly true due to concurrent updates to the connection
59: * cache.
60: */
61: long numberOfBusyConnections();
62:
63: /** Number of idle connections that are reclaimable. Such connections
64: * are not in use, and are not waiting to handle any responses.
65: */
66: long numberOfReclaimableConnections();
67:
68: /** Threshold at which connection reclamation begins.
69: */
70: int highWaterMark();
71:
72: /** Number of connections to reclaim each time reclamation starts.
73: */
74: int numberToReclaim();
75:
76: /** Close a connection, regardless of its state. This may cause requests
77: * to fail to be sent, and responses to be lost. Intended for
78: * handling serious errors, such as loss of framing on a TCP stream,
79: * that require closing the connection.
80: */
81: void close(final C conn);
82: }
|