public class NodeSource extends Object implements org.objectweb.proactive.InitActive, org.objectweb.proactive.RunActive
Node
objects in the Resource Manager. Each node source consists
of two entities InfrastructureManager
and NodeSourcePolicy
. InfrastructureManager
defines a specific infrastructure and ways
to manipulate nodes. NodeSourcePolicy
defines a strategy of nodes acquisition.
It can be static acquiring nodes once and forever or dynamic where nodes acquisition takes
into account different external factors such as time, scheduling state, etc.Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_LOCAL_NODES_NODE_SOURCE_RECOVERABLE
Default recovery mode for NS with local nodes started with the RM by default
|
static boolean |
DEFAULT_RECOVERABLE |
static int |
EXTERNAL_POOL |
static int |
INTERNAL_POOL |
static int |
NUMBER_OF_THREAD_POOLS |
static int |
PINGER_POOL |
Constructor and Description |
---|
NodeSource()
Creates a new instance of NodeSource.
|
NodeSource(String registrationURL,
String name,
InfrastructureManager im,
NodeSourcePolicy policy,
RMCore rmcore,
RMMonitoringImpl monitor,
NodeSourceDescriptor nodeSourceDescriptor)
Creates a new instance of NodeSource.
|
Modifier and Type | Method and Description |
---|---|
void |
acquireAllNodes()
Requests all nodes to be acquired from the infrastructure.
|
void |
acquireAllNodes(Map<String,?> nodeConfiguration) |
void |
acquireNode()
Requests one node to be acquired from the underlying infrastructure.
|
org.objectweb.proactive.core.util.wrapper.BooleanWrapper |
acquireNode(String nodeUrl,
Client provider)
Acquires the existing node with specific url.
|
void |
acquireNodes(int n,
long timeout,
Map<String,?> nodeConfiguration) |
void |
acquireNodes(int n,
Map<String,?> nodeConfiguration) |
org.objectweb.proactive.core.util.wrapper.BooleanWrapper |
activate()
Activates a node source policy.
|
RMNodeSourceEvent |
createNodeSourceEvent() |
void |
detectedPingedDownNode(String nodeName,
String nodeUrl)
Marks node as down.
|
void |
executeInParallel(Runnable task)
Executed command in parallel using thread pool.
|
void |
finishNodeSourceShutdown(Client initiator)
Terminates a node source active object when the policy is shutdown.
|
LinkedHashMap<String,String> |
getAdditionalInformation() |
Client |
getAdministrator()
The provider of the node source is the resource manager client initiated
the node source creation.
|
Permission |
getAdminPermission()
Returns the permission which administrator must have.
|
LinkedList<org.objectweb.proactive.core.node.Node> |
getAliveNodes()
Retrieves a list of alive nodes
|
LinkedList<RMDeployingNode> |
getDeployingAndLostNodes()
Retrieves the list of deploying nodes handled by the infrastructure manager
|
String |
getDescription()
Creates a node source string representation
|
NodeSourceDescriptor |
getDescriptor()
Get the information that describe the node source and that are needed
to instantiate it
|
LinkedList<org.objectweb.proactive.core.node.Node> |
getDownNodes()
Retrieves a list of down nodes
|
String |
getName()
Gets name of the node source
|
RMDeployingNode |
getNodeInDeployingOrLostNodes(String nodeUrl)
Returns the deploying node identified by the specified
nodeUrl . |
int |
getNodesCount()
Gets the nodes size excluding down nodes.
|
AccessType |
getNodeUserAccessType() |
org.objectweb.proactive.core.util.wrapper.IntWrapper |
getPingFrequency()
Gets the ping frequency.
|
NodeSourcePolicy |
getPolicy() |
Permission |
getProviderPermission()
Returns the permission required to add/remove nodes to/from the node source.
|
String |
getRegistrationURL()
Returns the registration url the node spawn by this nodesource
must use.
|
RMCore |
getRMCore()
Gets resource manager core.
|
NodeSourceStatus |
getStatus() |
NodeSource |
getStub()
Returns the the node source stub
|
void |
initActivity(org.objectweb.proactive.Body body)
Initialization of node source.
|
static void |
initThreadPools() |
RMNode |
internalAddNodeAfterRecovery(org.objectweb.proactive.core.node.Node node,
RMNodeData rmNodeData)
Recover the internal data structure of the node source so that
recovered nodes and RMnodes are linked again to the node source.
|
void |
internalEmitDeployingNodeEvent(RMNodeEvent event)
To emit a deploying node event
|
org.objectweb.proactive.core.node.Node |
lookupNode(String nodeUrl,
long timeout)
Lookups a node with specified timeout.
|
boolean |
nodesRecoverable() |
void |
pingNode(org.objectweb.proactive.core.node.Node node)
Pings the node with specified url.
|
void |
putAndPersistAdditionalInformation(String key,
String value) |
void |
reconfigure(Object[] updatedInfrastructureParams,
Object[] updatedPolicyParams) |
boolean |
removeDeployingNode(String pnUrl)
Removes the deploying node from the nodesource's infrastructure manager.
|
org.objectweb.proactive.core.util.wrapper.BooleanWrapper |
removeNode(String nodeUrl,
Client initiator)
Removes the node from the node source.
|
void |
runActivity(org.objectweb.proactive.Body body) |
void |
setActivePolicy(NodeSourcePolicy policy) |
boolean |
setDeploying(RMDeployingNode deployingNode) |
void |
setInfrastructureManager(InfrastructureManager infrastructureManager) |
boolean |
setNodeAvailable(RMNode node) |
void |
setPingFrequency(int frequency)
Sets the ping frequency (in ms)
|
void |
setStatus(NodeSourceStatus status) |
org.objectweb.proactive.core.util.wrapper.BooleanWrapper |
shutdown(Client initiator)
Shutdowns the node source and releases all its nodes.
|
protected void |
shutdownNodeSourceServices(Client initiator)
Initiates node source services shutdown, such as pinger, policy, thread pool.
|
static void |
shutdownThreadPools() |
RMDeployingNode |
update(RMDeployingNode rmNode) |
NodeSourceDescriptor |
updateDynamicParameters(List<Serializable> infrastructureParamsWithDynamicUpdated,
List<Serializable> policyParamsWithDynamicUpdated) |
public static final boolean DEFAULT_LOCAL_NODES_NODE_SOURCE_RECOVERABLE
public static final boolean DEFAULT_RECOVERABLE
public static final int INTERNAL_POOL
public static final int EXTERNAL_POOL
public static final int PINGER_POOL
public static final int NUMBER_OF_THREAD_POOLS
public NodeSource()
public NodeSource(String registrationURL, String name, InfrastructureManager im, NodeSourcePolicy policy, RMCore rmcore, RMMonitoringImpl monitor, NodeSourceDescriptor nodeSourceDescriptor)
name
- node source nameregistrationURL
- the url used by the spawn nodes to registerim
- underlying infrastructure managerpolicy
- nodes acquisition policyrmcore
- resource manager corepublic AccessType getNodeUserAccessType()
public static void initThreadPools()
public static void shutdownThreadPools()
public void initActivity(org.objectweb.proactive.Body body)
initActivity
in interface org.objectweb.proactive.InitActive
body
- active object bodypublic void runActivity(org.objectweb.proactive.Body body)
runActivity
in interface org.objectweb.proactive.RunActive
public RMNode internalAddNodeAfterRecovery(org.objectweb.proactive.core.node.Node node, RMNodeData rmNodeData)
RMNode
that could be recovered.public org.objectweb.proactive.core.util.wrapper.BooleanWrapper acquireNode(String nodeUrl, Client provider)
nodeUrl
- the url of the nodeprovider
- public boolean setNodeAvailable(RMNode node)
public RMDeployingNode update(RMDeployingNode rmNode)
public boolean setDeploying(RMDeployingNode deployingNode)
public void setInfrastructureManager(InfrastructureManager infrastructureManager)
public NodeSourcePolicy getPolicy()
public void setActivePolicy(NodeSourcePolicy policy)
public NodeSourceStatus getStatus()
public void setStatus(NodeSourceStatus status)
public LinkedHashMap<String,String> getAdditionalInformation()
public void putAndPersistAdditionalInformation(String key, String value)
public NodeSourceDescriptor updateDynamicParameters(List<Serializable> infrastructureParamsWithDynamicUpdated, List<Serializable> policyParamsWithDynamicUpdated)
public void reconfigure(Object[] updatedInfrastructureParams, Object[] updatedPolicyParams) throws Exception
Exception
public org.objectweb.proactive.core.node.Node lookupNode(String nodeUrl, long timeout) throws Exception
nodeUrl
- a url of the nodetimeout
- to wait in msException
- if node was not looked uppublic void acquireNode()
public void acquireAllNodes()
public org.objectweb.proactive.core.util.wrapper.BooleanWrapper removeNode(String nodeUrl, Client initiator)
nodeUrl
- the url of the node to be releasedpublic org.objectweb.proactive.core.util.wrapper.BooleanWrapper shutdown(Client initiator)
public void internalEmitDeployingNodeEvent(RMNodeEvent event)
event
- the deploying node event to emitpublic boolean removeDeployingNode(String pnUrl)
pnUrl
- the deploying urlpublic org.objectweb.proactive.core.util.wrapper.IntWrapper getPingFrequency()
public void setPingFrequency(int frequency)
frequency
- new value of monitoring periodpublic String getDescription()
public String getName()
public NodeSourceDescriptor getDescriptor()
public boolean nodesRecoverable()
public org.objectweb.proactive.core.util.wrapper.BooleanWrapper activate()
protected void shutdownNodeSourceServices(Client initiator)
public void finishNodeSourceShutdown(Client initiator)
public LinkedList<org.objectweb.proactive.core.node.Node> getAliveNodes()
public LinkedList<org.objectweb.proactive.core.node.Node> getDownNodes()
public LinkedList<RMDeployingNode> getDeployingAndLostNodes()
public RMDeployingNode getNodeInDeployingOrLostNodes(String nodeUrl)
nodeUrl
.nodeUrl
- the URL of the deploying node to lookup.null
. Since a node source
is an Active Object, the caller will receive a deep copy of the original object.public int getNodesCount()
public void detectedPingedDownNode(String nodeName, String nodeUrl)
detectedPingedDownNode(String, String)
public RMCore getRMCore()
RMCore
instance.public void executeInParallel(Runnable task)
task
- to executepublic void pingNode(org.objectweb.proactive.core.node.Node node)
public Client getAdministrator()
public NodeSource getStub()
public Permission getAdminPermission()
public Permission getProviderPermission()
public String getRegistrationURL()
public RMNodeSourceEvent createNodeSourceEvent()