本文整理汇总了Java中org.objectweb.proactive.core.node.NodeFactory.isNodeLocal方法的典型用法代码示例。如果您正苦于以下问题:Java NodeFactory.isNodeLocal方法的具体用法?Java NodeFactory.isNodeLocal怎么用?Java NodeFactory.isNodeLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.objectweb.proactive.core.node.NodeFactory
的用法示例。
在下文中一共展示了NodeFactory.isNodeLocal方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: runActivity
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
@MigrationSignal
public void runActivity(Body b) {
Service service = new Service(b);
if (!initialized) {
service.blockingServeOldest();
}
rebuild();
Destination r = null;
//first we empty the RequestQueue
while (b.isActive()) {
while (service.hasRequestToServe()) {
service.serveOldest();
}
if (onItinerary) {
r = nextHop();
try {
//Non migration to the same node or a null node
if ((r != null) && !NodeFactory.isNodeLocal(NodeFactory.getNode(r.getDestination()))) {
PAMobileAgent.migrateTo(r.getDestination());
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
service.blockingServeOldest();
}
}
}
示例3: configureNode
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
/**
* Set node-specific immutable settings and initialize components. This method must be called
* exactly once for each instance.
* <p>
* Scratch space configuration is checked and initialized.
* <p>
* State of an instance remains not configured if exception appears.
*
* @param node
* node to configure
* @param baseScratchConfiguration
* base scratch data space configuration, may be <code>null</code> if node does not
* provide a scratch space; not existing directory pointed by this configuration will
* be created
* @throws IllegalStateException
* when trying to reconfigure already configured instance
* @throws IllegalArgumentException
* when trying to configure node that is on different runtime/JVM
* @throws ConfigurationException
* when configuration appears to be wrong during node scratch space initialization
* (e.g. capabilities checking)
* @throws FileSystemException
* when VFS creation or scratch initialization fails
*/
synchronized public void configureNode(Node node, BaseScratchSpaceConfiguration baseScratchConfiguration)
throws IllegalStateException, IllegalArgumentException, FileSystemException,
ConfigurationException {
logger.debug("Configuring node for Data Spaces");
checkNotConfigured();
if (!NodeFactory.isNodeLocal(node)) {
logger.error("Node to configure is not on the same runtime/JVM as a caller");
throw new IllegalArgumentException("Node to configure is not on the same runtime/JVM as a caller");
}
this.node = node;
try {
if (baseScratchConfiguration != null) {
if (baseScratchConfiguration.getUrl() == null) {
baseScratchConfiguration = startProActiveProviderServer(baseScratchConfiguration);
}
final NodeScratchSpace configuringScratchSpace = new VFSNodeScratchSpaceImpl();
configuringScratchSpace.init(node, baseScratchConfiguration);
this.nodeScratchSpace = configuringScratchSpace;
}
configured = true;
} finally {
if (!configured) {
tryCloseProviderServer();
// node scratch space is not configured (does not need close) for sure
}
}
logger.debug("Node configured for Data Spaces");
}
示例4: UniversalBodyProxy
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
/**
* Instantiates an object of class BodyProxy, creates a body object (referenced either via the
* instance variable <code>localBody</code> or <code>remoteBody</code>) and passes the
* ConstructorCall object <code>c</code> to the body, which will then handle the creation of the
* reified object (That's it !). parameter contains either : <Node, Active,
* MetaObjectFactory> or <UniversalBody>
*/
public UniversalBodyProxy(ConstructorCall constructorCall, Object[] parameters) throws ProActiveException {
if (parameters.length > 0) {
Object p0 = parameters[0];
// Determines whether the body is local or remote
if (p0 instanceof UniversalBody) {
// This is simple connection to an existant local body
this.universalBody = (UniversalBody) p0;
this.isLocal = LocalBodyStore.getInstance().getLocalBody(getBodyID()) != null;
if (logger.isDebugEnabled()) {
// logger.debug("UniversalBodyProxy created from UniversalBody bodyID="+bodyID+"
// isLocal="+isLocal);
}
} else {
// instantiate the body locally or remotely
Class<?> bodyClass = Constants.DEFAULT_BODY_CLASS;
Node node = (Node) p0;
// added lines--------------------------
// ProActiveRuntime part = node.getProActiveRuntime();
// added lines----------------------------
Active activity = (Active) parameters[1];
MetaObjectFactory factory = (MetaObjectFactory) parameters[2];
Class<?>[] argsClass = new Class<?>[] { ConstructorCall.class, String.class, Active.class,
MetaObjectFactory.class };
Object[] args = new Object[] { constructorCall, node.getNodeInformation().getURL(), activity,
factory };
// added lines--------------------------
// Object[] args = new Object[] { constructorCall,
// node.getNodeInformation().getURL(), activity, factory };
// added lines--------------------------
ConstructorCall bodyConstructorCall = buildBodyConstructorCall(bodyClass, argsClass, args);
if (NodeFactory.isNodeLocal(node)) {
// the node is local
// added line -------------------------
// if (RuntimeFactory.isRuntimeLocal(part)){
// added line -------------------------
this.universalBody = createLocalBody(bodyConstructorCall, constructorCall, node);
this.isLocal = true;
} else {
this.universalBody = createRemoteBody(bodyConstructorCall, node);
// added line -------------------------
// this.universalBody = createRemoteBody(bodyConstructorCall, part , node);
// added line -------------------------
this.isLocal = false;
}
if (logger.isDebugEnabled()) {
// logger.debug("UniversalBodyProxy created from constructorCall
// bodyID="+bodyID+" isLocal="+isLocal);
}
}
// cache the body ID
cachedBodyId = this.universalBody.getID();
if (GarbageCollector.dgcIsEnabled()) {
((AbstractBody) PAActiveObject.getBodyOnThis()).updateReference(this);
}
}
}
示例5: configureNode
import org.objectweb.proactive.core.node.NodeFactory; //导入方法依赖的package包/类
/**
* Configures Data Spaces on node and stores that configuration, so it can be later configured
* for specific application by {@link #configureApplication(Node, long, String)} or closed by
* {@link #closeNodeConfig(Node)}.
*
* @param node
* node to be configured for Data Spaces
* @param baseScratchConfiguration
* base configuration of scratch data space for a specified node
* @throws IllegalArgumentException
* when trying to configure node that is on different runtime/JVM
* @throws FileSystemException
* when VFS configuration creation or scratch initialization fails
* @throws ConfigurationException
* something failed during node scratch space configuration (ex. capabilities
* checking)
* @throws AlreadyConfiguredException
* when node is already configured for Data Spaces
* @see NodeConfigurator#configureNode(Node, BaseScratchSpaceConfiguration)
*/
public static void configureNode(Node node, BaseScratchSpaceConfiguration baseScratchConfiguration)
throws IllegalArgumentException, AlreadyConfiguredException, FileSystemException,
ConfigurationException {
if (!NodeFactory.isNodeLocal(node)) {
logger.error("Node to configure is not on the same runtime/JVM as a caller");
throw new IllegalArgumentException("Node to configure is not on the same runtime/JVM as a caller");
}
final NodeConfigurator nodeConfig = createNodeConfigurator(node);
try {
nodeConfig.configureNode(node, baseScratchConfiguration);
} catch (IllegalStateException x) {
logger.debug("Requested Data Spaces node configuration for already configured node");
// it can occur only in case of concurrent configuration, let's wrap it
throw new AlreadyConfiguredException(x.getMessage(), x);
}
}