Package com.privatechain.core.network
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
-
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()returnsfalse. -
isRunning
boolean isRunning()Returnstrueif the server is currently accepting inbound connections.- Returns:
trueif running
-