public abstract class ComputerLauncher extends AbstractDescribableImpl<ComputerLauncher> implements ExtensionPoint
Computer
s are "launched",
meaning how they get connected to their slave agent program.
ComputerConnector
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
static DescriptorList<ComputerLauncher> |
LIST
Deprecated.
as of 1.281
Use
Extension for registration, and use
Jenkins.getDescriptorList(Class) for read access. |
Constructor and Description |
---|
ComputerLauncher() |
Modifier and Type | Method and Description |
---|---|
void |
afterDisconnect(SlaveComputer computer,
StreamTaskListener listener)
Deprecated.
as of 1.304
Use
afterDisconnect(SlaveComputer, TaskListener) |
void |
afterDisconnect(SlaveComputer computer,
TaskListener listener)
Allows the
ComputerLauncher to tidy-up after a disconnect. |
void |
beforeDisconnect(SlaveComputer computer,
StreamTaskListener listener)
Deprecated.
as of 1.304
Use
beforeDisconnect(SlaveComputer, TaskListener) |
void |
beforeDisconnect(SlaveComputer computer,
TaskListener listener)
Allows the
ComputerLauncher to prepare for a disconnect. |
protected static void |
checkJavaVersion(PrintStream logger,
String javaCommand,
BufferedReader r)
Given the output of "java -version" in
r , determine if this
version of Java is supported, or throw IOException . |
boolean |
isLaunchSupported()
Returns true if this
ComputerLauncher supports
programatic launch of the slave agent in the target Computer . |
void |
launch(SlaveComputer computer,
StreamTaskListener listener)
Deprecated.
as of 1.304
Use
launch(SlaveComputer, TaskListener) |
void |
launch(SlaveComputer computer,
TaskListener listener)
Launches the slave agent for the given
Computer . |
getDescriptor
@Deprecated public static final DescriptorList<ComputerLauncher> LIST
Extension
for registration, and use
Jenkins.getDescriptorList(Class)
for read access.ComputerLauncher
implementations.public boolean isLaunchSupported()
ComputerLauncher
supports
programatic launch of the slave agent in the target Computer
.public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException
Computer
.
If the slave agent is launched successfully, SlaveComputer.setChannel(InputStream, OutputStream, TaskListener, Channel.Listener)
should be invoked in the end to notify Hudson of the established connection.
The operation could also fail, in which case there's no need to make any callback notification,
(except to notify the user of the failure through StreamTaskListener
.)
Also note that the normal return of this method call does not necessarily signify a successful launch.
If someone programmatically calls this method and wants to find out if the launch was a success,
use Computer.isOnline()
at the end.
This method must operate synchronously. Asynchrony is provided by Computer.connect(boolean)
and
its correct operation depends on this.
listener
- The progress of the launch, as well as any error, should be sent to this listener.IOException
- if the method throws an IOException
or InterruptedException
, the launch was considered
a failure and the stack trace is reported into the listener. This handling is just so that the implementation
of this method doesn't have to dilligently catch those exceptions.InterruptedException
@Deprecated public void launch(SlaveComputer computer, StreamTaskListener listener) throws IOException, InterruptedException
launch(SlaveComputer, TaskListener)
IOException
InterruptedException
public void afterDisconnect(SlaveComputer computer, TaskListener listener)
ComputerLauncher
to tidy-up after a disconnect.
This method is invoked after the Channel
to this computer is terminated.
Disconnect operation is performed asynchronously, so there's no guarantee
that the corresponding SlaveComputer
exists for the duration of the
operation.
@Deprecated public void afterDisconnect(SlaveComputer computer, StreamTaskListener listener)
afterDisconnect(SlaveComputer, TaskListener)
public void beforeDisconnect(SlaveComputer computer, TaskListener listener)
ComputerLauncher
to prepare for a disconnect.
This method is invoked before the Channel
to this computer is terminated,
thus the channel is still accessible from SlaveComputer.getChannel()
.
If the channel is terminated unexpectedly, this method will not be invoked,
as the channel is already gone.
Disconnect operation is performed asynchronously, so there's no guarantee
that the corresponding SlaveComputer
exists for the duration of the
operation.
@Deprecated public void beforeDisconnect(SlaveComputer computer, StreamTaskListener listener)
beforeDisconnect(SlaveComputer, TaskListener)
protected static void checkJavaVersion(PrintStream logger, String javaCommand, BufferedReader r) throws IOException
r
, determine if this
version of Java is supported, or throw IOException
.logger
- where to log the outputjavaCommand
- the command executed, used for loggingr
- the output of "java -version"IOException
Copyright © 2018. All rights reserved.