Class ComputerLauncher
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<ComputerLauncher>
-
- hudson.slaves.ComputerLauncher
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<ComputerLauncher>
- Direct Known Subclasses:
ComputerLauncherFilter
,DelegatingComputerLauncher
,JNLPLauncher
public abstract class ComputerLauncher extends AbstractDescribableImpl<ComputerLauncher> implements ExtensionPoint
Extension point to allow control over howComputer
s are "launched", meaning how they get connected to their agent program.Associated View
- main.jelly
- This page will be rendered into the top page of the computer (/computer/NAME/) Useful for showing launch related commands and status reports.
- Since:
- 1.216-ish
- Author:
- Stephen Connolly
- See Also:
ComputerConnector
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static DescriptorList<ComputerLauncher>
LIST
Deprecated.as of 1.281 UseExtension
for registration, and useJenkins.getDescriptorList(Class)
for read access.
-
Constructor Summary
Constructors Constructor Description ComputerLauncher()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterDisconnect(SlaveComputer computer, TaskListener listener)
Allows theComputerLauncher
to tidy-up after a disconnect.void
afterDisconnect(SlaveComputer computer, StreamTaskListener listener)
Deprecated.as of 1.304 UseafterDisconnect(SlaveComputer, TaskListener)
void
beforeDisconnect(SlaveComputer computer, TaskListener listener)
Allows theComputerLauncher
to prepare for a disconnect.void
beforeDisconnect(SlaveComputer computer, StreamTaskListener listener)
Deprecated.as of 1.304 UsebeforeDisconnect(SlaveComputer, TaskListener)
protected static void
checkJavaVersion(PrintStream logger, String javaCommand, BufferedReader r)
Given the output of "java -version" inr
, determine if this version of Java is supported, or throwIOException
.boolean
isLaunchSupported()
Returns true if thisComputerLauncher
supports programmatic launch of the agent in the targetComputer
.void
launch(SlaveComputer computer, TaskListener listener)
Launches the agent for the givenComputer
.void
launch(SlaveComputer computer, StreamTaskListener listener)
Deprecated.as of 1.304 Uselaunch(SlaveComputer, TaskListener)
-
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
-
-
-
Field Detail
-
LIST
@Deprecated public static final DescriptorList<ComputerLauncher> LIST
Deprecated.as of 1.281 UseExtension
for registration, and useJenkins.getDescriptorList(Class)
for read access.All registeredComputerLauncher
implementations.
-
-
Method Detail
-
isLaunchSupported
public boolean isLaunchSupported()
Returns true if thisComputerLauncher
supports programmatic launch of the agent in the targetComputer
.
-
launch
public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException
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.- Parameters:
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
-
launch
@Deprecated public void launch(SlaveComputer computer, StreamTaskListener listener) throws IOException, InterruptedException
Deprecated.as of 1.304 Uselaunch(SlaveComputer, TaskListener)
- Throws:
IOException
InterruptedException
-
afterDisconnect
public void afterDisconnect(SlaveComputer computer, TaskListener listener)
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.
-
afterDisconnect
@Deprecated public void afterDisconnect(SlaveComputer computer, StreamTaskListener listener)
Deprecated.as of 1.304 UseafterDisconnect(SlaveComputer, TaskListener)
-
beforeDisconnect
public void beforeDisconnect(SlaveComputer computer, TaskListener listener)
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.
-
beforeDisconnect
@Deprecated public void beforeDisconnect(SlaveComputer computer, StreamTaskListener listener)
Deprecated.as of 1.304 UsebeforeDisconnect(SlaveComputer, TaskListener)
-
checkJavaVersion
protected static void checkJavaVersion(PrintStream logger, String javaCommand, BufferedReader r) throws IOException
Given the output of "java -version" inr
, determine if this version of Java is supported, or throwIOException
.- Parameters:
logger
- where to log the outputjavaCommand
- the command executed, used for loggingr
- the output of "java -version"- Throws:
IOException
-
-