Package org.jenkinsci.remoting.protocol
Class ProtocolStack.Ptr
- java.lang.Object
-
- org.jenkinsci.remoting.protocol.ProtocolStack.Ptr
-
- Enclosing class:
- ProtocolStack<T>
public class ProtocolStack.Ptr extends Object
Tracks where aProtocolLayer
is in theProtocolStack
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doCloseSend()
Requests the next layer down the stack to close output.void
doSend(ByteBuffer data)
EachProtocolLayer.Send
should call this method to hand data for sending down the stack to the nextProtocolLayer
(except for theNetworkLayer
which should eat the data).boolean
isRecvOpen()
Checks if the next layer up the stack is open to receive data.boolean
isSendOpen()
Checks if the next layer down the stack is open to send data.void
onRecv(ByteBuffer data)
EachProtocolLayer.Recv
should call this method to hand received data up the stack to the nextProtocolLayer
(except for theApplicationLayer
which should eat the data).void
onRecvClosed(IOException cause)
Notify the next layer up the stack that input has been closed.void
remove()
Requests removal of thisProtocolLayer
from theProtocolStack
ProtocolStack<?>
stack()
Helper method to access theProtocolStack
.
-
-
-
Method Detail
-
onRecv
public void onRecv(ByteBuffer data) throws IOException
EachProtocolLayer.Recv
should call this method to hand received data up the stack to the nextProtocolLayer
(except for theApplicationLayer
which 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
public void doSend(ByteBuffer data) throws IOException
EachProtocolLayer.Send
should call this method to hand data for sending down the stack to the nextProtocolLayer
(except for theNetworkLayer
which 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:
true
if 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:
true
if the next layer down the stack is open to send data.
-
stack
public ProtocolStack<?> stack()
Helper method to access theProtocolStack
.- Returns:
- the
ProtocolStack
.
-
remove
public void remove()
Requests removal of thisProtocolLayer
from theProtocolStack
-
doCloseSend
public void doCloseSend() throws IOException
Requests the next layer down the stack to close output.- Throws:
IOException
- if there was an error closing the output.
-
onRecvClosed
public void onRecvClosed(IOException cause) throws IOException
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.
-
-