当前位置: 首页>>代码示例>>Java>>正文


Java NodeFactory类代码示例

本文整理汇总了Java中org.objectweb.proactive.core.node.NodeFactory的典型用法代码示例。如果您正苦于以下问题:Java NodeFactory类的具体用法?Java NodeFactory怎么用?Java NodeFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NodeFactory类属于org.objectweb.proactive.core.node包,在下文中一共展示了NodeFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SchedulingMethodImpl

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
public SchedulingMethodImpl(SchedulingService schedulingService) throws Exception {
    this.schedulingService = schedulingService;
    this.checkEligibleTaskDescriptorScript = new CheckEligibleTaskDescriptorScript();
    terminateNotification = new TerminateNotification(schedulingService);
    Node terminateNotificationNode = NodeFactory.createLocalNode("taskTerminationNode",
                                                                 true,
                                                                 "taskTerminationVNode");
    terminateNotification = PAActiveObject.turnActive(terminateNotification,
                                                      TaskTerminateNotification.class.getName(),
                                                      terminateNotificationNode);
    terminateNotificationNodeURL = terminateNotificationNode.getNodeInformation().getURL();

    this.threadPool = TimeoutThreadPoolExecutor.newFixedThreadPool(PASchedulerProperties.SCHEDULER_STARTTASK_THREADNUMBER.getValueAsInt(),
                                                                   new NamedThreadFactory("DoTask_Action"));
    this.corePrivateKey = Credentials.getPrivateKey(PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PRIVKEY_PATH.getValueAsString()));
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:17,代码来源:SchedulingMethodImpl.java

示例2: getReboundTaskTerminateNotificationHandler

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
/**
 * Attempt to reaquire a correct reference to the TaskTerminateNotification
 * active object from a previously saved URL for this object.
 *
 * @return a correct reference to a TaskTerminateNotification, or null if none can be retrieved
 */
TaskTerminateNotification getReboundTaskTerminateNotificationHandler() {
    try {
        logger.debug("List AOs on " + terminateNotificationNodeURL + " (expect only one): " +
                     Arrays.toString(NodeFactory.getNode(terminateNotificationNodeURL)
                                                .getActiveObjects(TaskTerminateNotification.class.getName())));
        Node node = NodeFactory.getNode(terminateNotificationNodeURL);
        Object[] aos = node.getActiveObjects(TaskTerminateNotification.class.getName());
        logger.info("On node " + node.getNodeInformation().getName() + " number of active objects found is " +
                    aos.length + " and the first one " + aos[0] + " will be used to send back the task result");
        return (TaskTerminateNotification) aos[0];
    } catch (Throwable e) {
        // error when retrieving the termination handler after reconnection
        logger.error("Failed to rebind TaskTerminatedNotification handler of task " + taskId.getReadableName() +
                     " from URL " + terminateNotificationNodeURL, e);
        return null;
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:24,代码来源:TaskLauncherRebinder.java

示例3: startLocal

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
/**
 * Creates and starts a Resource manager on the local host using the given initializer to configure it.
 * Only one RM can be started by JVM.
 *
 * @param initializer Use to configure the Resource Manager before starting it.
 * 		This parameter can be null, if so the Resource Manager will try to start on the JVM properties and
 * 		the "pa.rm.home" property MUST be set to the root of the RM directory.
 * @return a RM authentication that allow you to administer the RM or get its connection URL.
 *
 * @throws NodeException If the RM's node can't be created
 * @throws ActiveObjectCreationException If RMCore cannot be created
 * @throws AlreadyBoundException if a node with the same RMNode's name is already exist. 
 * @throws IOException If node and RMCore fails.
 * @throws RMException if the connection to the authentication interface fails.
 */
public static RMAuthentication startLocal(RMInitializer initializer) throws Exception {
    if (rmcore == null) {
        if (initializer != null) {
            //configure application
            configure(initializer);
        }

        configureLog4j();

        Node nodeRM = NodeFactory.createLocalNode(PAResourceManagerProperties.RM_NODE_NAME.getValueAsString(),
                                                  false,
                                                  null,
                                                  null);
        String RMCoreName = RMConstants.NAME_ACTIVE_OBJECT_RMCORE;
        rmcore = (RMCore) PAActiveObject.newActive(RMCore.class.getName(), // the class to deploy
                                                   new Object[] { RMCoreName, nodeRM },
                                                   nodeRM);
        logger.debug("New RM core started locally");
        return RMConnection.waitAndJoin(null);
    } else {
        throw new RMException("RM Core already running locally");
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:39,代码来源:RMFactory.java

示例4: createNode

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
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;
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:23,代码来源:RMTHelper.java

示例5: createLocalNode

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
/**
 * Creates the node with the name given as parameter and returns it.
 * @param nodeName The expected name of the node
 * @return the newly created node.
 */
protected Node createLocalNode(String nodeName) {
    Node localNode = null;
    try {
        localNode = NodeFactory.createLocalNode(nodeName, false, null, nodeName + "vnname");
        if (localNode == null) {
            logger.error(ExitStatus.RMNODE_NULL.description);
            System.exit(ExitStatus.RMNODE_NULL.exitCode);
        }
        // setting system properties to node (they will be accessible remotely)
        for (Object key : System.getProperties().keySet()) {
            localNode.setProperty(key.toString(), System.getProperty(key.toString()));
        }
    } catch (Throwable t) {
        logger.error("Unable to create the local node " + nodeName, t);
        System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode);
    }
    return localNode;
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:24,代码来源:RMNodeStarter.java

示例6: ping

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
/**
 * Pings remote nodes and returns distances to hosts where these nodes are located.
 *
 * @param nodes to ping
 * @return distances map to hosts where these nodes are located
 */
public HashMap<InetAddress, Long> ping(NodeSet nodes) {
    HashMap<InetAddress, Long> results = new HashMap<>();
    for (Node node : nodes) {
        try {
            InetAddress current = NodeFactory.getDefaultNode().getVMInformation().getInetAddress();
            InetAddress nodeAddress = node.getVMInformation().getInetAddress();
            if (current.equals(nodeAddress)) {
                // nodes on the same host
                results.put(nodeAddress, new Long(0));
            } else {
                results.put(nodeAddress, pingHost(nodeAddress));
            }
        } catch (NodeException e) {
        }
    }
    return results;
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:24,代码来源:HostsPinger.java

示例7: ping

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
/**
 * Pings remote nodes and returns distances to hosts where these nodes are located.
 *
 * @param nodes to ping
 * @return distances map to hosts where these nodes are located
 */
public HashMap<InetAddress, Long> ping(NodeSet nodes) {
    HashMap<InetAddress, Long> results = new HashMap<>();
    for (Node node : nodes) {
        try {
            InetAddress current = NodeFactory.getDefaultNode().getVMInformation().getInetAddress();
            InetAddress nodeAddress = node.getVMInformation().getInetAddress();
            if (current.equals(nodeAddress)) {
                // nodes on the same host
                results.put(nodeAddress, new Long(0));
            } else {
                results.put(nodeAddress, pingNode(node));
            }
        } catch (NodeException e) {
        }
    }
    return results;
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:24,代码来源:NodesPinger.java

示例8: checkNodeProperty

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
/**
 * Checks the general property to know if some timer names are specified
 *
 * @param nodeURL
 *            The URL of the node containing these properties
 * @return The value of the property
 */
public final static String checkNodeProperty(final String nodeURL) {
    // Check the activated timers from the node properties
    String result = null;
    try {
        final Node currentNode = NodeFactory.getNode(nodeURL);
        result = currentNode.getProperty("timitActivation");
        if ((result != null) && !"".equals(result)) {
            TimItTechnicalService.setGenerateOutputFile(currentNode.getProperty("generateOutputFile"));
            TimItTechnicalService.setPrintOutput(currentNode.getProperty("printOutput"));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:23,代码来源:CoreTimersContainer.java

示例9: sendNotification

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
public void sendNotification(String type) {
    if (body != null) {
        BodyWrapperMBean mbean = body.getMBean();
        if (mbean != null) {
            if (type.equals(NotificationType.connectDebugger)) {
                try {
                    mbean.sendNotification(type, NodeFactory.getNode(destinationBody.getNodeURL())
                            .getProActiveRuntime().getURL());
                } catch (NodeException e) {
                    e.printStackTrace();
                }
            } else {
                mbean.sendNotification(type);
            }
        }
    }
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:18,代码来源:DebuggerImpl.java

示例10: checkNode

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
public Node checkNode(Node node) throws MigrationException {
    if (node == null) {
        throw new MigrationException("The RemoteNodeImpl could not be found");
    }

    // check if the node is remote
    if (NodeFactory.isNodeLocal(node)) {
        MigrationException me = new MigrationException("The given node " +
            node.getNodeInformation().getURL() + " is in the same virtual machine");
        if (hasListeners()) {
            notifyAllListeners(new MigrationEvent(me));
        }
        throw me;
    }
    return node;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:17,代码来源:MigrationManagerImpl.java

示例11: 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();
    }
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:25,代码来源:CheckpointServerImpl.java

示例12: receiveBody

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
/**
 * @inheritDoc
 */
@Override
public UniversalBody receiveBody(String nodeName, Body body) throws MigrationException {
    ProActiveSecurityManager psm = ((AbstractBody) body).getProActiveSecurityManager();
    if (psm != null) {
        psm.setParent(this.nodeMap.get(nodeName));
    }

    if (NodeFactory.isHalfBodiesNode(nodeName)) {
        throw new MigrationException("Cannot migrate an active object on the reserved halfbodies node.");
    }

    registerBody(nodeName, body);

    // register futures that have been deserialized in the body
    ((AbstractBody) body).registerIncomingFutures();

    return body.getRemoteAdapter();
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:22,代码来源:ProActiveRuntimeImpl.java

示例13: 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);
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:19,代码来源:TestJavaObject.java

示例14: 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);
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:17,代码来源:Test.java

示例15: createGroup

import org.objectweb.proactive.core.node.NodeFactory; //导入依赖的package包/类
private A createGroup() throws Exception {
    //### Keep the surrounding comments when  ###
    //### changing the code (used by the doc) ###		  
    //@snippet-start group_creation_example
    node0 = NodeFactory.getDefaultNode();
    node1 = super.getANode();
    node2 = super.getANode();

    Object[][] params = { { "Agent0" }, { "Agent1" }, { "Agent2" } };
    Node[] nodes = { node0, node1, node2 };

    this.typedGroup = (A) PAGroup.newGroup(A.class.getName(), params, nodes);
    //@snippet-end group_creation_example

    return this.typedGroup;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:17,代码来源:TestCreation.java


注:本文中的org.objectweb.proactive.core.node.NodeFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。