Class ComputerLauncher
- All Implemented Interfaces:
ExtensionPoint
,Describable<ComputerLauncher>
- Direct Known Subclasses:
ComputerLauncherFilter
,DelegatingComputerLauncher
,JNLPLauncher
Computer
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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 Details
-
LIST
Deprecated.as of 1.281 UseExtension
for registration, and useJenkins.getDescriptorList(Class)
for read access.All registeredComputerLauncher
implementations.
-
-
Constructor Details
-
ComputerLauncher
public ComputerLauncher()
-
-
Method Details
-
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
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.as of 1.304 UseafterDisconnect(SlaveComputer, TaskListener)
-
beforeDisconnect
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.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
-
Extension
for registration, and useJenkins.getDescriptorList(Class)
for read access.