本文整理了Java中org.apache.ignite.Ignite.events()
方法的一些代码示例,展示了Ignite.events()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignite.events()
方法的具体详情如下:
包路径:org.apache.ignite.Ignite
类名称:Ignite
方法名:events
[英]Gets events facade over all cluster nodes.
[中]获取所有群集节点上的事件外观。
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public IgniteEvents events() {
checkIgnite();
return g.events();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public IgniteEvents events(ClusterGroup grp) {
checkIgnite();
return g.events(grp);
}
代码示例来源:origin: apache/ignite
/**
* @param ignite Grid to remove listeners from.
*/
private void removeListeners(Ignite ignite) {
for (IgnitePredicate<Event> lsnr : lsnrs)
ignite.events().stopLocalListen(lsnr);
}
代码示例来源:origin: apache/ignite
@Override public Boolean apply(Object o) {
UUID remoteId = (UUID)o;
assertNotNull(remoteId);
client.events().stopRemoteListen(remoteId);
return true;
}
}
代码示例来源:origin: apache/ignite
/**
* Stops the remote listener.
*/
protected void stopRemoteListen() {
if (rmtLsnrId != null)
IgniteGrid.getIgnite().events(IgniteGrid.getIgnite().cluster().forCacheNodes(cacheName))
.stopRemoteListen(rmtLsnrId);
rmtLsnrId = null;
}
代码示例来源:origin: apache/ignite
/**
* @param ignite Grid to remove listeners from.
*/
private void removeListeners(Ignite ignite) {
if (ignite != null)
for (CacheEventListener lsnr : lsnrs) {
assert lsnr.latch.getCount() == 0;
ignite.events().stopLocalListen(lsnr);
}
}
代码示例来源:origin: apache/ignite
/**
*
* @param ignite Grid.
* @param lsnr Listener.
* @param type Event types.
*/
private void addListener(Ignite ignite, CacheEventListener lsnr, int... type) {
if (!lsnrs.contains(lsnr))
lsnrs.add(lsnr);
ignite.events().localListen(lsnr, type.length == 0 ? EVTS_CACHE : type);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void cancel() {
synchronized (this) {
if (!isRunning)
return;
isRunning = false;
if (rmtLsnrId != null && ignite != null) {
ignite.events(ignite.cluster().forCacheNodes(cacheName))
.stopRemoteListen(rmtLsnrId);
rmtLsnrId = null;
}
}
}
代码示例来源:origin: apache/ignite
/**
* @param prj Projection.
* @return {@link org.apache.ignite.IgniteMessaging} for given projection.
*/
protected IgniteEvents events(ClusterGroup prj) {
return prj.ignite().events(prj);
}
代码示例来源:origin: apache/ignite
/**
* @param g Grid.
* @return Enabled events.
*/
private int[] getEnabledEvents(Ignite g) {
return g.events().enabledEvents();
}
代码示例来源:origin: apache/ignite
/**
* @param ignite Grid
* @param lsnr Listener.
*/
void addListener(Ignite ignite, IgnitePredicate<Event> lsnr) {
if (!lsnrs.contains(lsnr))
lsnrs.add(lsnr);
ignite.events().localListen(lsnr, EVTS_CACHE);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void run() {
ignite.events().localListen(lsnr, types);
}
}
代码示例来源:origin: apache/ignite
/**
* @param execId Execution ID.
*/
private void checkTimedOutEvents(final IgniteUuid execId) {
Ignite ignite = G.ignite(getTestIgniteInstanceName());
Collection<Event> evts = ignite.events().localQuery(new PE() {
@Override public boolean apply(Event evt) {
return ((TaskEvent) evt).taskSessionId().equals(execId);
}
}, EVT_TASK_TIMEDOUT);
assert evts.size() == 1 : "Invalid number of timed out tasks: " + evts.size();
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception Thrown in case of any errors.
*/
@Test
public void testRemoveDiscoveryListener() throws Exception {
try {
ignite.events().stopLocalListen(null);
assert false : "Null listener can't be removed.";
}
catch (NullPointerException ignored) {
// No-op.
}
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception Thrown in case of any errors.
*/
@Test
public void testAddEventLocalListener() throws Exception {
try {
ignite.events().localListen(null, EVTS_ALL);
assert false : "Null listener can't be added.";
}
catch (NullPointerException ignored) {
// No-op.
}
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception Thrown in case of any errors.
*/
@Test
public void testRemoveEventLocalListener() throws Exception {
try {
ignite.events().stopLocalListen(null);
assert false : "Null listener can't be removed.";
}
catch (NullPointerException ignored) {
// No-op.
}
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception Thrown in case of any errors.
*/
@Test
public void testAddDiscoveryListener() throws Exception {
try {
ignite.events().localListen(null, EVTS_ALL);
assert false : "Null listener can't be added.";
}
catch (NullPointerException ignored) {
// No-op.
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
for (int i = 0; i < PERM_NODES_CNT; i++) {
Ignite g = startGrid(gridCntr++);
g.events().localListen(lsnr, EventType.EVT_NODE_LEFT, EventType.EVT_NODE_FAILED);
alive.add(g);
}
for (int i = 0; i < PERM_NODES_CNT + TMP_NODES_CNT; i++)
F.rand(alive).cache(DEFAULT_CACHE_NAME).put(i, String.valueOf(i));
}
代码示例来源:origin: apache/ignite
/**
* Starts temporary nodes.
*
* @throws Exception If failed.
*/
private void startTempNodes() throws Exception {
for (int j = 0; j < TMP_NODES_CNT; j++) {
Ignite newNode = startGrid(gridCntr++);
info("New node started: " + newNode.name());
alive.add(newNode);
newNode.events().localListen(lsnr, EventType.EVT_NODE_LEFT, EventType.EVT_NODE_FAILED);
}
}
代码示例来源:origin: apache/ignite
/**
*
*/
public void register() {
ignite().events().localListen(this.delegate, this.causes);
sync();
}
内容来源于网络,如有侵权,请联系作者删除!