/** * */ private void notifyConnectionLost() { if (!closing && state == ConnectionState.Lost && connLostC != null) connLostC.run(); connTimer.cancel(); }
/** * @param c Closure. */ private void onDiscoveryEvent(IgniteRunnable c) { synchronized (discoEvts) { if (!init) { discoEvts.add(c); return; } assert discoEvts.isEmpty() : discoEvts; } c.run(); }
@Override public void run() { try { threadProcessingMessage(true, msgC); processRegularMessage0(msg, nodeId); } finally { threadProcessingMessage(false, null); msgC.run(); } }
/** * Moves exchange future to state 'init done' using {@link #initFut}. */ private void initDone() { while (!isDone()) { List<IgniteRunnable> evts; synchronized (discoEvts) { if (discoEvts.isEmpty()) { init = true; break; } evts = new ArrayList<>(discoEvts); discoEvts.clear(); } for (IgniteRunnable c : evts) c.run(); } initFut.onDone(true); }
/** * @param lsnr Listener to notify. */ void unwind(GridMessageListener lsnr) { assert reserved.get(); for (GridTuple3<GridIoMessage, Long, IgniteRunnable> t = msgs.poll(); t != null; t = msgs.poll()) { try { invokeListener(plc, lsnr, nodeId, t.get1().message()); } finally { if (t.get3() != null) t.get3().run(); } } }
/** {@inheritDoc} */ @Override public void onMessage(UUID nodeId, Message msg, IgniteRunnable msgC) { msgC.run(); if (msg instanceof GridTestMessage) { GridTestMessage testMsg = (GridTestMessage)msg; if (!testMsg.getSourceNodeId().equals(nodeId)) fail("Listener nodeId is not equal to message nodeId."); if (!reject) rcvdMsgs.offer(testMsg); if (!locNodeId.equals(nodeId)) rmtMsgCnt.incrementAndGet(); } }
/** {@inheritDoc} */ @Override public void onMessage(UUID nodeId, Message msg, IgniteRunnable msgC) { msgC.run(); assertTrue(msg instanceof GridTestMessage); cntr.incrementAndGet(); GridTestMessage msg0 = (GridTestMessage)msg; assertEquals(nodeId, msg0.getSourceNodeId()); assertTrue(msgIds.add(msg0.getMsgId())); latch.countDown(); }
/** {@inheritDoc} */ @Override public void onMessage(UUID nodeId, Message msg, IgniteRunnable msgC) { msgC.run(); if (msg instanceof GridTestMessage) { GridTestMessage testMsg = (GridTestMessage)msg; if (!testMsg.getSourceNodeId().equals(nodeId)) fail("Listener nodeId is not equal to message nodeId."); if (!reject) rcvdMsgs.offer(testMsg); if (!locNodeId.equals(nodeId)) rmtMsgCnt.incrementAndGet(); } else fail(); }
@Override public void run() { try { threadProcessingMessage(true, msgC); GridMessageListener lsnr = listenerGet0(msg.topic()); if (lsnr == null) return; Object obj = msg.message(); assert obj != null; invokeListener(msg.policy(), lsnr, nodeId, obj); } finally { threadProcessingMessage(false, null); msgC.run(); } } };
/** * @param cache Cache. * @param c Cache operation Closure. * @param concurrency Transaction concurrency. * @param isolation Transaction isolation. * @param expLoadCnt Expected number of store 'load' calls. * @throws Exception If failed. */ private void checkReadThrough(IgniteCache<Object, Object> cache, IgniteRunnable c, @Nullable TransactionConcurrency concurrency, @Nullable TransactionIsolation isolation, int expLoadCnt) throws Exception { TestStore.loadCnt.set(0); Transaction tx = isolation != null ? cache.unwrap(Ignite.class).transactions().txStart(concurrency, isolation) : null; try { c.run(); if (tx != null) tx.commit(); } finally { if (tx != null) tx.close(); } assertEquals(expLoadCnt, TestStore.loadCnt.get()); }
msgC.run();
/** * @param cls Closure to execute with disabled WAL. * @throws IgniteCheckedException If execution failed. */ public void execute(IgniteRunnable cls) throws IgniteCheckedException { if (cls == null) throw new IgniteCheckedException("Task to execute is not specified."); if (metaStorage == null) throw new IgniteCheckedException("Meta storage is not ready."); writeMetaStoreDisableWALFlag(); dbMgr.waitForCheckpoint("Checkpoint before apply updates on recovery."); disableWAL(true); try { cls.run(); } catch (IgniteException e) { throw new IgniteCheckedException(e); } finally { disableWAL(false); dbMgr.waitForCheckpoint("Checkpoint after apply updates on recovery."); removeMetaStoreDisableWALFlag(); } }
/** * @param c Closure. */ private void onDiscoveryEvent(IgniteRunnable c) { synchronized (discoEvts) { if (!init) { discoEvts.add(c); return; } assert discoEvts.isEmpty() : discoEvts; } c.run(); }
/** * Moves exchange future to state 'init done' using {@link #initFut}. */ private void initDone() { while (!isDone()) { List<IgniteRunnable> evts; synchronized (discoEvts) { if (discoEvts.isEmpty()) { init = true; break; } evts = new ArrayList<>(discoEvts); discoEvts.clear(); } for (IgniteRunnable c : evts) c.run(); } initFut.onDone(true); }
@Override public void run() { try { threadProcessingMessage(true, msgC); processRegularMessage0(msg, nodeId); } finally { threadProcessingMessage(false, null); msgC.run(); } }
/** * @param lsnr Listener to notify. */ void unwind(GridMessageListener lsnr) { assert reserved.get(); for (GridTuple3<GridIoMessage, Long, IgniteRunnable> t = msgs.poll(); t != null; t = msgs.poll()) { try { invokeListener(plc, lsnr, nodeId, t.get1().message()); } finally { if (t.get3() != null) t.get3().run(); } } }
@Override public void run() { try { threadProcessingMessage(true, msgC); GridMessageListener lsnr = listenerGet0(msg.topic()); if (lsnr == null) return; Object obj = msg.message(); assert obj != null; invokeListener(msg.policy(), lsnr, nodeId, obj); } finally { threadProcessingMessage(false, null); msgC.run(); } } };
/** * @param cls Closure to execute with disabled WAL. * @throws IgniteCheckedException If execution failed. */ public void execute(IgniteRunnable cls) throws IgniteCheckedException { if (cls == null) throw new IgniteCheckedException("Task to execute is not specified."); if (metaStorage == null) throw new IgniteCheckedException("Meta storage is not ready."); writeMetaStoreDisableWALFlag(); dbMgr.waitForCheckpoint("Checkpoint before apply updates on recovery."); disableWAL(true); try { cls.run(); } catch (IgniteException e) { throw new IgniteCheckedException(e); } finally { disableWAL(false); dbMgr.waitForCheckpoint("Checkpoint after apply updates on recovery."); removeMetaStoreDisableWALFlag(); } }