本文整理了Java中org.apache.ignite.Ignite.message()
方法的一些代码示例,展示了Ignite.message()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignite.message()
方法的具体详情如下:
包路径:org.apache.ignite.Ignite
类名称:Ignite
方法名:message
[英]Gets messaging facade over all cluster nodes.
[中]获取所有群集节点上的消息外观。
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public IgniteMessaging message(ClusterGroup prj) {
checkIgnite();
return g.message(prj);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public IgniteMessaging message() {
checkIgnite();
return g.message();
}
代码示例来源:origin: apache/ignite
/**
* Starts TensorFlow cluster.
*/
private void startCluster() {
TensorFlowCluster cluster = clusterMgr.createCluster(
clusterId,
jobArchive,
str -> ignite.message().sendOrdered("us_out_" + clusterId, str, 60 * 1000),
str -> ignite.message().sendOrdered("us_err_" + clusterId, str, 60 * 1000)
);
ignite.message().send(topicName, Optional.of(cluster));
}
代码示例来源:origin: apache/ignite
/**
* Stops TensorFlow cluster.
*
* @param terminate Terminate TensorFlow cluster and notify all listeners that cluster won't be started again.
*/
private void stopCluster(boolean terminate) {
clusterMgr.stopClusterIfExists(clusterId);
if (terminate)
ignite.message().send(topicName, Optional.empty());
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public boolean apply(Event evt) {
try {
int[] res = new int[] {
System.identityHashCode(getClass().getClassLoader())
};
ignite.message(ignite.cluster().forRemotes()).send(null, res);
}
catch (IgniteException e) {
throw new RuntimeException(e);
}
return true;
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public boolean apply(Event evt) {
try {
int[] res = new int[] {
System.identityHashCode(getClass().getClassLoader())
};
ignite.message(ignite.cluster().forRemotes()).send(null, res);
}
catch (IgniteException e) {
throw new RuntimeException(e);
}
return true;
}
}
代码示例来源:origin: apache/ignite
@Override public Object call() throws Exception {
ignite1.message().send(null, Collections.emptyList());
return null;
}
}, IllegalArgumentException.class, "Ouch! Argument is invalid: msgs cannot be null or empty");
代码示例来源:origin: apache/ignite
/**
* Creates TensorFlow cluster gateway.
*
* @param topicName Topic name.
* @return TensorFlow cluster gateway.
*/
private TensorFlowClusterGateway createTensorFlowClusterGateway(String topicName) {
TensorFlowClusterGateway gateway = new TensorFlowClusterGateway(subscriber -> {
ignite.message().stopLocalListen(topicName, subscriber);
log.info("Stop listen to cluster gateway [topicName=" + topicName + "]");
});
ignite.message().localListen(topicName, gateway);
log.info("Start listen to cluster gateway [topicName=" + topicName + "]");
return gateway;
}
}
代码示例来源:origin: apache/ignite
@Override public Object call() throws Exception {
ignite1.message().send(null, (Object)null);
return null;
}
}, NullPointerException.class, "Ouch! Argument cannot be null: msg");
代码示例来源:origin: apache/ignite
@Override public Object call() throws Exception {
ignite1.message().send(null, Arrays.asList(null, new Object()));
return null;
}
}, NullPointerException.class, "Ouch! Argument cannot be null: msg");
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public Collection<? extends ComputeJob> split(int gridSize, Object arg) {
ignite.message().localListen(null, new P2<UUID, Object>() {
@Override public boolean apply(UUID uuid, Object o) {
return stop.get();
}
});
return Arrays.asList(new ComputeJobAdapter() {
@Override public Object execute() {
return null;
}
});
}
代码示例来源:origin: apache/ignite
/**
* @param prj Projection.
* @return {@link org.apache.ignite.IgniteMessaging} for given projection.
*/
protected IgniteMessaging message(ClusterGroup prj) {
return prj.ignite().message(prj);
}
代码示例来源:origin: apache/ignite
@Override public Object call() throws Exception {
ignite1.message().send(null, null);
return null;
}
}, IllegalArgumentException.class, "Ouch! Argument is invalid: msgs cannot be null or empty");
代码示例来源:origin: apache/ignite
@Override public Boolean apply(Object o) {
assertNotNull(o);
IgniteMessaging msg = client.message();
msg.send(null, "Test message.");
try {
assertTrue(recvLatch.await(2, SECONDS));
}
catch (InterruptedException ignored) {
fail("Message wasn't received.");
}
return true;
}
}
代码示例来源:origin: apache/ignite
/**
* @param nodeSnd Sender Ignite node.
* @param grp Cluster group.
* @param msg Message.
* @param async Async message send flag.
*/
private void sendMessage(Ignite nodeSnd, ClusterGroup grp, Object msg, boolean async) {
if (async)
nodeSnd.message(grp).withAsync().send(MESSAGE_TOPIC, msg);
else
nodeSnd.message(grp).send(MESSAGE_TOPIC, msg);
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testSendOrderedDefaultModeMultiThreads() throws Exception {
Ignite ignite = startGrid(1);
sendOrderedMultiThreads(ignite.message());
}
代码示例来源:origin: apache/ignite
/**
* @param grp Cluster group.
* @return Message listener uuid.
* @throws Exception If failed.
*/
private UUID registerListener(ClusterGroup grp) throws Exception {
Ignite ignite = grid(SERVER_NODE_IDX);
IgniteBiPredicate<UUID,Object> lsnr = new MessageListener();
return ignite.message(grp).remoteListen(MESSAGE_TOPIC, lsnr);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public boolean apply(UUID nodeId, String msg) {
ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.ORDERED, msg);
return true;
}
}
代码示例来源:origin: apache/ignite
/**
* Checks if use default mode, local listeners execute in the same thread, 1 node in topology.
*
* @throws Exception If failed.
*/
@Test
public void testSendDefaultMode() throws Exception {
Ignite ignite1 = startGrid(1);
send(ignite1.message(), msgStr, new IgniteBiInClosure<String, Thread> () {
@Override public void apply(String msg, Thread thread) {
Assert.assertEquals(Thread.currentThread(), thread);
Assert.assertEquals(msgStr, msg);
}
}, false);
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testSendOrderedDefaultModeMultiThreadsWith2Node() throws Exception {
Ignite ignite1 = startGrid(1);
Ignite ignite2 = startGrid(2);
sendOrderedMultiThreadsWith2Node(ignite2, ignite1.message());
}
内容来源于网络,如有侵权,请联系作者删除!