# Class Request

java.lang.Object
org.apache.zookeeper.server.Request

Direct Known Subclasses:
  `LearnerSyncRequest`

public class Request extends Object
This is the structure that represents a request moving through a chain of RequestProcessors. There are various pieces of information that is tacked onto the request as it is processed.

## Field Summary

Fields
Modifier and Type
Field
Description
`final List<Id>`
`authInfo`
`final ServerCnxn`
`cnxn`
`long`
`commitProcQueueStartTime`
`long`
`commitRecvTime`
`final long`
`createTime`
`final int`
`cxid`
`long`
`prepQueueStartTime`
`long`
`prepStartTime`
`QuorumVerifier`
`qv`
`static final Request`
`requestOfDeath`
`long`
`requestThrottleQueueTime`
`final long`
`sessionId`
`long`
`syncQueueStartTime`
`final int`
`type`
`long`
`zxid`

## Constructor Summary

Constructors
Constructor
Description
`Request(long sessionId, int xid, int type, TxnHeader hdr, Record txn, long zxid)`
`Request(ServerCnxn cnxn, long sessionId, int xid, int type, RequestRecord request, List<Id> authInfo)`
`Request(TxnHeader hdr, Record txn, TxnDigest digest)`

## Method Summary

Modifier and Type
Method
Description
`ServerCnxn`
`getConnection()`
`KeeperException`
`getException()`
`TxnHeader`
`getHdr()`
`int`
`getLargeRequestSize()`
`Object`
`getOwner()`
`byte[]`
`getSerializeData()`
`static boolean`
`getStaleConnectionCheck()`
`static boolean`
`getStaleLatencyCheck()`
`Record`
`getTxn()`
`TxnDigest`
`getTxnDigest()`
`String`
`getUsersForAudit()`
Returns a formatted, comma-separated list of the user IDs associated with this `Request`, or `null` if no user IDs were found.
`boolean`
`isFromLearner()`
`boolean`
`isLocalSession()`
`boolean`
`isQuorum()`
`boolean`
`isStale()`
`boolean`
`isThrottlable()`
`boolean`
`isThrottled()`
`void`
`logLatency(Summary metric)`
`void`
`logLatency(Summary metric, long currentTime)`
`void`
`logLatency(SummarySet metric, String key)`
`void`
`logLatency(SummarySet metric, String key, long currentTime)`
`boolean`
`mustDrop()`
A prior request was dropped on this request's connection and therefore this request must also be dropped to ensure correct ordering semantics.
`static String`
`op2String(int op)`
`byte[]`
`readRequestBytes()`
`<T extends Record>
T`
`readRequestRecord(Supplier<T> constructor)`
`<T extends Record>
T`
`readRequestRecordNoException(Supplier<T> constructor)`
`String`
`requestDigest()`
`void`
`setException(KeeperException e)`
`void`
`setHdr(TxnHeader hdr)`
`void`
`setIsThrottled(boolean val)`
`void`
`setLargeRequestSize(int size)`
`void`
`setLocalSession(boolean isLocalSession)`
`void`
`setOwner(Object owner)`
`static void`
`setStaleConnectionCheck(boolean check)`
`static void`
`setStaleLatencyCheck(boolean check)`
`void`
`setTxn(Record txn)`
`void`
`setTxnDigest(TxnDigest txnDigest)`
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### requestOfDeath

public static final Request requestOfDeath

### sessionId

public final long sessionId

### cxid

public final int cxid

### type

public final int type

### cnxn

public final ServerCnxn cnxn

### zxid

public long zxid

### authInfo

public final List<Id> authInfo

### createTime

public final long createTime

### prepQueueStartTime

public long prepQueueStartTime

### prepStartTime

public long prepStartTime

### commitProcQueueStartTime

public long commitProcQueueStartTime

### commitRecvTime

public long commitRecvTime

### syncQueueStartTime

public long syncQueueStartTime

### requestThrottleQueueTime

public long requestThrottleQueueTime

### qv

public QuorumVerifier qv

## Constructor Details

### Request

public Request(ServerCnxn cnxn, long sessionId, int xid, int type, RequestRecord request, List<Id> authInfo)

### Request

public Request(long sessionId, int xid, int type, TxnHeader hdr, Record txn, long zxid)

### Request

public Request(TxnHeader hdr, Record txn, TxnDigest digest)

## Method Details

### readRequestRecord

public <T extends Record> T readRequestRecord(Supplier<T> constructor) throws IOException

Throws:
  `IOException`

### readRequestRecordNoException

public <T extends Record> T readRequestRecordNoException(Supplier<T> constructor)

### readRequestBytes

public byte[] readRequestBytes()

### requestDigest

public String requestDigest()

### isThrottled

public boolean isThrottled()

### setIsThrottled

public void setIsThrottled(boolean val)

### isThrottlable

public boolean isThrottlable()

### getSerializeData

public byte[] getSerializeData()

### isLocalSession

public boolean isLocalSession()

### setLocalSession

public void setLocalSession(boolean isLocalSession)

### setLargeRequestSize

public void setLargeRequestSize(int size)

### getLargeRequestSize

public int getLargeRequestSize()

### getOwner

public Object getOwner()

### setOwner

public void setOwner(Object owner)

### getHdr

public TxnHeader getHdr()

### setHdr

public void setHdr(TxnHeader hdr)

### getTxn

public Record getTxn()

### setTxn

public void setTxn(Record txn)

### getConnection

public ServerCnxn getConnection()

### getStaleLatencyCheck

public static boolean getStaleLatencyCheck()

### setStaleLatencyCheck

public static void setStaleLatencyCheck(boolean check)

### getStaleConnectionCheck

public static boolean getStaleConnectionCheck()

### setStaleConnectionCheck

public static void setStaleConnectionCheck(boolean check)

### isStale

public boolean isStale()

### mustDrop

public boolean mustDrop()
A prior request was dropped on this request's connection and therefore this request must also be dropped to ensure correct ordering semantics.

### isQuorum

public boolean isQuorum()

### op2String

public static String op2String(int op)

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### setException

public void setException(KeeperException e)

### getException

public KeeperException getException()

### logLatency

public void logLatency(Summary metric)

### logLatency

public void logLatency(Summary metric, long currentTime)

### logLatency

public void logLatency(SummarySet metric, String key, long currentTime)

### logLatency

public void logLatency(SummarySet metric, String key)

### getUsersForAudit

public String getUsersForAudit()
Returns a formatted, comma-separated list of the user IDs associated with this `Request`, or `null` if no user IDs were found. The return value is used for audit logging. While it may be easy on the eyes, it is underspecified: it does not mention the corresponding `scheme`, nor are its components escaped. This is not a security feature.

Returns:
  a comma-separated list of user IDs, or `null` if no user IDs were found.

### getTxnDigest

public TxnDigest getTxnDigest()

### setTxnDigest

public void setTxnDigest(TxnDigest txnDigest)

### isFromLearner

public boolean isFromLearner()