Package org.jenkinsci.remoting.engine
Class JnlpProtocol4Handler
java.lang.Object
org.jenkinsci.remoting.engine.JnlpProtocolHandler<Jnlp4ConnectionState>
org.jenkinsci.remoting.engine.JnlpProtocol4Handler
Implements the JNLP4-connect protocol. This protocol uses
SSLEngine to perform a TLS upgrade of the plaintext
connection before any connection secrets are exchanged. The subsequent connection is then secured using TLS. The
implementation uses the IOHub for non-blocking I/O wherever possible which removes the bottleneck of
the selector thread being used for linearization and I/O that creates a throughput limit with NioChannelHub.- Since:
- 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionJnlpProtocol4Handler(JnlpClientDatabase clientDatabase, ExecutorService threadPool, IOHub ioHub, SSLContext context, boolean needClientAuth, boolean preferNio) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionconnect(Socket socket, Map<String, String> headers, List<? extends JnlpConnectionStateListener> listeners) Handles an outgoing connection to the server on the supplied socket.createConnectionState(Socket socket, List<? extends JnlpConnectionStateListener> listeners) Creates theJnlpConnectionStateinstance for thisJnlpProtocolHandler.getName()Get the name of the protocol.handle(Socket socket, Map<String, String> headers, List<? extends JnlpConnectionStateListener> listeners) Handles an incoming client connection on the supplied socket.Methods inherited from class org.jenkinsci.remoting.engine.JnlpProtocolHandler
connect, getClientDatabase, handle, isEnabled, isPreferNio
-
Constructor Details
-
JnlpProtocol4Handler
public JnlpProtocol4Handler(@Nullable JnlpClientDatabase clientDatabase, @NonNull ExecutorService threadPool, @NonNull IOHub ioHub, @NonNull SSLContext context, boolean needClientAuth, boolean preferNio) Constructor.- Parameters:
clientDatabase- the client database.threadPool- the thread pool.ioHub- theIOHub.context- theSSLContext.needClientAuth- to force all clients to have a client certificate in order to connect.preferNio-truemeans that the protocol should attempt to use NIO if possible.
-
-
Method Details
-
getName
Get the name of the protocol.- Specified by:
getNamein classJnlpProtocolHandler<Jnlp4ConnectionState>
-
createConnectionState
@NonNull public Jnlp4ConnectionState createConnectionState(@NonNull Socket socket, @NonNull List<? extends JnlpConnectionStateListener> listeners) Description copied from class:JnlpProtocolHandlerCreates theJnlpConnectionStateinstance for thisJnlpProtocolHandler.- Specified by:
createConnectionStatein classJnlpProtocolHandler<Jnlp4ConnectionState>- Parameters:
socket- theSocketlisteners- the initialJnlpConnectionStateListenerinstances.- Returns:
- the
JnlpConnectionStatefor this connection.
-
handle
@NonNull public Future<Channel> handle(@NonNull Socket socket, @NonNull Map<String, String> headers, @NonNull List<? extends JnlpConnectionStateListener> listeners) throws IOExceptionHandles an incoming client connection on the supplied socket.- Specified by:
handlein classJnlpProtocolHandler<Jnlp4ConnectionState>- Parameters:
socket- the socket.headers- the headers to send to the client.listeners- the listeners to process the connection.- Returns:
- a
Futurefor theChannelto the server. - Throws:
IOException- if the protocol cannot be initiated.
-
connect
@NonNull public Future<Channel> connect(@NonNull Socket socket, @NonNull Map<String, String> headers, @NonNull List<? extends JnlpConnectionStateListener> listeners) throws IOExceptionHandles an outgoing connection to the server on the supplied socket.- Specified by:
connectin classJnlpProtocolHandler<Jnlp4ConnectionState>- Parameters:
socket- the socket.headers- the headers to send to the server.listeners- the listeners to process the connection.- Returns:
- a
Futurefor theChannelto the server. - Throws:
IOException- if the protocol cannot be initiated.
-