hudson.slaves
Class ComputerLauncherFilter

java.lang.Object
  extended by hudson.model.AbstractDescribableImpl<ComputerLauncher>
      extended by hudson.slaves.ComputerLauncher
          extended by hudson.slaves.ComputerLauncherFilter
All Implemented Interfaces:
ExtensionPoint, Describable<ComputerLauncher>

public abstract class ComputerLauncherFilter
extends ComputerLauncher

ComputerLauncher filter that can be used as a base class for decorators.

Using this class also protects you from method additions in ComputerLauncher, since these two classes are updated in sync.

Author:
Kohsuke Kawaguchi
See Also:
SlaveComputer.grabLauncher(Node)

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
protected  ComputerLauncher core
           
 
Fields inherited from class hudson.slaves.ComputerLauncher
LIST
 
Constructor Summary
ComputerLauncherFilter(ComputerLauncher core)
           
 
Method Summary
 void afterDisconnect(SlaveComputer computer, TaskListener listener)
          Allows the ComputerLauncher to tidy-up after a disconnect.
 void beforeDisconnect(SlaveComputer computer, TaskListener listener)
          Allows the ComputerLauncher to prepare for a disconnect.
 ComputerLauncher getCore()
          Returns the delegation target.
 Descriptor<ComputerLauncher> getDescriptor()
          Gets the descriptor for this instance.
 boolean isLaunchSupported()
          Returns true if this ComputerLauncher supports programatic launch of the slave agent in the target Computer.
 void launch(SlaveComputer computer, TaskListener listener)
          Launches the slave agent for the given Computer.
 
Methods inherited from class hudson.slaves.ComputerLauncher
afterDisconnect, beforeDisconnect, checkJavaVersion, launch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

core

protected volatile ComputerLauncher core
Constructor Detail

ComputerLauncherFilter

public ComputerLauncherFilter(ComputerLauncher core)
Method Detail

getCore

public ComputerLauncher getCore()
Returns the delegation target.


isLaunchSupported

public boolean isLaunchSupported()
Description copied from class: ComputerLauncher
Returns true if this ComputerLauncher supports programatic launch of the slave agent in the target Computer.

Overrides:
isLaunchSupported in class ComputerLauncher

launch

public void launch(SlaveComputer computer,
                   TaskListener listener)
            throws IOException,
                   InterruptedException
Description copied from class: ComputerLauncher
Launches the slave agent for the given 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.

Overrides:
launch in class ComputerLauncher
listener - The progress of the launch, as well as any error, should be sent to this listener.
Throws:
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

afterDisconnect

public void afterDisconnect(SlaveComputer computer,
                            TaskListener listener)
Description copied from class: ComputerLauncher
Allows the 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.

Overrides:
afterDisconnect in class ComputerLauncher

beforeDisconnect

public void beforeDisconnect(SlaveComputer computer,
                             TaskListener listener)
Description copied from class: ComputerLauncher
Allows the 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.

Overrides:
beforeDisconnect in class ComputerLauncher

getDescriptor

public Descriptor<ComputerLauncher> getDescriptor()
Description copied from interface: Describable
Gets the descriptor for this instance.

Descriptor is a singleton for every concrete Describable implementation, so if a.getClass()==b.getClass() then a.getDescriptor()==b.getDescriptor() must hold.

Specified by:
getDescriptor in interface Describable<ComputerLauncher>
Overrides:
getDescriptor in class AbstractDescribableImpl<ComputerLauncher>


Copyright © 2004-2013. All Rights Reserved.