Class JPPFConnectionInformation

java.lang.Object
org.jppf.comm.discovery.JPPFConnectionInformation
All Implemented Interfaces:
Serializable, Cloneable, Comparable<JPPFConnectionInformation>

public class JPPFConnectionInformation extends Object implements Serializable, Comparable<JPPFConnectionInformation>, Cloneable
This class encapsulates the connection information for a JPPF driver. The information includes the host, class server, application and node server ports.
Author:
Laurent Cohen
See Also:
  • Field Details

    • host

      public String host
      The host name.
    • serverPorts

      public int[] serverPorts
      The ports on which the server is listening.
    • sslServerPorts

      public int[] sslServerPorts
      The SSL ports on which the server is listening.
    • uuid

      public String uuid
      Identifier for this object.
    • recoveryEnabled

      public boolean recoveryEnabled
      Whether the recovery (aka heartbeat) mechanism is enabled.
  • Constructor Details

    • JPPFConnectionInformation

      public JPPFConnectionInformation()
      Default constructor.
  • Method Details

    • hasValidPort

      public boolean hasValidPort(boolean secure)
      Determine whether this connection information contains a valid port of the specified type, that is, at least one port of the specified type greater than zero.
      Parameters:
      secure - true to specifiy that secure (SSL/TLS) ports must be checked, false to look for plain ports.
      Returns:
      true if this information has a valid port, false otherwise.
      Since:
      5.0
    • getValidPort

      public int getValidPort(boolean secure)
      Get a valid port of the specified type, that is, the first port of the specified type greater than zero.
      Parameters:
      secure - true to specifiy that secure (SSL/TLS) ports must be checked, false to look for plain ports.
      Returns:
      the value of the first valmid port found if this information has a valid port, -1 otherwise.
      Since:
      5.0
    • compareTo

      public int compareTo(JPPFConnectionInformation ci)
      Specified by:
      compareTo in interface Comparable<JPPFConnectionInformation>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isSame

      public boolean isSame(JPPFConnectionInformation other)
      Determine whether this object is equal to another.
      Parameters:
      other - the object to compare to.
      Returns:
      true if the 2 objects are equal, false otherwise.
    • isSame

      public boolean isSame(JPPFConnectionInformation other, boolean compareUuid)
      Determine whether this object is equal to another.
      Parameters:
      other - the object to compare to.
      compareUuid - whether to compare the uuids.
      Returns:
      true if the 2 objects are equal, false otherwise.
    • clone

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • toString

      public String toString()
      Get a string representation of this connection information object.
      Overrides:
      toString in class Object
      Returns:
      a string describing this object.
    • fromBytes

      public static JPPFConnectionInformation fromBytes(byte[] bytes) throws Exception
      Deserialize a DriverConnectionInformation object from an array of bytes.
      Parameters:
      bytes - the array of bytes to deserialize from.
      Returns:
      a DriverConnectionInformation instance.
      Throws:
      Exception - if an error is raised while deserializing.
    • toBytes

      public static byte[] toBytes(JPPFConnectionInformation info) throws Exception
      Serialize a DriverConnectionInformation object to an array of bytes.
      Parameters:
      info - the DriverConnectionInformation object to serialize to.
      Returns:
      an array of bytes.
      Throws:
      Exception - if an error is raised while serializing.