Package org.jppf.comm.discovery
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 Summary
FieldsModifier and TypeFieldDescriptionThe host name.booleanWhether the recovery (aka heartbeat) mechanism is enabled.int[]The ports on which the server is listening.int[]The SSL ports on which the server is listening.Identifier for this object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()intbooleanstatic JPPFConnectionInformationfromBytes(byte[] bytes) Deserialize a DriverConnectionInformation object from an array of bytes.intgetValidPort(boolean secure) Get a valid port of the specified type, that is, the first port of the specified type greater than zero.inthashCode()booleanhasValidPort(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.booleanisSame(JPPFConnectionInformation other) Determine whether this object is equal to another.booleanisSame(JPPFConnectionInformation other, boolean compareUuid) Determine whether this object is equal to another.static byte[]Serialize a DriverConnectionInformation object to an array of bytes.toString()Get a string representation of this connection information object.
-
Field Details
-
host
The host name. -
serverPorts
public int[] serverPortsThe ports on which the server is listening. -
sslServerPorts
public int[] sslServerPortsThe SSL ports on which the server is listening. -
uuid
Identifier for this object. -
recoveryEnabled
public boolean recoveryEnabledWhether 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-trueto specifiy that secure (SSL/TLS) ports must be checked,falseto look for plain ports.- Returns:
trueif this information has a valid port,falseotherwise.- 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-trueto specifiy that secure (SSL/TLS) ports must be checked,falseto look for plain ports.- Returns:
- the value of the first valmid port found if this information has a valid port,
-1otherwise. - Since:
- 5.0
-
compareTo
- Specified by:
compareToin interfaceComparable<JPPFConnectionInformation>
-
hashCode
public int hashCode() -
equals
-
isSame
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
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
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
toString
Get a string representation of this connection information object. -
fromBytes
Deserialize a DriverConnectionInformation object from an array of bytes.- Parameters:
bytes- the array of bytes to deserialize from.- Returns:
- a
DriverConnectionInformationinstance. - Throws:
Exception- if an error is raised while deserializing.
-
toBytes
Serialize a DriverConnectionInformation object to an array of bytes.- Parameters:
info- theDriverConnectionInformationobject to serialize to.- Returns:
- an array of bytes.
- Throws:
Exception- if an error is raised while serializing.
-