Home / File/ OpenSslClientSessionCache.java — netty Source File

OpenSslClientSessionCache.java — netty Source File

Architecture documentation for OpenSslClientSessionCache.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2021 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.handler.ssl;

import io.netty.internal.tcnative.SSL;
import io.netty.util.AsciiString;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * {@link OpenSslSessionCache} that is used by the client-side.
 */
final class OpenSslClientSessionCache extends OpenSslSessionCache {
    private final Map<HostPort, Set<NativeSslSession>> sessions = new HashMap<>();

    OpenSslClientSessionCache(Map<Long, ReferenceCountedOpenSslEngine> engines) {
        super(engines);
    }

    @Override
    protected boolean sessionCreated(NativeSslSession session) {
        assert Thread.holdsLock(this);
        HostPort hostPort = keyFor(session.getPeerHost(), session.getPeerPort());
        if (hostPort == null) {
            return false;
        }
        Set<NativeSslSession> sessionsForHost = sessions.get(hostPort);
        if (sessionsForHost == null) {
            // Let's start with something small as usually the server does not provide too many of these per hostPort
            // mapping.
            sessionsForHost = new HashSet<>(4);
            sessions.put(hostPort, sessionsForHost);
        }
        sessionsForHost.add(session);
        return true;
    }

    @Override
    protected void sessionRemoved(NativeSslSession session) {
        assert Thread.holdsLock(this);
        HostPort hostPort = keyFor(session.getPeerHost(), session.getPeerPort());
        if (hostPort == null) {
// ... (129 more lines)

Domain

Subdomains

Frequently Asked Questions

What does OpenSslClientSessionCache.java do?
OpenSslClientSessionCache.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is OpenSslClientSessionCache.java in the architecture?
OpenSslClientSessionCache.java is located at handler/src/main/java/io/netty/handler/ssl/OpenSslClientSessionCache.java (domain: Buffer, subdomain: Allocators, directory: handler/src/main/java/io/netty/handler/ssl).

Analyze Your Own Codebase

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

Try Supermodel Free