Class ConnectionHeadersFilterLayer
java.lang.Object
org.jenkinsci.remoting.protocol.FilterLayer
org.jenkinsci.remoting.protocol.impl.ConnectionHeadersFilterLayer
- All Implemented Interfaces:
ProtocolLayer,ProtocolLayer.Recv,ProtocolLayer.Send
Performs the connection header negotiation.
- Since:
- 3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA listener for the connection headers.Nested classes/interfaces inherited from interface org.jenkinsci.remoting.protocol.ProtocolLayer
ProtocolLayer.Recv, ProtocolLayer.Send -
Field Summary
Fields inherited from interface org.jenkinsci.remoting.protocol.ProtocolLayer
EMPTY_BUFFER -
Constructor Summary
ConstructorsConstructorDescriptionConnectionHeadersFilterLayer(Map<String, String> headers, ConnectionHeadersFilterLayer.Listener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcomplete()voiddoSend(ByteBuffer data) SPI: Sends data to the lower layer.booleanTracks if this layer is accepting received data viaProtocolLayer.Recv.onRecv(ByteBuffer).booleanTracks if this layer is submitting data to be sent viaProtocolLayer.Send.doSend(ByteBuffer).voidonRecv(ByteBuffer data) SPI: Callback on data being received from the lower layer.voidonRecvClosed(IOException cause) Callback on the lower layer's source of data being closed.voidstart()Starts this layer.Methods inherited from class org.jenkinsci.remoting.protocol.FilterLayer
abort, completed, doCloseSend, flushRecv, flushSend, init, next, stack
-
Constructor Details
-
ConnectionHeadersFilterLayer
public ConnectionHeadersFilterLayer(Map<String, String> headers, ConnectionHeadersFilterLayer.Listener listener) Constructor.- Parameters:
headers- Our headers to send.listener- Our listener to decide the response to the remote headers.
-
-
Method Details
-
start
public void start()Starts this layer. All layers in the stack will be initialized before a call to this method. All lower layers in the stack will have been started before this layer is started.- Specified by:
startin interfaceProtocolLayer- Overrides:
startin classFilterLayer
-
onRecv
SPI: Callback on data being received from the lower layer.- Specified by:
onRecvin interfaceProtocolLayer.Recv- Specified by:
onRecvin classFilterLayer- Parameters:
data- the data received. Any data consumed from theByteBuffercan be assumed as processed. Any data not consumed from theByteBufferwill be the responsibility of the caller to resubmit in subsequent calls.- Throws:
IOException- if there was an error during processing of the received data.
-
complete
protected void complete() -
onRecvClosed
Callback on the lower layer's source of data being closed.- Specified by:
onRecvClosedin interfaceProtocolLayer.Recv- Overrides:
onRecvClosedin classFilterLayer- Parameters:
cause- the cause of the lower layer being closed ornull.- Throws:
IOException- if there was an error during the processing of the close notification.
-
isRecvOpen
public boolean isRecvOpen()Tracks if this layer is accepting received data viaProtocolLayer.Recv.onRecv(ByteBuffer). Once this method returnsfalseit must always returnfalseand can be assumed to behave in this way.- Specified by:
isRecvOpenin interfaceProtocolLayer.Recv- Overrides:
isRecvOpenin classFilterLayer- Returns:
trueif accepting received data viaProtocolLayer.Recv.onRecv(ByteBuffer).
-
doSend
SPI: Sends data to the lower layer.- Specified by:
doSendin interfaceProtocolLayer.Send- Specified by:
doSendin classFilterLayer- Parameters:
data- the data to send. Any data consumed from theByteBuffercan be assumed as processed. Any data not consumed from theByteBufferwill be the responsibility of the caller to resubmit in subsequent calls.- Throws:
IOException- if there was an error during processing of the data.
-
isSendOpen
public boolean isSendOpen()Tracks if this layer is submitting data to be sent viaProtocolLayer.Send.doSend(ByteBuffer). Once this method returnsfalseit must always returnfalseand can be assumed to behave in this way.- Specified by:
isSendOpenin interfaceProtocolLayer.Send- Overrides:
isSendOpenin classFilterLayer- Returns:
trueif submitting data to be sent viaProtocolLayer.Send.doSend(ByteBuffer).
-