Class ForkChannel
java.lang.Object
org.apache.maven.surefire.extensions.ForkChannel
- All Implemented Interfaces:
 Closeable,AutoCloseable
It's a session object used only by a particular Thread in ForkStarter
 and communicates with a dedicated forked JVM. It represents a server.
 
 
It connects to a remote client by
It connects to a remote client by
tryConnectToClient(), provides a connection string
 getForkNodeConnectionString() needed by the client in forked JVM, binds event handler and command reader.
 This object is called in one Thread.- Since:
 - 3.0.0-M5
 - Author:
 - Tibor Digana (tibor17)
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionabstract voidbindCommandReader(CommandReader commands, WritableByteChannel stdIn) Binds command handler to the channel.abstract voidbindEventHandler(EventHandler<Event> eventHandler, CountdownCloseable countdownCloseable, ReadableByteChannel stdOut) Starts a Thread reading the events.abstract voidclose()abstract voiddisable()protected ForkNodeArgumentsabstract intthe permits inCountdownCloseable.abstract StringThis is server related class, which if binds to a TCP port, determines the connection string for the client.abstract voidAsynchronously connects to the client. 
- 
Constructor Details
- 
ForkChannel
- Parameters:
 arguments- data necessary for command reader and event handler.
 
 - 
 - 
Method Details
- 
tryConnectToClient
Asynchronously connects to the client.- Throws:
 IOException- if stream failsInterruptedException- if interrupted thread
 - 
getForkNodeConnectionString
This is server related class, which if binds to a TCP port, determines the connection string for the client.- Returns:
 - a connection string utilized by the client in the fork JVM
 
 - 
getCountdownCloseablePermits
public abstract int getCountdownCloseablePermits()the permits inCountdownCloseable. - 
bindCommandReader
public abstract void bindCommandReader(@Nonnull CommandReader commands, WritableByteChannel stdIn) throws IOException, InterruptedException Binds command handler to the channel. Starts a Thread streaming out the commands.- Parameters:
 commands- command reader, seeCommandReader.readNextCommand()stdIn- optional standard input stream of the JVM to write the encoded commands into it- Throws:
 IOException- if an error in the fork channelInterruptedException- channel interrupted
 - 
bindEventHandler
public abstract void bindEventHandler(@Nonnull EventHandler<Event> eventHandler, @Nonnull CountdownCloseable countdownCloseable, ReadableByteChannel stdOut) throws IOException, InterruptedException Starts a Thread reading the events.- Parameters:
 eventHandler- event eventHandlercountdownCloseable- count down of the final call ofCloseable.close()stdOut- optional standard output stream of the JVM- Throws:
 IOException- if an error in the fork channelInterruptedException- channel interrupted
 - 
getArguments
 - 
disable
public abstract void disable() - 
close
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable- Throws:
 IOException
 
 -