Record Class StdioTransport.DisconnectReason

java.lang.Object
java.lang.Record
com.tnsai.mcp.client.StdioTransport.DisconnectReason
Record Components:
exitCode - the process exit code (-1 if not available)
message - human-readable reason description
crashed - true if the disconnect was unexpected (not intentional)
commandName - the command that was running
Enclosing class:
StdioTransport

public static record StdioTransport.DisconnectReason(int exitCode, String message, boolean crashed, String commandName) extends Record
Reason for a subprocess disconnection.
  • Constructor Details

    • DisconnectReason

      public DisconnectReason(int exitCode, String message, boolean crashed, String commandName)
      Creates an instance of a DisconnectReason record class.
      Parameters:
      exitCode - the value for the exitCode record component
      message - the value for the message record component
      crashed - the value for the crashed record component
      commandName - the value for the commandName record component
  • Method Details

    • crash

      public static StdioTransport.DisconnectReason crash(int exitCode, String commandName)
      Creates a crash reason from a process exit.
    • healthCheckFailure

      public static StdioTransport.DisconnectReason healthCheckFailure(String commandName)
      Creates a disconnect reason for a dead process detected by health check.
    • streamError

      public static StdioTransport.DisconnectReason streamError(String message, String commandName)
      Creates a disconnect reason for a stream read failure.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • exitCode

      public int exitCode()
      Returns the value of the exitCode record component.
      Returns:
      the value of the exitCode record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • crashed

      public boolean crashed()
      Returns the value of the crashed record component.
      Returns:
      the value of the crashed record component
    • commandName

      public String commandName()
      Returns the value of the commandName record component.
      Returns:
      the value of the commandName record component