Class DefaultNetworkChannel

java.lang.Object
eu.cloudnetservice.driver.network.DefaultNetworkChannel
All Implemented Interfaces:
NetworkChannel, PacketSender
Direct Known Subclasses:
NettyNetworkChannel

public abstract class DefaultNetworkChannel extends Object implements NetworkChannel
The default abstract implementation of a network channel.
Since:
4.0
  • Field Details

    • CHANNEL_ID_COUNTER

      private static final AtomicLong CHANNEL_ID_COUNTER
    • channelId

      private final long channelId
    • queryPacketManager

      private final QueryPacketManager queryPacketManager
    • packetRegistry

      private final PacketListenerRegistry packetRegistry
    • serverAddress

      private final HostAndPort serverAddress
    • clientAddress

      private final HostAndPort clientAddress
    • clientProvidedChannel

      private final boolean clientProvidedChannel
    • handler

      private final NetworkChannelHandler handler
  • Constructor Details

    • DefaultNetworkChannel

      public DefaultNetworkChannel(@NonNull @NonNull PacketListenerRegistry packetRegistry, @NonNull @NonNull HostAndPort serverAddress, @NonNull @NonNull HostAndPort clientAddress, boolean clientProvidedChannel, @NonNull @NonNull NetworkChannelHandler handler)
      Constructs a new default network channel instance.
      Parameters:
      packetRegistry - the packet registry to use for the channel.
      serverAddress - the associated server address for the connection.
      clientAddress - the associated client address for the connection.
      clientProvidedChannel - true if this channel was opened by a client, false otherwise.
      handler - the handler to post underlying network events to.
      Throws:
      NullPointerException - if one of the given arguments is null.
  • Method Details