本文整理汇总了Java中org.objectweb.proactive.core.node.NodeFactory.getDefaultNode方法的典型用法代码示例。如果您正苦于以下问题:Java NodeFactory.getDefaultNode方法的具体用法?Java NodeFactory.getDefaultNode怎么用?Java NodeFactory.getDefaultNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.objectweb.proactive.core.node.NodeFactory
的用法示例。
在下文中一共展示了NodeFactory.getDefaultNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CheckpointServerImpl
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
/**
*
*/
public CheckpointServerImpl(FTServer server) {
this.server = server;
this.checkpointStorage = new Hashtable<UniqueID, List<Checkpoint>>();
if (CentralPAPropertyRepository.PA_CLASSLOADING_USEHTTP.isTrue()) {
ClassServerServlet.get();
this.codebase = ClassServerServlet.get().getCodeBase();
} else {
// URL must be prefixed by pa tu use our custom protocol handlers
// URL must be terminated by a / according to the RMI specification
this.codebase = "pa" + ProActiveRuntimeImpl.getProActiveRuntime().getURL() + "/";
}
try {
NodeFactory.getDefaultNode();
} catch (NodeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例2: testGCMFileTransfer
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
/**
* Copies the file whose path is sourcePath on the local host to the file with path destPath
* on each machine that hosts a node mapped with the virtual node VNName
*
* @param descriptorPath path of the GCM descriptor file
* @param VNName name of the virtual node
* @param sourcePath source path
* @param destPath destination path
* @throws IOException
* @throws NodeException
*/
public static void testGCMFileTransfer(String descriptorPath, String VNName, String sourcePath,
String destPath) throws IOException, NodeException {
Node srcNode = NodeFactory.getDefaultNode();
System.out.println(srcNode.getVMInformation().getHostName());
GCMVirtualNode vn = FileTransferTest.getGCMVirtualNode(descriptorPath, VNName);
long nbNodes = vn.getNbCurrentNodes();
for (long l = 0; l < nbNodes; l++) {
System.out.println("Node number " + l);
Node destNode = vn.getANode();
System.out.println(destNode.getVMInformation().getHostName());
RemoteFile rf = PAFileTransfer.transfer(srcNode, new File(sourcePath), destNode, new File(
destPath));
rf.waitFor();
System.out.println(rf.getRemoteFilePath().getPath());
}
}
示例3: preConditions
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@Before
public void preConditions() throws Exception {
//@snippet-start get_group
Object[][] params = { { "Agent0" }, { "Agent1" }, { "Agent2" } };
Node[] nodes = { NodeFactory.getDefaultNode(), super.getANode(), super.getANode() };
this.typedGroup = (A) PAGroup.newGroup(A.class.getName(), params, nodes);
Group<A> g = PAGroup.getGroup(this.typedGroup);
g.add(new A("Agent3"));
g.add(new A("Agent4"));
g.add(new A("Agent5"));
//@snippet-end get_group
g.setRatioMemberToThread(1);
assertTrue(this.typedGroup != null);
}
示例4: test
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@Test
public void test() throws NodeException, ActiveObjectCreationException {
Node dnode0;
Node dnode1;
dnode0 = NodeFactory.getDefaultNode();
Node node = super.getANode();
AO ao = PAActiveObject.newActive(AO.class, new Object[] {}, node);
dnode1 = ao.getDefaultNode();
String url0 = dnode0.getNodeInformation().getURL();
String url1 = dnode1.getNodeInformation().getURL();
Assert.assertFalse(url0.equals(url1));
}
示例5: getLocalNode
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
protected static Node getLocalNode() throws IOException {
Node localNode;
try {
localNode = NodeFactory.getDefaultNode();
} catch (NodeException e) {
//TODO change when moving to Java 1.6
//throw new IOException("Can't get local node", e);
throw new IOException("Can't get local node " + e.getMessage());
}
return localNode;
}
示例6: test
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@Test
public void test() throws NodeException {
Node node = NodeFactory.getDefaultNode();
String url = node.getNodeInformation().getURL();
NodeFactory.getNode(url);
}
示例7: testXMLFileTransfer
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
/**
* Copies the file whose path is sourcePath on the local host to the file with path destPath
* on each machine that hosts a node mapped with the virtual node VNName
*
* @param descriptorPath path of the XML descriptor file
* @param VNName name of the virtual node
* @param sourcePath source path
* @param destPath destination path
* @throws IOException
* @throws ProActiveException
*/
public static void testXMLFileTransfer(String descriptorPath, String VNName, String sourcePath,
String destPath) throws IOException, ProActiveException {
Node srcNode = NodeFactory.getDefaultNode();
System.out.println(srcNode.getVMInformation().getHostName());
VirtualNode virtualNode = FileTransferTest.getXMLVirtualNode(descriptorPath, VNName);
long nbNodes = virtualNode.getNbMappedNodes();
for (long l = 0; l < nbNodes; l++) {
System.out.println("Node number " + l);
Node destNode = virtualNode.getNode();
System.out.println(destNode.getVMInformation().getHostName());
RemoteFile rf = PAFileTransfer.transfer(srcNode, new File(sourcePath), destNode, new File(
destPath));
rf.waitFor();
System.out.println(rf.getRemoteFilePath().getPath());
}
//@snippet-break FileTransferTest
try {
// @snippet-start FileTransfer_4
List<RemoteFile> rfList = virtualNode.getVirtualNodeInternal().fileTransferRetrieve();
// @snippet-end FileTransfer_4
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//@snippet-resume FileTransferTest
}
示例8: preConditions
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@Before
public void preConditions() throws Exception {
Object[][] params = { { "Agent0" }, { "Agent1" }, { "Agent2" } };
Node[] nodes = { NodeFactory.getDefaultNode(), super.getANode(), super.getANode() };
this.typedGroup = (A) PAGroup.newGroup(A.class.getName(), params, nodes);
PAGroup.getGroup(this.typedGroup).setRatioMemberToThread(1);
assertTrue(this.typedGroup != null);
}
示例9: preConditions
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@Before
public void preConditions() throws Exception {
//@snippet-start spmd_creation
Object[][] params = { { "Agent0" }, { "Agent1" }, { "Agent2" } };
Node[] nodes = { NodeFactory.getDefaultNode(), super.getANode(), super.getANode() };
this.spmdgroup = (A) PASPMD.newSPMDGroup(A.class.getName(), params, nodes);
//@snippet-end spmd_creation
assertTrue(spmdgroup != null);
assertTrue(PAGroup.size(spmdgroup) == 3);
}
示例10: preConditions
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@Before
public void preConditions() throws Exception {
Object[][] params = { { "Agent0" }, { "Agent1" }, { "Agent2" } };
Node[] nodes = { NodeFactory.getDefaultNode(), super.getANode(), super.getANode() };
this.typedGroup = (A) PAGroup.newGroup(A.class.getName(), params, nodes);
PAGroup.getGroup(this.typedGroup).setRatioMemberToThread(1);
boolean NoOnewayCallDone = true;
Group<A> group = PAGroup.getGroup(this.typedGroup);
Iterator<A> it = group.iterator();
while (it.hasNext()) {
NoOnewayCallDone &= !((A) it.next()).isOnewayCallReceived();
}
assertTrue(NoOnewayCallDone);
}
示例11: initActivity
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
public void initActivity(Body b) {
try {
if (pad != null) {
// create nodes
pad.startDeployment();
containersVirtualNode = pad.getVirtualNode("Containers");
listenerNode = pad.getVirtualNode("OutputListener").getANode();
sourceNode = pad.getVirtualNode("NumberSource").getANode();
} else {
listenerNode = sourceNode = NodeFactory.getDefaultNode();
}
// create output listener
outputListener = PAActiveObject.newActive(ConsolePrimeOutputListener.class, new Object[] {},
listenerNode);
outputListener.newPrimeNumberFound(2);
// create number source
source = PAActiveObject.newActive(NumberSource.class, new Object[] {}, sourceNode);
// create first container
ActivePrimeContainer first = newActivePrimeContainer(3, source);
source.setFirst(first);
if (gui) {
new ControlFrame(this);
} else {
source.pause(false); // start immediately if no gui
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例12: preConditions
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@Before
public void preConditions() throws Exception {
Object[][] params = { { "Agent0" }, { "Agent1" }, { "Agent2" } };
Node[] nodes = { NodeFactory.getDefaultNode(), super.getANode(), super.getANode() };
this.typedGroup = (A) PAGroup.newGroup(A.class.getName(), params, nodes);
assertTrue(this.typedGroup != null);
}
示例13: action
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@org.junit.Test
public void action() throws Exception {
Object[][] params = { { "Agent0" }, { "Agent1" }, { "Agent2" } };
Node[] nodes = { NodeFactory.getDefaultNode(), super.getANode(), super.getANode() };
this.typedGroup = (A) PAGroup.newGroup(A.class.getName(), params, nodes);
this.resultTypedGroup = this.typedGroup.asynchronousCallException();
// was the result group created ?
assertTrue(resultTypedGroup != null);
// System.err.println(
// "the result group containing exception is not build");
Group<A> group = PAGroup.getGroup(this.typedGroup);
Group<?> groupOfResult = PAGroup.getGroup(this.resultTypedGroup);
// has the result group the same size as the caller group ?
assertTrue(groupOfResult.size() == group.size());
// System.err.println(
// "the result group containing exception has the correct size");
boolean exceptionInResultGroup = true;
for (int i = 0; i < groupOfResult.size(); i++) {
exceptionInResultGroup &= (groupOfResult.get(i) instanceof Throwable);
}
// is the result group containing exceptions ?
assertTrue(exceptionInResultGroup);
// System.err.println(
// "the result group doesn't contain (exclusively) exception");
// has the ExceptionListException the correct size ?
ExceptionListException el = groupOfResult.getExceptionList();
assertTrue((el.size() == groupOfResult.size()));
// System.err.println(
// "the ExceptionListException hasn't the right size");
A resultOfResultGroup = this.resultTypedGroup.asynchronousCall();
Group<A> groupOfResultResult = PAGroup.getGroup(resultOfResultGroup);
// has the result-result group the correct size ?
assertTrue(groupOfResultResult.size() == groupOfResult.size());
// System.err.println(
// "the result of a call on a group containing exception hasn't the correct size");
boolean nullInResultResultGroup = true;
for (int i = 0; i < groupOfResultResult.size(); i++) {
nullInResultResultGroup &= (groupOfResultResult.get(i) == null);
}
// is the result group containing null ?
assertTrue(nullInResultResultGroup);
// System.err.println(
// "the result group of a group containing exception doesn't contain null");
// are the exceptions deleted ?
groupOfResult.purgeExceptionAndNull();
assertTrue(groupOfResult.size() == 0);
// System.err.println(
// "the exceptions in a group are not correctly (totaly) purged");
// are the null deleted ?
groupOfResultResult.purgeExceptionAndNull();
assertTrue(groupOfResultResult.size() == 0);
// System.err.println(
// "the null in a group are not correctly (totaly) purged");
}
示例14: getDefaultNode
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
public Node getDefaultNode() throws NodeException {
return NodeFactory.getDefaultNode();
}
示例15: newGroup
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
/**
* Creates an object representing a group (a typed group) and creates members on the default node.
* @param className the name of the (upper) class of the group's members.
* @param genericParameters genericParameters parameterizing types
* @param params the array that contain the parameters used to build the group's members.
* If <code>params</code> is <code>null</code>, builds an empty group.
* @return a typed group with its members.
* @throws ActiveObjectCreationException if a problem occur while creating the stub or the body
* @throws ClassNotFoundException if the Class<?> corresponding to <code>className</code> can't be found.
* @throws ClassNotReifiableException if the Class<?> corresponding to <code>className</code> can't be reify.
* @throws NodeException if the node was null and that the DefaultNode cannot be created
*/
public static Object newGroup(String className, Class<?>[] genericParameters, Object[][] params)
throws ClassNotFoundException, ClassNotReifiableException, ActiveObjectCreationException,
NodeException {
Node[] nodeList = new Node[1];
nodeList[0] = NodeFactory.getDefaultNode();
return PAGroup.newGroup(className, genericParameters, params, nodeList);
}