Class LegacyForkChannel
- java.lang.Object
-
- org.apache.maven.surefire.extensions.ForkChannel
-
- org.apache.maven.plugin.surefire.extensions.LegacyForkChannel
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
final class LegacyForkChannel extends ForkChannel
The main purpose of this class is to bind thecommand reader
reading the commands fromCommandReader
, serializing them and writing the stream to thesub-process
. It binds theevent handler
deserializing a received event and sends the event object to theevent handler
.
-
-
Field Summary
Fields Modifier and Type Field Description private CloseableDaemonThread
commandReaderBindings
private CloseableDaemonThread
eventHandlerBindings
-
Constructor Summary
Constructors Constructor Description LegacyForkChannel(ForkNodeArguments arguments)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bindCommandReader(CommandReader commands, java.nio.channels.WritableByteChannel stdIn)
Binds command handler to the channel.void
bindEventHandler(EventHandler<Event> eventHandler, CountdownCloseable countdownCloseable, java.nio.channels.ReadableByteChannel stdOut)
Starts a Thread reading the events.void
close()
void
disable()
int
getCountdownCloseablePermits()
the permits inCountdownCloseable
.java.lang.String
getForkNodeConnectionString()
This is server related class, which if binds to a TCP port, determines the connection string for the client.void
tryConnectToClient()
Asynchronously connects to the client.-
Methods inherited from class org.apache.maven.surefire.extensions.ForkChannel
getArguments
-
-
-
-
Field Detail
-
commandReaderBindings
private CloseableDaemonThread commandReaderBindings
-
eventHandlerBindings
private CloseableDaemonThread eventHandlerBindings
-
-
Constructor Detail
-
LegacyForkChannel
LegacyForkChannel(@Nonnull ForkNodeArguments arguments)
-
-
Method Detail
-
tryConnectToClient
public void tryConnectToClient()
Description copied from class:ForkChannel
Asynchronously connects to the client.- Specified by:
tryConnectToClient
in classForkChannel
-
getForkNodeConnectionString
public java.lang.String getForkNodeConnectionString()
Description copied from class:ForkChannel
This is server related class, which if binds to a TCP port, determines the connection string for the client.- Specified by:
getForkNodeConnectionString
in classForkChannel
- Returns:
- a connection string utilized by the client in the fork JVM
-
getCountdownCloseablePermits
public int getCountdownCloseablePermits()
Description copied from class:ForkChannel
the permits inCountdownCloseable
.- Specified by:
getCountdownCloseablePermits
in classForkChannel
-
bindCommandReader
public void bindCommandReader(@Nonnull CommandReader commands, java.nio.channels.WritableByteChannel stdIn)
Description copied from class:ForkChannel
Binds command handler to the channel. Starts a Thread streaming out the commands.- Specified by:
bindCommandReader
in classForkChannel
- Parameters:
commands
- command reader, seeCommandReader.readNextCommand()
stdIn
- optional standard input stream of the JVM to write the encoded commands into it
-
bindEventHandler
public void bindEventHandler(@Nonnull EventHandler<Event> eventHandler, @Nonnull CountdownCloseable countdownCloseable, java.nio.channels.ReadableByteChannel stdOut)
Description copied from class:ForkChannel
Starts a Thread reading the events.- Specified by:
bindEventHandler
in classForkChannel
- Parameters:
eventHandler
- event eventHandlercountdownCloseable
- count down of the final call ofCloseable.close()
stdOut
- optional standard output stream of the JVM
-
disable
public void disable()
- Specified by:
disable
in classForkChannel
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classForkChannel
-
-