/** * @param idx Index. * @return Topic for index. */ public static Object rebalanceTopic(int idx) { return TOPIC_CACHE.topic("Rebalance", idx); }
/** * Gets topic for ordered response messages. * * @param nodeId Node ID. * @param reqId Request ID. * @return Topic. */ private Object topic(UUID nodeId, long reqId) { return TOPIC_CACHE.topic(TOPIC_PREFIX, nodeId, reqId); }
/** * @return Communication topic for receiving. */ public synchronized Object taskTopic() { if (taskTopic == null) taskTopic = TOPIC_TASK.topic(jobId, nodeId); return taskTopic; }
/** * @return Communication topic for sending. */ public synchronized Object jobTopic() { if (jobTopic == null) jobTopic = TOPIC_JOB.topic(jobId, nodeId); return jobTopic; }
return new CacheContinuousQueryHandler( cctx.name(), TOPIC_CACHE.topic(topicPrefix, cctx.localNodeId(), seq.getAndIncrement()), locLsnr, rmtFilter,
TOPIC_CACHE.topic(topicPrefix, ctx.localNodeId(), seq.incrementAndGet()), locLsnr, rmtFilter,
/** * @throws Exception If failed. */ @Test public void testSerializationTopicCreatedByGridUuidAndLong() throws Exception { for (Marshaller marsh : getMarshallers()) { info("Test GridTopic externalization [marshaller=" + marsh + ']'); for (GridTopic topic : GridTopic.values()) { Externalizable msgOut = (Externalizable)topic.topic(A_GRID_UUID, A_LONG); assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh)); } } }
/** * @throws Exception If failed. */ @Test public void testSerializationTopicCreatedByStringAndUUIDAndLong() throws Exception { for (Marshaller marsh : getMarshallers()) { info("Test GridTopic externalization [marshaller=" + marsh + ']'); for (GridTopic topic : GridTopic.values()) { Externalizable msgOut = (Externalizable)topic.topic(A_STRING, AN_UUID, A_LONG); assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh)); } } }
/** * @throws Exception If failed. */ @Test public void testSerializationTopicCreatedByGridUuidAndUUID() throws Exception { for (Marshaller marsh : getMarshallers()) { info("Test GridTopic externalization [marshaller=" + marsh + ']'); for (GridTopic topic : GridTopic.values()) { Externalizable msgOut = (Externalizable)topic.topic(A_GRID_UUID, AN_UUID); assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh)); } } }
/** * @throws Exception If failed. */ @Test public void testSerializationTopicCreatedByGridUuid() throws Exception { for (Marshaller marsh : getMarshallers()) { info("Test GridTopic externalization [marshaller=" + marsh + ']'); for (GridTopic topic : GridTopic.values()) { Externalizable msgOut = (Externalizable)topic.topic(A_GRID_UUID); assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh)); } } }
/** * @throws Exception If failed. */ @Test public void testSerializationTopicCreatedByStringAndIntAndLong() throws Exception { for (Marshaller marsh : getMarshallers()) { info("Test GridTopic externalization [marshaller=" + marsh + ']'); for (GridTopic topic : GridTopic.values()) { Externalizable msgOut = (Externalizable)topic.topic(A_STRING, AN_INT, A_LONG); assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh)); } } }
/** * @throws Exception If failed. */ @Test public void testSerializationTopicCreatedByStrinAndLong() throws Exception { for (Marshaller marsh : getMarshallers()) { info("Test GridTopic externalization [marshaller=" + marsh + ']'); for (GridTopic topic : GridTopic.values()) { Externalizable msgOut = (Externalizable)topic.topic(A_STRING, A_LONG); assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh)); } } }
/** * @throws Exception If failed. */ @Test public void testSerializationTopicCreatedByString() throws Exception { for (Marshaller marsh : getMarshallers()) { info("Test GridTopic externalization [marshaller=" + marsh + ']'); for (GridTopic topic : GridTopic.values()) { Externalizable msgOut = (Externalizable)topic.topic(A_STRING); assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh)); } } }
/** * @throws Exception If failed. */ @Test public void testSerializationTopicCreatedByStringAndUUIDAndIntAndLong() throws Exception { for (Marshaller marsh : getMarshallers()) { info("Test GridTopic externalization [marshaller=" + marsh + ']'); for (GridTopic topic : GridTopic.values()) { Externalizable msgOut = (Externalizable)topic.topic(A_STRING, AN_UUID, AN_INT, A_LONG); assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh)); } } } }
/** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { dataCacheStartLatch = new CountDownLatch(1); String igfsName = igfsCtx.configuration().getName(); topic = F.isEmpty(igfsName) ? TOPIC_IGFS : TOPIC_IGFS.topic(igfsName); igfsCtx.kernalContext().io().addMessageListener(topic, new GridMessageListener() { @Override public void onMessage(UUID nodeId, Object msg, byte plc) { if (msg instanceof IgfsBlocksMessage) processBlocksMessage(nodeId, (IgfsBlocksMessage)msg); else if (msg instanceof IgfsAckMessage) processAckMessage(nodeId, (IgfsAckMessage)msg); } }); igfsCtx.kernalContext().event().addLocalEventListener(new GridLocalEventListener() { @Override public void onEvent(Event evt) { assert evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT; DiscoveryEvent discoEvt = (DiscoveryEvent)evt; if (igfsCtx.igfsNode(discoEvt.eventNode())) { for (WriteCompletionFuture future : pendingWrites.values()) { future.onError(discoEvt.eventNode().id(), new ClusterTopologyCheckedException("Node left grid before write completed: " + evt.node().id())); } } } }, EVT_NODE_LEFT, EVT_NODE_FAILED); delWorker = new AsyncDeleteWorker(igfsCtx.kernalContext().igniteInstanceName(), "igfs-" + igfsName + "-delete-worker", log); dataCacheName = igfsCtx.configuration().getDataCacheConfiguration().getName(); }
/** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { if (!igfsCtx.configuration().isFragmentizerEnabled()) return; // We care only about node leave and fail events. igfsCtx.kernalContext().event().addLocalEventListener(new GridLocalEventListener() { @Override public void onEvent(Event evt) { assert evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED; DiscoveryEvent discoEvt = (DiscoveryEvent)evt; checkLaunchCoordinator(discoEvt); } }, EVT_NODE_LEFT, EVT_NODE_FAILED); fragmentizerWorker = new FragmentizerWorker(); String igfsName = igfsCtx.configuration().getName(); topic = F.isEmpty(igfsName) ? TOPIC_IGFS : TOPIC_IGFS.topic(igfsName); igfsCtx.kernalContext().io().addMessageListener(topic, fragmentizerWorker); new IgniteThread(fragmentizerWorker).start(); }
loc ? null : U.marshal(marsh, attrs), attrs); Object topic = TOPIC_TASK.topic(ses.getJobId(), ctx.discovery().localNode().id());
/** * @throws Exception If failed. */ @Test public void testBrokenMessage() throws Exception { startGrids(GRID_CNT); try { IgniteKernal kernal = (IgniteKernal)ignite(0); UUID nodeId = ignite(1).cluster().localNode().id(); // This should trigger a failure in a NIO thread. kernal.context().io().sendToCustomTopic(nodeId, GridTopic.TOPIC_CACHE.topic("cache"), new BrokenMessage(), (byte)0); for (int i = 0; i < 100; i++) ignite(0).cache("cache").put(i, i); } finally { stopAllGrids(); } }