Interface DefaultNetworkComponent

All Superinterfaces:
NetworkComponent, PacketSender
All Known Implementing Classes:
NettyNetworkClient, NettyNetworkServer

public interface DefaultNetworkComponent extends NetworkComponent
A delegate default interface for a network component implementation.
Since:
4.0
  • Field Details

    • LOGGER

      static final eu.cloudnetservice.common.log.Logger LOGGER
  • Method Details

    • modifiableChannels

      Get the collection of channels which are connected to this network component. The returned collection is modifiable, but should not be used by developers to make any changes to it. If you need all channels which are connected to the component use NetworkComponent.channels() instead.
      Returns:
      all channels which are connected to this component, modifiable.
    • closeChannels

      default void closeChannels()
      Closes all open connections associated with this network component.
      Specified by:
      closeChannels in interface NetworkComponent
    • sendPacket

      default void sendPacket(@NonNull @NonNull Packet packet)
      Sends the given packet to the associated target.
      Specified by:
      sendPacket in interface PacketSender
      Parameters:
      packet - the packet to send.
    • sendPacketSync

      default void sendPacketSync(@NonNull @NonNull Packet packet)
      Sends the given packet to the associated target, waiting for the packet write to the channel to complete before resuming the current thread.
      Specified by:
      sendPacketSync in interface PacketSender
      Parameters:
      packet - the packet to send.
    • sendPacket

      default void sendPacket(@NonNull @NonNull Packet... packets)
      Sends all the given packets to the associated target.
      Specified by:
      sendPacket in interface PacketSender
      Parameters:
      packets - the packets to send.