Package org.jenkinsci.remoting.protocol
Class ProtocolStack.Ptr
java.lang.Object
org.jenkinsci.remoting.protocol.ProtocolStack.Ptr
- Enclosing class:
ProtocolStack<T>
Tracks where a
ProtocolLayer is in the ProtocolStack.-
Method Summary
Modifier and TypeMethodDescriptionvoidRequests the next layer down the stack to close output.voiddoSend(ByteBuffer data) EachProtocolLayer.Sendshould call this method to hand data for sending down the stack to the nextProtocolLayer(except for theNetworkLayerwhich should eat the data).booleanChecks if the next layer up the stack is open to receive data.booleanChecks if the next layer down the stack is open to send data.voidonRecv(ByteBuffer data) EachProtocolLayer.Recvshould call this method to hand received data up the stack to the nextProtocolLayer(except for theApplicationLayerwhich should eat the data).voidonRecvClosed(IOException cause) Notify the next layer up the stack that input has been closed.voidremove()Requests removal of thisProtocolLayerfrom theProtocolStackstack()Helper method to access theProtocolStack.
-
Method Details
-
onRecv
EachProtocolLayer.Recvshould call this method to hand received data up the stack to the nextProtocolLayer(except for theApplicationLayerwhich should eat the data).- Parameters:
data- the data to submit to the next layer up the stack.- Throws:
IOException- if the next layer could not process the data.
-
doSend
EachProtocolLayer.Sendshould call this method to hand data for sending down the stack to the nextProtocolLayer(except for theNetworkLayerwhich should eat the data).- Parameters:
data- the data to submit to the next layer down the stack.- Throws:
IOException- if the next layer could not process the data.
-
isRecvOpen
public boolean isRecvOpen()Checks if the next layer up the stack is open to receive data.- Returns:
trueif the next layer up the stack is open to receive data.
-
isSendOpen
public boolean isSendOpen()Checks if the next layer down the stack is open to send data.- Returns:
trueif the next layer down the stack is open to send data.
-
stack
Helper method to access theProtocolStack.- Returns:
- the
ProtocolStack.
-
remove
public void remove()Requests removal of thisProtocolLayerfrom theProtocolStack -
doCloseSend
Requests the next layer down the stack to close output.- Throws:
IOException- if there was an error closing the output.
-
onRecvClosed
Notify the next layer up the stack that input has been closed.- Parameters:
cause- the cause of the lower layer being closed ornull.- Throws:
IOException- if there was an error processing the close notification.
-