Interface NodeServerLifecycle

All Known Implementing Classes:
NodeServer

public interface NodeServerLifecycle
Lifecycle interface for the P2P TCP node server.

Defined in blockchain-core so that BlockchainNode can control the server lifecycle without a hard dependency on the blockchain-network module or Netty (design.md §7.1 — dependency inversion principle).

The concrete NodeServer implementation lives in blockchain-network and is injected via BlockchainNode.setNodeServer(NodeServerLifecycle) during node assembly.

Since:
1.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the server is currently accepting inbound connections.
    void
    Binds the server to its configured TCP port and starts accepting inbound peer connections.
    void
    Stops the server and closes the listening socket.
  • Method Details

    • start

      void start()
      Binds the server to its configured TCP port and starts accepting inbound peer connections.
      Throws:
      IllegalStateException - if the server is already running
    • stop

      void stop()
      Stops the server and closes the listening socket.

      In-flight connections are closed gracefully where possible. After this call, isRunning() returns false.

    • isRunning

      boolean isRunning()
      Returns true if the server is currently accepting inbound connections.
      Returns:
      true if running