Home / Function/ getSession() — netty Function Reference

getSession() — netty Function Reference

Architecture documentation for the getSession() function in OpenSslSessionCache.java from the netty codebase.

Function java Buffer Allocators calls 10 called by 2

Entity Profile

Dependency Diagram

graph TD
  219256b2_175f_0f2b_aca5_e31008ba7083["getSession()"]
  6355c604_3e83_2b17_e056_558795a68fc3["OpenSslSessionCache"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|defined in| 6355c604_3e83_2b17_e056_558795a68fc3
  b0c9f020_ce9e_89e3_fb97_acebd4a5fba9["sessionCreated()"]
  b0c9f020_ce9e_89e3_fb97_acebd4a5fba9 -->|calls| 219256b2_175f_0f2b_aca5_e31008ba7083
  122cf5ab_8a79_b12f_0bf0_2819ed57ca9a["OpenSslInternalSession()"]
  122cf5ab_8a79_b12f_0bf0_2819ed57ca9a -->|calls| 219256b2_175f_0f2b_aca5_e31008ba7083
  9b03f891_d530_32ba_3f3a_2eb1f11648c0["OpenSslSessionId()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| 9b03f891_d530_32ba_3f3a_2eb1f11648c0
  ad6e504f_835f_5a30_4635_c8827fa4567b["isValid()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| ad6e504f_835f_5a30_4635_c8827fa4567b
  c3dd1c58_63b5_f4d9_6eab_f0bb504d6c0e["upRef()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| c3dd1c58_63b5_f4d9_6eab_f0bb504d6c0e
  adc4a21b_2741_c870_2d79_c0b7f58a00b1["removeSessionWithId()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| adc4a21b_2741_c870_2d79_c0b7f58a00b1
  3f1fc41a_11c2_8970_fac1_2fd65cdd66af["shouldBeSingleUse()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| 3f1fc41a_11c2_8970_fac1_2fd65cdd66af
  ad5de155_b466_ed42_fae3_868922e4956f["setLastAccessedTime()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| ad5de155_b466_ed42_fae3_868922e4956f
  417c212f_5a55_328c_241e_2b59036af299["setSessionDetails()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| 417c212f_5a55_328c_241e_2b59036af299
  e53943a7_cdae_b5b2_3817_3a1c0ca52c90["getCreationTime()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| e53943a7_cdae_b5b2_3817_3a1c0ca52c90
  a92524f2_f56e_1c46_6bbe_852c562a92d3["getLastAccessedTime()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| a92524f2_f56e_1c46_6bbe_852c562a92d3
  adde4bbd_774f_4454_26f2_3a5a335e0d07["session()"]
  219256b2_175f_0f2b_aca5_e31008ba7083 -->|calls| adde4bbd_774f_4454_26f2_3a5a335e0d07
  style 219256b2_175f_0f2b_aca5_e31008ba7083 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java lines 180–219

    @Override
    public final long getSession(long ssl, byte[] sessionId) {
        OpenSslSessionId id = new OpenSslSessionId(sessionId);
        final NativeSslSession session;
        synchronized (this) {
            session = sessions.get(id);
            if (session == null) {
                return -1;
            }

            // If the session is not valid anymore we should remove it from the cache and just signal back
            // that we couldn't find a session that is re-usable.
            if (!session.isValid() ||
                    // This needs to happen in the synchronized block so we ensure we never destroy it before we
                    // incremented the reference count. If we cant increment the reference count there is something
                    // wrong. In this case just remove the session from the cache and signal back that we couldn't
                    // find a session for re-use.
                    !session.upRef()) {
                // Remove the session from the cache. This will also take care of calling SSL_SESSION_free(...)
                removeSessionWithId(session.sessionId());
                return -1;
            }

            // At this point we already incremented the reference count via SSL_SESSION_up_ref(...).
            if (session.shouldBeSingleUse()) {
                // Should only be used once. In this case invalidate the session which will also ensure we remove it
                // from the cache and call SSL_SESSION_free(...).
                removeSessionWithId(session.sessionId());
            }
        }
        session.setLastAccessedTime(System.currentTimeMillis());
        ReferenceCountedOpenSslEngine engine = engines.get(ssl);
        if (engine != null) {
            OpenSslInternalSession sslSession = (OpenSslInternalSession) engine.getSession();
            sslSession.setSessionDetails(session.getCreationTime(),
                    session.getLastAccessedTime(), session.sessionId(), session.keyValueStorage);
        }

        return session.session();
    }

Domain

Subdomains

Frequently Asked Questions

What does getSession() do?
getSession() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java.
Where is getSession() defined?
getSession() is defined in handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java at line 180.
What does getSession() call?
getSession() calls 10 function(s): OpenSslSessionId, getCreationTime, getLastAccessedTime, isValid, removeSessionWithId, session, setLastAccessedTime, setSessionDetails, and 2 more.
What calls getSession()?
getSession() is called by 2 function(s): OpenSslInternalSession, sessionCreated.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free