com.metamatrix.dqp.message
Class RequestID

java.lang.Object
  extended by com.metamatrix.dqp.message.RequestID
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class RequestID
extends java.lang.Object
implements java.io.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
static java.lang.String NO_CONNECTION_STR
           
 
Constructor Summary
RequestID()
          Necessary for implementing Externalizable
RequestID(long executionID)
          Create a RequestID for an execution where the connection is not specified.
RequestID(java.lang.String connectionID, long executionID)
          Create a RequestID using all of the ID parts.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.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(java.io.ObjectInput in)
           
 java.lang.String toString()
          Return a combined string for the ID.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_CONNECTION_STR

public static final java.lang.String NO_CONNECTION_STR
See Also:
Constant Field Values
Constructor Detail

RequestID

public RequestID()
Necessary for implementing Externalizable


RequestID

public RequestID(java.lang.String connectionID,
                 long executionID)
Create a RequestID using all of the ID parts.

Parameters:
connectionID - Identifies a connection, may be null
executionID - Identifies an execution, cannot be null

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 java.lang.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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Return a combined string for the ID.

Overrides:
toString in class java.lang.Object

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
Externalizable.readExternal(java.io.ObjectInput)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException
See Also:
Externalizable.writeExternal(java.io.ObjectOutput)


Copyright © 2009. All Rights Reserved.