Class RequestID
- java.lang.Object
-
- org.teiid.dqp.message.RequestID
-
- All Implemented Interfaces:
Externalizable
,Serializable
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.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
NO_CONNECTION_STR
-
Constructor Summary
Constructors Constructor Description RequestID()
Necessary for implementing ExternalizableRequestID(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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
NO_CONNECTION_STR
public static final String NO_CONNECTION_STR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RequestID
public RequestID()
Necessary for implementing Externalizable
-
RequestID
public RequestID(String connectionID, long executionID)
Create a RequestID using all of the ID parts.- Parameters:
connectionID
- Identifies a connection, may be nullexecutionID
- Identifies an execution, cannot be null
-
RequestID
public RequestID(long connectionID, long executionID)
-
RequestID
public RequestID(long executionID)
Create a RequestID for an execution where the connection is not specified.- Parameters:
executionID
- Identifies an execution, cannot be null
-
-
Method Detail
-
getConnectionID
public String getConnectionID()
Return connectionID, may be null if connection has not been specified.- Returns:
- Connection ID, may be null
-
getExecutionID
public long getExecutionID()
Return executionID, which identifies a per-connection execution.- Returns:
- Execution ID
-
toString
public String toString()
Return a combined string for the ID.
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
- See Also:
Externalizable.readExternal(java.io.ObjectInput)
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
- See Also:
Externalizable.writeExternal(java.io.ObjectOutput)
-
-