Class JNLPLauncher
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<ComputerLauncher>
-
- hudson.slaves.ComputerLauncher
-
- hudson.slaves.JNLPLauncher
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<ComputerLauncher>
public class JNLPLauncher extends ComputerLauncher
ComputerLauncher
via inbound connections.- Author:
- Stephen Connolly, Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JNLPLauncher.DescriptorImpl
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static String
CUSTOM_INBOUND_URL_PROPERTY
static Descriptor<ComputerLauncher>
DESCRIPTOR
Deprecated.as of 1.XXX UseJenkins.getDescriptor(Class)
String
tunnel
If the agent needs to tunnel the connection to the controller, specify the "host:port" here.String
vmargs
Deprecated.No longer used.-
Fields inherited from class hudson.slaves.ComputerLauncher
LIST
-
-
Constructor Summary
Constructors Constructor Description JNLPLauncher()
Deprecated.This Launcher does not enable the work directory.JNLPLauncher(boolean enableWorkDir)
Constructor with default options.JNLPLauncher(String tunnel)
JNLPLauncher(String tunnel, String vmargs)
Deprecated.JNLPLauncher(String tunnel, String vmargs, RemotingWorkDirSettings workDirSettings)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
getInboundAgentUrl()
Overrides the url that inbound TCP agents should connect to as advertised in the agent.jnlp file.String
getWorkDirOptions(Computer computer)
Gets work directory options as a String.RemotingWorkDirSettings
getWorkDirSettings()
Returns work directory settings.boolean
isLaunchSupported()
Returns true if thisComputerLauncher
supports programmatic launch of the agent in the targetComputer
.boolean
isWebSocket()
void
launch(SlaveComputer computer, TaskListener listener)
Launches the agent for the givenComputer
.protected Object
readResolve()
void
setWebSocket(boolean webSocket)
void
setWorkDirSettings(RemotingWorkDirSettings workDirSettings)
-
Methods inherited from class hudson.slaves.ComputerLauncher
afterDisconnect, afterDisconnect, beforeDisconnect, beforeDisconnect, checkJavaVersion, launch
-
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
-
-
-
Field Detail
-
tunnel
@CheckForNull public final String tunnel
If the agent needs to tunnel the connection to the controller, specify the "host:port" here. This can include the special syntax "host:" and ":port" to indicate the default host/port shall be used.Null if no tunneling is necessary.
- Since:
- 1.250
-
vmargs
@Deprecated public final transient String vmargs
Deprecated.No longer used.
-
CUSTOM_INBOUND_URL_PROPERTY
@NonNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String CUSTOM_INBOUND_URL_PROPERTY
- See Also:
getInboundAgentUrl()
, Constant Field Values
-
DESCRIPTOR
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static Descriptor<ComputerLauncher> DESCRIPTOR
Deprecated.as of 1.XXX UseJenkins.getDescriptor(Class)
-
-
Constructor Detail
-
JNLPLauncher
@Deprecated public JNLPLauncher(@CheckForNull String tunnel, @CheckForNull String vmargs, @CheckForNull RemotingWorkDirSettings workDirSettings)
Deprecated.Constructor.- Parameters:
tunnel
- Tunnel settingsvmargs
- JVM argumentsworkDirSettings
- Settings for Work Directory management in Remoting. Ifnull
,RemotingWorkDirSettings.getEnabledDefaults()
will be used to enable work directories by default in new agents.- Since:
- 2.68
-
JNLPLauncher
@DataBoundConstructor public JNLPLauncher(@CheckForNull String tunnel)
-
JNLPLauncher
@Deprecated public JNLPLauncher(@CheckForNull String tunnel, @CheckForNull String vmargs)
Deprecated.
-
JNLPLauncher
@Deprecated public JNLPLauncher()
Deprecated.This Launcher does not enable the work directory. It is recommended to useJNLPLauncher(boolean)
-
JNLPLauncher
public JNLPLauncher(boolean enableWorkDir)
Constructor with default options.- Parameters:
enableWorkDir
- Iftrue
, the work directory will be enabled with default settings.
-
-
Method Detail
-
readResolve
protected Object readResolve()
-
getWorkDirSettings
@NonNull public RemotingWorkDirSettings getWorkDirSettings()
Returns work directory settings.- Since:
- 2.72
-
setWorkDirSettings
@DataBoundSetter public final void setWorkDirSettings(@NonNull RemotingWorkDirSettings workDirSettings)
-
isLaunchSupported
public boolean isLaunchSupported()
Description copied from class:ComputerLauncher
Returns true if thisComputerLauncher
supports programmatic launch of the agent in the targetComputer
.- Overrides:
isLaunchSupported
in classComputerLauncher
-
isWebSocket
public boolean isWebSocket()
- Since:
- 2.216
-
setWebSocket
@DataBoundSetter public void setWebSocket(boolean webSocket)
- Since:
- 2.216
-
launch
public void launch(SlaveComputer computer, TaskListener listener)
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.
-
getWorkDirOptions
@NonNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getWorkDirOptions(@NonNull Computer computer)
Gets work directory options as a String. In public APIgetWorkDirSettings().toCommandLineArgs(computer)
should be used instead- Parameters:
computer
- Computer- Returns:
- Command line options for launching with the WorkDir
-
getInboundAgentUrl
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String getInboundAgentUrl()
Overrides the url that inbound TCP agents should connect to as advertised in the agent.jnlp file. If not set, the default behavior is unchanged and returns the root URL. This enables using a private address for inbound tcp agents, separate from Jenkins root URL.- See Also:
- JENKINS-63222
-
-