All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hazelcast.internal.tpcengine.net.AsyncSocketOptions Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
 *
 * Licensed 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
 *
 * http://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 com.hazelcast.internal.tpcengine.net;

import com.hazelcast.internal.tpcengine.Option;

import java.util.concurrent.Executor;

/**
 * Options for the {@link AsyncSocket} and {@link AsyncServerSocket}.
 * 

* Reason for the name: there already exists a class com.hazelcast.client.config.SocketOptions * and java.net.SocketOptions. */ public interface AsyncSocketOptions { /** * See {@link java.net.SocketOptions#SO_RCVBUF}. */ Option SO_RCVBUF = new Option<>("SO_RCVBUF", Integer.class); /** * See {@link java.net.SocketOptions#SO_SNDBUF} */ Option SO_SNDBUF = new Option<>("SO_SNDBUF", Integer.class); /** * See {@link java.net.SocketOptions#SO_KEEPALIVE} */ Option SO_KEEPALIVE = new Option<>("SO_KEEPALIVE", Boolean.class); /** * See {@link java.net.SocketOptions#SO_REUSEPORT} */ Option SO_REUSEPORT = new Option<>("SO_REUSEPORT", Boolean.class); /** * See {@link java.net.SocketOptions#SO_REUSEADDR} */ Option SO_REUSEADDR = new Option<>("SO_REUSEADDR", Boolean.class); /** * See {@link java.net.SocketOptions#TCP_NODELAY} */ Option TCP_NODELAY = new Option<>("TCP_NODELAY", Boolean.class); /** * See {@code jdk.net.ExtendedSocketOptions#TCP_KEEPIDLE} */ Option TCP_KEEPIDLE = new Option<>("TCP_KEEPIDLE", Integer.class); /** * See {@code jdk.net.ExtendedSocketOptions#TCP_KEEPINTERVAL} */ Option TCP_KEEPINTERVAL = new Option<>("TCP_KEEPINTERVAL", Integer.class); /** * See {@code jdk.net.ExtendedSocketOptions#TCP_KEEPCOUNT} */ Option TCP_KEEPCOUNT = new Option<>("TCP_KEEPCOUNT", Integer.class); Option SSL_ENGINE_FACTORY = new Option<>("SSL_ENGINE_FACTORY", Object.class); Option TLS_EXECUTOR = new Option<>("TLS_EXECUTOR", Executor.class); /** * Checks if the option is supported. * * @param option the option * @return true if supported, false otherwise * @throws NullPointerException if option is null. */ boolean isSupported(Option option); /** * Sets an option value if that option is supported. * * @param option the option * @param value the value * @param the type of the value * @return true if the option was supported, false otherwise. * @throws NullPointerException if option or value is null. * @throws java.io.UncheckedIOException if the value could not be set. */ boolean set(Option option, T value); /** * Gets an option value. If option was not set or is not supported, null is returned. * * @param option the option * @param the type of the value * @return the value for the option, null if the option was not set or is not supported. * @throws java.io.UncheckedIOException if the value could not be gotten. */ T get(Option option); }