public class RequestID extends Object implements Externalizable
This class represents an identifier for a request. However, there are some differences in what constitutes "uniqueness" for a given RequestID that is based on context (where the id is used). The RequestID has 2 parts: connectionID, and executionIDFor the purposes of the RequestID, the combined representation is "connectionID.executionID" - this implies a scoping for the name parts. The connectionID specifies a particular connection that is making requests. Each connection generates a unique executionID for each request execution, so the executionID is only unique in the context of a connectionID.
When this class is used between client and server, the connectionID is implied and thus only the executionID part will be used. The server will qualify the executionID with a connectionID when it reaches the server.
RequestIDs are immutable so no setters exist. This allows hashcodes to be pre-computed for faster comparison in equals.
Modifier and Type | Field and Description |
---|---|
static String |
NO_CONNECTION_STR |
Constructor and Description |
---|
RequestID()
Necessary for implementing Externalizable
|
RequestID(long executionID)
Create a RequestID for an execution where the connection is
not specified.
|
RequestID(long connectionID,
long executionID) |
RequestID(String connectionID,
long executionID)
Create a RequestID using all of the ID parts.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getConnectionID()
Return connectionID, may be null if connection has not been specified.
|
long |
getExecutionID()
Return executionID, which identifies a per-connection execution.
|
int |
hashCode() |
void |
readExternal(ObjectInput in) |
String |
toString()
Return a combined string for the ID.
|
void |
writeExternal(ObjectOutput out) |
public static final String NO_CONNECTION_STR
public RequestID()
public RequestID(String connectionID, long executionID)
connectionID
- Identifies a connection, may be nullexecutionID
- Identifies an execution, cannot be nullpublic RequestID(long connectionID, long executionID)
public RequestID(long executionID)
executionID
- Identifies an execution, cannot be nullpublic String getConnectionID()
public long getExecutionID()
public String toString()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Externalizable.readExternal(java.io.ObjectInput)
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
Externalizable.writeExternal(java.io.ObjectOutput)
Copyright © 2020. All rights reserved.