org.jppf.server.node
Class JPPFNode

java.lang.Object
  extended by org.jppf.utils.ThreadSynchronization
      extended by org.jppf.node.AbstractMonitoredNode
          extended by org.jppf.server.node.JPPFNode
All Implemented Interfaces:
Runnable, MonitoredNode
Direct Known Subclasses:
JPPFLocalNode, JPPFRemoteNode

public abstract class JPPFNode
extends AbstractMonitoredNode

Instances of this class encapsulate execution nodes.

Author:
Laurent Cohen, Domingos Creado

Field Summary
protected  AbstractClassLoaderManager classLoaderManager
          Manages the class loaders and how they are used.
protected  NodeExecutionManagerImpl executionManager
          The task execution manager for this node.
protected  NodeIO nodeIO
          The object responsible for this node's I/O.
 
Fields inherited from class org.jppf.node.AbstractMonitoredNode
executingCount, helper, listeners, notifying, serializer, socketClient, socketInitializer, uuid
 
Fields inherited from class org.jppf.utils.ThreadSynchronization
stopped
 
Constructor Summary
JPPFNode()
          Default constructor.
 
Method Summary
protected abstract  void closeDataChannel()
          Initialize this node's data channel.
 AbstractJPPFClassLoader getClassLoader()
          Get the main classloader for the node.
 JPPFContainer getContainer(List<String> uuidPath)
          Get a reference to the JPPF container associated with an application uuid.
 NodeExecutionManagerImpl getExecutionManager()
          Get the task execution manager for this node.
 JMXServerImpl getJmxServer()
          Get the jmx server that handles administration and monitoring functions for this node.
 LifeCycleEventHandler getLifeCycleEventHandler()
          Get the object that handles the firing of node life cycle events and the listeners that subscribe to these events.
 JPPFNodeAdmin getNodeAdmin()
          Get the administration and monitoring MBean for this node.
protected abstract  void initDataChannel()
          Initialize this node's data channel.
 void initHelper()
          Get the main classloader for the node.
 void perform()
          Perform the main execution loop for this node.
 void run()
          Main processing loop of this node.
 void setClassLoader(JPPFClassLoader cl)
          Set the main classloader for the node.
 void setExitAction(Runnable exitAction)
          Set the action executed when the node exits the main loop.
 void setNodeAdmin(JPPFNodeAdmin nodeAdmin)
          Set the administration and monitoring MBean for this node.
 void shutdown(boolean restart)
          Shutdown and evenetually restart the node.
 void stopNode(boolean closeSocket)
          Stop this node and release the resources it is using.
 
Methods inherited from class org.jppf.node.AbstractMonitoredNode
addNodeListener, decrementExecutingCount, fireNodeEvent, fireNodeEvent, getHelper, getSocketWrapper, getTaskCount, incrementExecutingCount, isNotifying, removeNodeListener, setSocketWrapper, setTaskCount
 
Methods inherited from class org.jppf.utils.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

executionManager

protected NodeExecutionManagerImpl executionManager
The task execution manager for this node.


nodeIO

protected NodeIO nodeIO
The object responsible for this node's I/O.


classLoaderManager

protected AbstractClassLoaderManager classLoaderManager
Manages the class loaders and how they are used.

Constructor Detail

JPPFNode

public JPPFNode()
Default constructor.

Method Detail

run

public void run()
Main processing loop of this node.

See Also:
Runnable.run()

perform

public void perform()
             throws Exception
Perform the main execution loop for this node. At each iteration, this method listens for a task to execute, receives it, executes it and sends the results back.

Throws:
Exception - if an error was raised from the underlying socket connection or the class loader.

initDataChannel

protected abstract void initDataChannel()
                                 throws Exception
Initialize this node's data channel.

Throws:
Exception - if an error is raised during initialization.

closeDataChannel

protected abstract void closeDataChannel()
                                  throws Exception
Initialize this node's data channel.

Throws:
Exception - if an error is raised during initialization.

getClassLoader

public AbstractJPPFClassLoader getClassLoader()
Get the main classloader for the node. This method performs a lazy initialization of the classloader.

Returns:
a ClassLoader used for loading the classes of the framework.

setClassLoader

public void setClassLoader(JPPFClassLoader cl)
Set the main classloader for the node.

Parameters:
cl - the class loader to set.

initHelper

public void initHelper()
                throws Exception
Get the main classloader for the node. This method performs a lazy initialization of the classloader.

Throws:
Exception - if an error occcurs while instantiating the class loader.

getContainer

public JPPFContainer getContainer(List<String> uuidPath)
                           throws Exception
Get a reference to the JPPF container associated with an application uuid.

Parameters:
uuidPath - the uuid path containing the key to the container.
Returns:
a JPPFContainer instance.
Throws:
Exception - if an error occcurs while getting the container.

getNodeAdmin

public JPPFNodeAdmin getNodeAdmin()
Get the administration and monitoring MBean for this node.

Returns:
a JPPFNodeAdminm instance.

setNodeAdmin

public void setNodeAdmin(JPPFNodeAdmin nodeAdmin)
Set the administration and monitoring MBean for this node.

Parameters:
nodeAdmin - a JPPFNodeAdminm instance.

getExecutionManager

public NodeExecutionManagerImpl getExecutionManager()
Get the task execution manager for this node.

Returns:
a NodeExecutionManager instance.

stopNode

public void stopNode(boolean closeSocket)
Stop this node and release the resources it is using.

Specified by:
stopNode in interface MonitoredNode
Specified by:
stopNode in class AbstractMonitoredNode
Parameters:
closeSocket - determines whether the underlying socket should be closed.
See Also:
MonitoredNode.stopNode(boolean)

shutdown

public void shutdown(boolean restart)
Shutdown and evenetually restart the node.

Parameters:
restart - determines whether this node should be restarted by the node launcher.

setExitAction

public void setExitAction(Runnable exitAction)
Set the action executed when the node exits the main loop.

Parameters:
exitAction - the action to execute.

getJmxServer

public JMXServerImpl getJmxServer()
                           throws Exception
Get the jmx server that handles administration and monitoring functions for this node.

Returns:
a JMXServerImpl instance.
Throws:
Exception - if any error occurs.

getLifeCycleEventHandler

public LifeCycleEventHandler getLifeCycleEventHandler()
Get the object that handles the firing of node life cycle events and the listeners that subscribe to these events.

Returns:
an instance of LifeCycleEventHandler.


Copyright © 2005-2010 JPPF Team.