Class DelegatingComputerLauncher
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<ComputerLauncher>
-
- hudson.slaves.ComputerLauncher
-
- hudson.slaves.DelegatingComputerLauncher
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<ComputerLauncher>
public abstract class DelegatingComputerLauncher extends ComputerLauncher
Base implementation ofComputerLauncher
that to be used by launchers that perform some initialization (typically something cloud/v12n related to power up the machine), and then delegate to anotherComputerLauncher
to connect. If you are delegating to anotherComputerLauncher
you must extend this base class- Since:
- 1.382
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DelegatingComputerLauncher.DescriptorImpl
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description protected ComputerLauncher
launcher
-
Fields inherited from class hudson.slaves.ComputerLauncher
LIST
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DelegatingComputerLauncher(ComputerLauncher launcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterDisconnect(SlaveComputer computer, TaskListener listener)
Allows theComputerLauncher
to tidy-up after a disconnect.void
beforeDisconnect(SlaveComputer computer, TaskListener listener)
Allows theComputerLauncher
to prepare for a disconnect.ComputerLauncher
getLauncher()
void
launch(SlaveComputer computer, TaskListener listener)
Launches the agent for the givenComputer
.-
Methods inherited from class hudson.slaves.ComputerLauncher
afterDisconnect, beforeDisconnect, checkJavaVersion, isLaunchSupported, launch
-
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
-
-
-
Field Detail
-
launcher
protected ComputerLauncher launcher
-
-
Constructor Detail
-
DelegatingComputerLauncher
protected DelegatingComputerLauncher(ComputerLauncher launcher)
-
-
Method Detail
-
getLauncher
public ComputerLauncher getLauncher()
-
launch
public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException
Description copied from class:ComputerLauncher
Launches the agent for the givenComputer
.If the 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 throughStreamTaskListener
.) 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, useComputer.isOnline()
at the end.This method must operate synchronously. Asynchrony is provided by
Computer.connect(boolean)
and its correct operation depends on this.- Overrides:
launch
in classComputerLauncher
listener
- The progress of the launch, as well as any error, should be sent to this listener.- Throws:
IOException
- if the method throws anIOException
orInterruptedException
, 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 diligently catch those exceptions.InterruptedException
-
afterDisconnect
public void afterDisconnect(SlaveComputer computer, TaskListener listener)
Description copied from class:ComputerLauncher
Allows theComputerLauncher
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.- Overrides:
afterDisconnect
in classComputerLauncher
-
beforeDisconnect
public void beforeDisconnect(SlaveComputer computer, TaskListener listener)
Description copied from class:ComputerLauncher
Allows theComputerLauncher
to prepare for a disconnect.This method is invoked before the
Channel
to this computer is terminated, thus the channel is still accessible fromSlaveComputer.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.- Overrides:
beforeDisconnect
in classComputerLauncher
-
-