Package org.apache.zookeeper.server
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 List<Id>authInfoServerCnxncnxnlongcommitProcQueueStartTimelongcommitRecvTimelongcreateTimeintcxidlongprepQueueStartTimelongprepStartTimeQuorumVerifierqvstatic RequestrequestOfDeathlongrequestThrottleQueueTimelongsessionIdlongsyncQueueStartTimeinttypelongzxid
-
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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerCnxngetConnection()KeeperExceptiongetException()TxnHeadergetHdr()intgetLargeRequestSize()ObjectgetOwner()byte[]getSerializeData()static booleangetStaleConnectionCheck()static booleangetStaleLatencyCheck()RecordgetTxn()TxnDigestgetTxnDigest()StringgetUsersForAudit()Returns a formatted, comma-separated list of the user IDs associated with thisRequest, ornullif no user IDs were found.booleanisFromLearner()booleanisLocalSession()booleanisQuorum()booleanisStale()booleanisThrottlable()booleanisThrottled()voidlogLatency(Summary metric)voidlogLatency(Summary metric, long currentTime)voidlogLatency(SummarySet metric, String key)voidlogLatency(SummarySet metric, String key, long currentTime)booleanmustDrop()A prior request was dropped on this request's connection and therefore this request must also be dropped to ensure correct ordering semantics.static Stringop2String(int op)byte[]readRequestBytes()<T extends Record>
TreadRequestRecord(Supplier<T> constructor)<T extends Record>
TreadRequestRecordNoException(Supplier<T> constructor)StringrequestDigest()voidsetException(KeeperException e)voidsetHdr(TxnHeader hdr)voidsetIsThrottled(boolean val)voidsetLargeRequestSize(int size)voidsetLocalSession(boolean isLocalSession)voidsetOwner(Object owner)static voidsetStaleConnectionCheck(boolean check)static voidsetStaleLatencyCheck(boolean check)voidsetTxn(Record txn)voidsetTxnDigest(TxnDigest txnDigest)StringtoString()
-
-
-
Field Detail
-
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
-
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 Detail
-
Request
public Request(ServerCnxn cnxn, long sessionId, int xid, int type, RequestRecord request, List<Id> authInfo)
-
-
Method Detail
-
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)
-
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 thisRequest, ornullif 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 correspondingscheme, nor are its components escaped. This is not a security feature.- Returns:
- a comma-separated list of user IDs, or
nullif no user IDs were found.
-
getTxnDigest
public TxnDigest getTxnDigest()
-
setTxnDigest
public void setTxnDigest(TxnDigest txnDigest)
-
isFromLearner
public boolean isFromLearner()
-
-