use of org.objectweb.proactive.core.node.NodeException in project scheduling by ow2-proactive.
the class RMTHelper method createNode.
public static TestNode createNode(String nodeName, String expectedUrl, JVMProcess nodeProcess) throws IOException, NodeException, InterruptedException {
Node newNode = null;
long startTimeStamp = System.currentTimeMillis();
NodeException toThrow = null;
while ((System.currentTimeMillis() - startTimeStamp) < DEFAULT_NODES_TIMEOUT) {
try {
newNode = NodeFactory.getNode(expectedUrl);
} catch (NodeException e) {
toThrow = e;
// nothing, wait another loop
}
if (newNode != null) {
return new TestNode(nodeProcess, newNode);
} else {
Thread.sleep(100);
}
}
throw toThrow == null ? new NodeException("unable to create the node " + nodeName) : toThrow;
}
use of org.objectweb.proactive.core.node.NodeException in project scheduling by ow2-proactive.
the class RMTHelper method createNode.
/**
* Create a ProActive Node in a new JVM on the local host
* with specific java parameters.
* This method can be used to test adding nodes mechanism
* with already deploy ProActive nodes.
* @param nodeName node's name to create
* @param vmParameters an HashMap containing key and value String
* of type :-Dkey=value
* @return created node URL
* @throws IOException if the external JVM cannot be created
* @throws NodeException if lookup of the new node fails.
*/
private static TestNode createNode(String nodeName, Map<String, String> vmParameters, List<String> vmOptions, int pnpPort) throws IOException, NodeException, InterruptedException {
boolean exceptionOccurredWhileCreatingNode = false;
NodeException lastException = null;
int numberOfAttempts = 0;
do {
try {
if (pnpPort <= 0) {
pnpPort = findFreePort();
}
String nodeUrl = "pnp://localhost:" + pnpPort + "/" + nodeName;
vmParameters.put(PNPConfig.PA_PNP_PORT.getName(), Integer.toString(pnpPort));
JVMProcessImpl nodeProcess = createJvmProcess(StartNode.class.getName(), Collections.singletonList(nodeName), vmParameters, vmOptions);
return createNode(nodeName, nodeUrl, nodeProcess);
} catch (NodeException e) {
exceptionOccurredWhileCreatingNode = true;
lastException = e;
numberOfAttempts++;
}
} while (exceptionOccurredWhileCreatingNode && numberOfAttempts < 20);
throw lastException;
}
use of org.objectweb.proactive.core.node.NodeException in project scheduling by ow2-proactive.
the class RMNodeImpl method clean.
/**
* Clean the node.
* kill all active objects on the node.
* @throws NodeException
*/
@Override
public synchronized void clean() throws NodeException {
handler = null;
try {
logger.debug(getNodeURL() + " : cleaning");
node.killAllActiveObjects();
} catch (IOException e) {
throw new NodeException("Node is down");
}
// Wait until all active objects are terminated
waitUntilNodeIsCleaned();
}
use of org.objectweb.proactive.core.node.NodeException in project scheduling by ow2-proactive.
the class RMTHelper method killRuntime.
/**
* Kills the runtime associated with specified node url
*
* @param url of the node
* @throws NodeException if node cannot be looked up
*/
public static void killRuntime(String url) throws NodeException {
try {
Node node = NodeFactory.getNode(url);
node.getProActiveRuntime().killRT(false);
} catch (Exception ignored) {
}
}
use of org.objectweb.proactive.core.node.NodeException in project scheduling by ow2-proactive.
the class RMTHelper method killNode.
/**
* Kills the node with specified url
* @param url of the node
* @throws NodeException if node cannot be looked up
*/
public static void killNode(String url) throws NodeException {
Node node = NodeFactory.getNode(url);
try {
ProActiveRuntime rt = node.getProActiveRuntime();
rt.killNode(node.getNodeInformation().getName());
} catch (Exception ignored) {
}
}
Aggregations