@Override protected T3<GridKernalContext, String, String> initialValue() { return new T3<>(); } };
@Override protected T3<GridKernalContext, String, String> initialValue() { return new T3<>(); } };
/** {@inheritDoc} */ @Override public Object mergeKey() { return new T3<>(getClass(), nearVer, dhtVer); } }
assert args != null; T3<Class, String, Integer> cacheKey = new T3<>(clazz, mthdName, args.length); Method res = SVC_METHODS.get(cacheKey);
@Override public void onCustomEvent(AffinityTopologyVersion topVer, ClusterNode snd, TestFastStopProcessCustomMessageAck msg) { List<T3<AffinityTopologyVersion, UUID, DiscoveryCustomMessage>> list = rcvdMsgs.get(nodeId); if (list == null) rcvdMsgs.put(nodeId, list = new ArrayList<>()); list.add(new T3<>(topVer, snd.id(), (DiscoveryCustomMessage)msg)); } }
@Override public void onCustomEvent(AffinityTopologyVersion topVer, ClusterNode snd, TestFastStopProcessCustomMessage msg) { List<T3<AffinityTopologyVersion, UUID, DiscoveryCustomMessage>> list = rcvdMsgs.get(nodeId); if (list == null) rcvdMsgs.put(nodeId, list = new ArrayList<>()); list.add(new T3<>(topVer, snd.id(), (DiscoveryCustomMessage)msg)); } }
@Override protected T3<Long, Long, Long> doSnapshot() { if (rnd.nextBoolean()) throw new IgniteException(oops); return new T3<>(x.get(), y.get(), z.get()); } };
/** * Block indexing. * * @param nodeId Node. */ @SuppressWarnings("SuspiciousMethodCalls") private static CountDownLatch blockIndexing(UUID nodeId) { assertFalse(BLOCKS.contains(nodeId)); CountDownLatch idxLatch = new CountDownLatch(1); BLOCKS.put(nodeId, new T3<>(new CountDownLatch(1), new AtomicBoolean(), idxLatch)); return idxLatch; }
/** * Block indexing. * * @param nodeId Node. */ @SuppressWarnings("SuspiciousMethodCalls") private static CountDownLatch blockIndexing(UUID nodeId) { assertFalse(BLOCKS.contains(nodeId)); CountDownLatch idxLatch = new CountDownLatch(1); BLOCKS.put(nodeId, new T3<>(new CountDownLatch(1), new AtomicBoolean(), idxLatch)); return idxLatch; }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { map = newMap(); if (kvMap.isEmpty()) for (int i = 0; i < LOAD_CNT; i++) { String k = string(); String v = string(); kvMap.put(k, new T3<>(v, k.getBytes(), v.getBytes())); } }
/** * @param name Timer name to start. */ private void startTimer(String name) { ConcurrentMap<String, T3<Long, Long, Long>> m = timers.get(Thread.currentThread()); if (m == null) { ConcurrentMap<String, T3<Long, Long, Long>> old = timers.putIfAbsent(Thread.currentThread(), m = new ConcurrentHashMap<>()); if (old != null) m = old; } T3<Long, Long, Long> t = m.get(name); if (t == null) { T3<Long, Long, Long> old = m.putIfAbsent(name, t = new T3<>()); if (old != null) t = old; } t.set1(System.currentTimeMillis()); t.set2(0L); }
/** * Reads and decrypt data from {@code in} stream. * * @param in Input stream. * @param readType If {@code true} plain record type will be read from {@code in}. * @return Plain data stream, group id, plain record type, * @throws IOException If failed. * @throws IgniteCheckedException If failed. */ private T3<ByteBufferBackedDataInput, Integer, RecordType> readEncryptedData(ByteBufferBackedDataInput in, boolean readType) throws IOException, IgniteCheckedException { int grpId = in.readInt(); int encRecSz = in.readInt(); RecordType plainRecType = null; if (readType) plainRecType = RecordV1Serializer.readRecordType(in); byte[] encData = new byte[encRecSz]; in.readFully(encData); Serializable key = encMgr.groupKey(grpId); if (key == null) return new T3<>(null, grpId, plainRecType); byte[] clData = encSpi.decrypt(encData, key); return new T3<>(new ByteBufferBackedDataInputImpl().buffer(ByteBuffer.wrap(clData)), grpId, plainRecType); }
/** {@inheritDoc} */ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) throws IgniteSpiException { Class msgCls0 = msgCls; if (msgCls0 != null && ((GridIoMessage)msg).message().getClass().equals(msgCls0)) { queue.add(new T3<>(node, msg, ackC)); log.info("Block message: " + msg); return; } if (((GridIoMessage)msg).message().getClass().equals(GridDhtPartitionsSingleMessage.class)) { if (cls != null) cls.apply((GridDhtPartitionsSingleMessage)((GridIoMessage)msg).message()); } super.sendMessage(node, msg, ackC); }
/** * @param ignite Ignite instance. * @return 3 pairs {@code {cacheName, tableName, indexName}} for further sql operations. */ @NotNull private List<T3<String, String, String>> createCaches(IgniteEx ignite) { List<T3<String, String, String>> caches = new ArrayList<>(); for (int i = 0; i < 3; i++) { String tblName = "TABLE_" + UUID.randomUUID().toString().replace('-', '_'); String cacheName = "CACHE_" + tblName; CacheConfiguration<?, ?> ccfg = new CacheConfiguration<>(cacheName).setSqlSchema("PUBLIC"); IgniteCache<?, ?> cache = ignite.createCache(ccfg); String createTblQryStr = String.format( "CREATE TABLE %s (id LONG, name VARCHAR, city_id LONG, PRIMARY KEY (id, city_id)) " + "WITH \"backups=1, affinityKey=city_id\"", tblName ); cache.query(new SqlFieldsQuery(createTblQryStr)).getAll(); String idxName = "IDX_" + tblName; caches.add(new T3<>(cacheName, tblName, idxName)); } return caches; }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { map = newMap(); if (keys == null) { keys = new T3[LOAD_CNT]; wrappers = new GridByteArrayWrapper[LOAD_CNT]; AffinityFunction aff = new RendezvousAffinityFunction(); Random rnd = new Random(); for (int i = 0; i < LOAD_CNT; i++) { byte[] key = new byte[rnd.nextInt(511) + 1]; rnd.nextBytes(key); GridByteArrayWrapper wrap = new GridByteArrayWrapper(key); keys[i] = new T3<>(aff.partition(wrap), wrap.hashCode(), key); wrappers[i] = wrap; } } }
/** * @return Result. */ @SuppressWarnings("ConstantConditions") @Override public Object execute() { ConcurrentMap<String, T2<AtomicLong, AtomicLong>> nodeLoc = ignite.cluster().nodeLocalMap(); T2<AtomicLong, AtomicLong> cntrs = nodeLoc.get("cntrs"); if (cntrs == null) { T2<AtomicLong, AtomicLong> other = nodeLoc.putIfAbsent("cntrs", cntrs = new T2<>(new AtomicLong(), new AtomicLong(System.currentTimeMillis()))); if (other != null) cntrs = other; } long cnt = cntrs.get1().incrementAndGet(); GridNearCacheAdapter near = (GridNearCacheAdapter)((IgniteKernal) ignite).internalCache(cacheName); GridDhtCacheAdapter dht = near.dht(); doWork(); long start = cntrs.get2().get(); long now = System.currentTimeMillis(); long dur = now - start; if (dur > 20000 && cntrs.get2().compareAndSet(start, System.currentTimeMillis())) { cntrs.get1().set(0); long txPerSec = cnt / (dur / 1000); X.println("Stats [tx/sec=" + txPerSec + ", nearSize=" + near.size() + ", dhtSize=" + dht.size() + ']'); return new T3<>(txPerSec, near.size(), dht.size()); } return null; }
return new T3<>(key, oldVal, newVal);
expCaches.put(DEFAULT_CACHE_NAME, new T3<>(RendezvousAffinityFunction.DFLT_PARTITION_COUNT, 0, 1)); expCaches.put("c1", new T3<>(64, 1, 2)); expCaches.put("c2", new T3<>(128, 2, 2)); expCaches.put("c3", new T3<>(256, 1, 2)); expCaches.put("c2", new T3<>(128, 2, 3)); expCaches.put("c3", new T3<>(256, 1, 4)); expCaches.put("c4", new T3<>(256, 0, 1)); expCaches.put("c3", new T3<>(256, 1, 3)); expCaches.put("c3", new T3<>(256, 1, 4)); expCaches.put("c3", new T3<>(256, 1, 3));
afterRestEvts.add(new T3<>((Object)j, (Object)i, (Object)oldVal));