/** * Get index of a system listener. * * @param topic Topic. * @return Index. */ private int systemListenerIndex(Object topic) { assert topic instanceof GridTopic; return ((GridTopic)topic).ordinal(); }
/** * @param idx Index. * @return Topic for index. */ public static Object rebalanceTopic(int idx) { return TOPIC_CACHE.topic("Rebalance", idx); }
/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { topic = fromOrdinal(in.readByte()); id1 = U.readUuid(in); id2 = in.readInt(); id3 = in.readLong(); }
/** * @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)); } } }
/** * @param ctx Grid kernal context. */ @SuppressWarnings("deprecation") public GridIoManager(GridKernalContext ctx) { super(ctx, ctx.config().getCommunicationSpi()); pools = ctx.pools(); assert pools != null; locNodeId = ctx.localNodeId(); marsh = ctx.config().getMarshaller(); synchronized (sysLsnrsMux) { sysLsnrs = new GridMessageListener[GridTopic.values().length]; } }
/** * Get topic to which replication requests are sent. * * @return Topic to which replication requests are sent. */ public static String replicationTopicSend() { return TOPIC_REPLICATION.toString(); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { ((IgniteKernal)grid()).context().io(). removeMessageListener(GridTopic.TOPIC_COMM_USER.name()); }
/** * @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)); } } }
/** * @param ctx Grid kernal context. */ @SuppressWarnings("deprecation") public GridIoManager(GridKernalContext ctx) { super(ctx, ctx.config().getCommunicationSpi()); pools = ctx.pools(); assert pools != null; locNodeId = ctx.localNodeId(); marsh = ctx.config().getMarshaller(); synchronized (sysLsnrsMux) { sysLsnrs = new GridMessageListener[GridTopic.values().length]; } }
/** * Get topic to which replication requests are sent. * * @return Topic to which replication requests are sent. */ public static String replicationTopicSend() { return TOPIC_REPLICATION.toString(); }
/** {@inheritDoc} */ @Override public int hashCode() { return topic.ordinal() + id1.hashCode(); }
/** * @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)); } } }
/** * 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); }
/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { topic = fromOrdinal(in.readByte()); id1 = U.readUuid(in); id2 = in.readLong(); }
/** {@inheritDoc} */ @Override public int hashCode() { return topic.ordinal() + id1.hashCode () + (int)(id2 ^ (id2 >>> 32)); }
/** * @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)); } } }
/** * @return Communication topic for receiving. */ public synchronized Object taskTopic() { if (taskTopic == null) taskTopic = TOPIC_TASK.topic(jobId, nodeId); return taskTopic; }
/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { topic = fromOrdinal(in.readByte()); id1 = U.readGridUuid(in); id2 = in.readLong(); }
/** {@inheritDoc} */ @Override public int hashCode() { return topic.ordinal() + id1.hashCode() + id2 + (int)(id3 ^ (id3 >>> 32)); }
/** * @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)); } } }