NativeSslSession Class — netty Architecture
Architecture documentation for the NativeSslSession class in OpenSslSessionCache.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD ae52002d_8b57_6128_3dc8_7352beeb0a8f["NativeSslSession"] 94dac1de_c6bf_c38a_f7ce_442307ca85ac["OpenSslSessionCache.java"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|defined in| 94dac1de_c6bf_c38a_f7ce_442307ca85ac 08927982_8b98_e1fb_0e02_5223c438157b["NativeSslSession()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| 08927982_8b98_e1fb_0e02_5223c438157b fa68c4d0_0277_2e56_a213_4bfaca0ad628["keyValueStorage()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| fa68c4d0_0277_2e56_a213_4bfaca0ad628 b5d842a6_fcab_4a05_1944_72cac90b2b7e["prepareHandshake()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| b5d842a6_fcab_4a05_1944_72cac90b2b7e 417c212f_5a55_328c_241e_2b59036af299["setSessionDetails()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| 417c212f_5a55_328c_241e_2b59036af299 3f1fc41a_11c2_8970_fac1_2fd65cdd66af["shouldBeSingleUse()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| 3f1fc41a_11c2_8970_fac1_2fd65cdd66af adde4bbd_774f_4454_26f2_3a5a335e0d07["session()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| adde4bbd_774f_4454_26f2_3a5a335e0d07 c3dd1c58_63b5_f4d9_6eab_f0bb504d6c0e["upRef()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| c3dd1c58_63b5_f4d9_6eab_f0bb504d6c0e 22426940_1d17_2fb0_3083_17f8a584e7e4["free()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| 22426940_1d17_2fb0_3083_17f8a584e7e4 6fcf34b1_3222_1c25_37b2_cb359e5628e0["close()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| 6fcf34b1_3222_1c25_37b2_cb359e5628e0 9b03f891_d530_32ba_3f3a_2eb1f11648c0["OpenSslSessionId()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| 9b03f891_d530_32ba_3f3a_2eb1f11648c0 ad6e504f_835f_5a30_4635_c8827fa4567b["isValid()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| ad6e504f_835f_5a30_4635_c8827fa4567b 39e16627_be4c_488c_47f8_af7dde971e4c["setLocalCertificate()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| 39e16627_be4c_488c_47f8_af7dde971e4c 22e9d656_444c_1a93_91e3_edf1b59c1b47["OpenSslSessionContext()"] ae52002d_8b57_6128_3dc8_7352beeb0a8f -->|method| 22e9d656_444c_1a93_91e3_edf1b59c1b47
Relationship Graph
Source Code
handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java lines 296–525
static final class NativeSslSession implements OpenSslInternalSession {
static final ResourceLeakDetector<NativeSslSession> LEAK_DETECTOR = ResourceLeakDetectorFactory.instance()
.newResourceLeakDetector(NativeSslSession.class);
private final ResourceLeakTracker<NativeSslSession> leakTracker;
final Map<String, Object> keyValueStorage;
private final long session;
private final String peerHost;
private final int peerPort;
private final OpenSslSessionId id;
private final long timeout;
private final long creationTime = System.currentTimeMillis();
private volatile long lastAccessedTime = creationTime;
private volatile boolean valid = true;
private boolean freed;
NativeSslSession(long session, String peerHost, int peerPort, long timeout,
Map<String, Object> keyValueStorage) {
this.session = session;
this.peerHost = peerHost;
this.peerPort = peerPort;
this.timeout = timeout;
this.id = new OpenSslSessionId(io.netty.internal.tcnative.SSLSession.getSessionId(session));
this.keyValueStorage = keyValueStorage;
leakTracker = LEAK_DETECTOR.track(this);
}
@Override
public Map<String, Object> keyValueStorage() {
return keyValueStorage;
}
@Override
public void prepareHandshake() {
throw new UnsupportedOperationException();
}
@Override
public void setSessionDetails(long creationTime, long lastAccessedTime,
OpenSslSessionId id, Map<String, Object> keyValueStorage) {
throw new UnsupportedOperationException();
}
boolean shouldBeSingleUse() {
assert !freed;
return SSLSession.shouldBeSingleUse(session);
}
long session() {
assert !freed;
return session;
}
boolean upRef() {
assert !freed;
return SSLSession.upRef(session);
}
synchronized void free() {
close();
SSLSession.free(session);
}
void close() {
assert !freed;
freed = true;
invalidate();
if (leakTracker != null) {
leakTracker.close(this);
}
}
@Override
public OpenSslSessionId sessionId() {
return id;
}
boolean isValid(long now) {
return creationTime + timeout >= now && valid;
}
Source
Frequently Asked Questions
What is the NativeSslSession class?
NativeSslSession is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java.
Where is NativeSslSession defined?
NativeSslSession is defined in handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java at line 296.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free