com.arangodb.shaded.netty.channel.local.LocalChannel Maven / Gradle / Ivy
/*
* Copyright 2012 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 com.arangodb.shaded.netty.channel.local;
import com.arangodb.shaded.netty.channel.AbstractChannel;
import com.arangodb.shaded.netty.channel.Channel;
import com.arangodb.shaded.netty.channel.ChannelConfig;
import com.arangodb.shaded.netty.channel.ChannelMetadata;
import com.arangodb.shaded.netty.channel.ChannelOutboundBuffer;
import com.arangodb.shaded.netty.channel.ChannelPipeline;
import com.arangodb.shaded.netty.channel.ChannelPromise;
import com.arangodb.shaded.netty.channel.DefaultChannelConfig;
import com.arangodb.shaded.netty.channel.EventLoop;
import com.arangodb.shaded.netty.channel.PreferHeapByteBufAllocator;
import com.arangodb.shaded.netty.channel.RecvByteBufAllocator;
import com.arangodb.shaded.netty.channel.SingleThreadEventLoop;
import com.arangodb.shaded.netty.util.ReferenceCountUtil;
import com.arangodb.shaded.netty.util.concurrent.Future;
import com.arangodb.shaded.netty.util.concurrent.SingleThreadEventExecutor;
import com.arangodb.shaded.netty.util.internal.InternalThreadLocalMap;
import com.arangodb.shaded.netty.util.internal.PlatformDependent;
import com.arangodb.shaded.netty.util.internal.logging.InternalLogger;
import com.arangodb.shaded.netty.util.internal.logging.InternalLoggerFactory;
import java.net.ConnectException;
import java.net.SocketAddress;
import java.nio.channels.AlreadyConnectedException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ConnectionPendingException;
import java.nio.channels.NotYetConnectedException;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
/**
* A {@link Channel} for the local transport.
*/
public class LocalChannel extends AbstractChannel {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(LocalChannel.class);
@SuppressWarnings({ "rawtypes" })
private static final AtomicReferenceFieldUpdater FINISH_READ_FUTURE_UPDATER =
AtomicReferenceFieldUpdater.newUpdater(LocalChannel.class, Future.class, "finishReadFuture");
private static final ChannelMetadata METADATA = new ChannelMetadata(false);
private static final int MAX_READER_STACK_DEPTH = 8;
private enum State { OPEN, BOUND, CONNECTED, CLOSED }
private final ChannelConfig config = new DefaultChannelConfig(this);
// To further optimize this we could write our own SPSC queue.
final Queue
© 2015 - 2025 Weber Informatics LLC | Privacy Policy