Class BlockchainEvent.PeerDisconnectedEvent

java.lang.Object
com.privatechain.core.event.BlockchainEvent
com.privatechain.core.event.BlockchainEvent.PeerDisconnectedEvent
Enclosing class:
BlockchainEvent

public static final class BlockchainEvent.PeerDisconnectedEvent extends BlockchainEvent
Fired when a peer connection is closed, either gracefully or due to an error.

Consumers can inspect getReason() to distinguish between normal disconnections and failures. A null reason means the cause is unknown.

Since:
1.0.0
  • Constructor Details

    • PeerDisconnectedEvent

      public PeerDisconnectedEvent(String peerId, String reason)
      Constructs a PeerDisconnectedEvent.
      Parameters:
      peerId - unique peer identifier (non-null, non-blank)
      reason - disconnection reason; may be null if unknown
      Throws:
      NullPointerException - if peerId is null
      IllegalArgumentException - if peerId is blank
  • Method Details

    • getPeerId

      public String getPeerId()
      Returns the unique identifier of the disconnected peer.
      Returns:
      non-null, non-blank peer ID
    • getReason

      public String getReason()
      Returns the human-readable reason for disconnection, or null if unknown.
      Returns:
      reason string or null
    • toString

      public String toString()
      Overrides:
      toString in class Object