hudson.slaves
Class ComputerListener

java.lang.Object
  extended by hudson.slaves.ComputerListener
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
Node.NodeListener

public abstract class ComputerListener
extends Object
implements ExtensionPoint

Receives notifications about status changes of Computers.

Since:
1.246
Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
ComputerListener()
           
 
Method Summary
static ExtensionList<ComputerListener> all()
          All the registered ComputerListeners.
 void onConfigurationChange()
          Called when configuration of the node was changed, a node is added/removed, etc.
 void onOffline(Computer c)
          Called right after a Computer went offline.
 void onOnline(Computer c)
          Deprecated. as of 1.292 Use onOnline(Computer, TaskListener)
 void onOnline(Computer c, TaskListener listener)
          Called right after a Computer comes online.
 void preOnline(Computer c, hudson.remoting.Channel channel, FilePath root, TaskListener listener)
          Called before a Computer is marked online.
 void register()
          Deprecated. as of 1.286 put Extension on your class to have it auto-registered.
 boolean unregister()
          Unregisters this ComputerListener so that it will never receive further events.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComputerListener

public ComputerListener()
Method Detail

preOnline

public void preOnline(Computer c,
                      hudson.remoting.Channel channel,
                      FilePath root,
                      TaskListener listener)
               throws IOException,
                      InterruptedException
Called before a Computer is marked online.

This enables you to do some work on all the slaves as they get connected. Unlike onOnline(Computer, TaskListener), a failure to carry out this function normally will prevent a computer from marked as online.

Parameters:
channel - This is the channel object to talk to the slave. (This is the same object returned by Computer.getChannel() once it's connected.
root - The directory where this slave stores files. The same as Node.getRootPath(), except that method returns null until the slave is connected. So this parameter is passed explicitly instead.
listener - This is connected to the launch log of the computer. Since this method is called synchronously from the thread that launches a computer, if this method performs a time-consuming operation, this listener should be notified of the progress. This is also a good listener for reporting problems.
Throws:
IOException - Exceptions will be recorded to the listener, and the computer will not become online.
InterruptedException - Exceptions will be recorded to the listener, and the computer will not become online.
Since:
1.295
See Also:
onOnline(Computer, TaskListener)

onOnline

public void onOnline(Computer c)
Deprecated. as of 1.292 Use onOnline(Computer, TaskListener)

Called right after a Computer comes online.


onOnline

public void onOnline(Computer c,
                     TaskListener listener)
              throws IOException,
                     InterruptedException
Called right after a Computer comes online.

This enables you to do some work on all the slaves as they get connected.

Starting Hudson 1.312, this method is also invoked for the master, not just for slaves.

Parameters:
listener - This is connected to the launch log of the computer. Since this method is called synchronously from the thread that launches a computer, if this method performs a time-consuming operation, this listener should be notified of the progress. This is also a good listener for reporting problems.
Throws:
IOException - Exceptions will be recorded to the listener. Note that throwing an exception doesn't put the computer offline.
InterruptedException - Exceptions will be recorded to the listener. Note that throwing an exception doesn't put the computer offline.
See Also:
preOnline(Computer, Channel, FilePath, TaskListener)

onOffline

public void onOffline(Computer c)
Called right after a Computer went offline.


onConfigurationChange

public void onConfigurationChange()
Called when configuration of the node was changed, a node is added/removed, etc.

Since:
1.377

register

public final void register()
Deprecated. as of 1.286 put Extension on your class to have it auto-registered.

Registers this ComputerListener so that it will start receiving events.


unregister

public final boolean unregister()
Unregisters this ComputerListener so that it will never receive further events.

Unless ComputerListener is unregistered, it will never be a subject of GC.


all

public static ExtensionList<ComputerListener> all()
All the registered ComputerListeners.



Copyright © 2004-2013 Hudson. All Rights Reserved.