Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/net/ssl/SSLSessionContext.java
38918 views
1
/*
2
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
27
package javax.net.ssl;
28
29
import java.util.Enumeration;
30
31
32
/**
33
* A <code>SSLSessionContext</code> represents a set of
34
* <code>SSLSession</code>s associated with a single entity. For example,
35
* it could be associated with a server or client who participates in many
36
* sessions concurrently.
37
* <p>
38
* Not all environments will contain session contexts.
39
* <p>
40
* There are <code>SSLSessionContext</code> parameters that affect how
41
* sessions are stored:
42
* <UL>
43
* <LI>Sessions can be set to expire after a specified
44
* time limit.
45
* <LI>The number of sessions that can be stored in context
46
* can be limited.
47
* </UL>
48
* A session can be retrieved based on its session id, and all session id's
49
* in a <code>SSLSessionContext</code> can be listed.
50
*
51
* @see SSLSession
52
*
53
* @since 1.4
54
* @author Nathan Abramson
55
* @author David Brownell
56
*/
57
public interface SSLSessionContext {
58
59
/**
60
* Returns the <code>SSLSession</code> bound to the specified session id.
61
*
62
* @param sessionId the Session identifier
63
* @return the <code>SSLSession</code> or null if
64
* the specified session id does not refer to a valid SSLSession.
65
*
66
* @throws NullPointerException if <code>sessionId</code> is null.
67
*/
68
public SSLSession getSession(byte[] sessionId);
69
70
/**
71
* Returns an Enumeration of all session id's grouped under this
72
* <code>SSLSessionContext</code>.
73
*
74
* @return an enumeration of all the Session id's
75
*/
76
public Enumeration<byte[]> getIds();
77
78
/**
79
* Sets the timeout limit for <code>SSLSession</code> objects grouped
80
* under this <code>SSLSessionContext</code>.
81
* <p>
82
* If the timeout limit is set to 't' seconds, a session exceeds the
83
* timeout limit 't' seconds after its creation time.
84
* When the timeout limit is exceeded for a session, the
85
* <code>SSLSession</code> object is invalidated and future connections
86
* cannot resume or rejoin the session.
87
* A check for sessions exceeding the timeout is made immediately whenever
88
* the timeout limit is changed for this <code>SSLSessionContext</code>.
89
*
90
* @apiNote Note that the JDK Implementation uses default values for both
91
* the session cache size and timeout. See
92
* {@code getSessionCacheSize} and {@code getSessionTimeout} for
93
* more information. Applications should consider their
94
* performance requirements and override the defaults if necessary.
95
*
96
* @param seconds the new session timeout limit in seconds; zero means
97
* there is no limit.
98
*
99
* @throws IllegalArgumentException if the timeout specified is {@code < 0}.
100
*
101
* @see #getSessionTimeout
102
*/
103
public void setSessionTimeout(int seconds)
104
throws IllegalArgumentException;
105
106
/**
107
* Returns the timeout limit of <code>SSLSession</code> objects grouped
108
* under this <code>SSLSessionContext</code>.
109
* <p>
110
* If the timeout limit is set to 't' seconds, a session exceeds the
111
* timeout limit 't' seconds after its creation time.
112
* When the timeout limit is exceeded for a session, the
113
* <code>SSLSession</code> object is invalidated and future connections
114
* cannot resume or rejoin the session.
115
* A check for sessions exceeding the timeout limit is made immediately
116
* whenever the timeout limit is changed for this
117
* <code>SSLSessionContext</code>.
118
*
119
* @implNote The JDK implementation returns the session timeout as set by
120
* the {@code setSessionTimeout} method, or if not set, a default
121
* value of 86400 seconds (24 hours).
122
*
123
* @return the session timeout limit in seconds; zero means there is no
124
* limit.
125
*
126
* @see #setSessionTimeout
127
*/
128
public int getSessionTimeout();
129
130
/**
131
* Sets the size of the cache used for storing <code>SSLSession</code>
132
* objects grouped under this <code>SSLSessionContext</code>.
133
*
134
* @apiNote Note that the JDK Implementation uses default values for both
135
* the session cache size and timeout. See
136
* {@code getSessionCacheSize} and {@code getSessionTimeout} for
137
* more information. Applications should consider their
138
* performance requirements and override the defaults if necessary.
139
*
140
* @param size the new session cache size limit; zero means there is no
141
* limit.
142
*
143
* @throws IllegalArgumentException if the specified size is {@code < 0}.
144
*
145
* @see #getSessionCacheSize
146
*/
147
public void setSessionCacheSize(int size)
148
throws IllegalArgumentException;
149
150
/**
151
* Returns the size of the cache used for storing <code>SSLSession</code>
152
* objects grouped under this <code>SSLSessionContext</code>.
153
*
154
* @implNote The JDK implementation returns the cache size as set by
155
* the {@code setSessionCacheSize} method, or if not set, the
156
* value of the {@systemProperty javax.net.ssl.sessionCacheSize}
157
* system property. If neither is set, it returns a default
158
* value of 20480.
159
*
160
* @return size of the session cache; zero means there is no size limit.
161
*
162
* @see #setSessionCacheSize
163
*/
164
public int getSessionCacheSize();
165
}
166
167