@Override public Flowable<K> publishKeys(IntSet segments, Predicate<? super K> filter) { Flowable<K> keys = Flowable.using(Functions.justCallable(this.remoteCache.keySet(segments).iterator()), this, CloseableIterator::close); return (filter != null) ? keys.filter(filter::test) : keys; }
public void loadProtobufSchema(RemoteCache<String, String> metadataCache) { metadataCache.entrySet() .stream() .filter(entry -> !entry.getKey().equals(SCHEMA_PROTO)) .forEach((entry) -> { int index = entry.getKey().lastIndexOf('.'); String protoTypeName = entry.getKey().substring(0, index); String proto = entry.getValue(); try { marshaller.registerSchema(protoTypeName, proto, KObject.class); } catch (IOException e) { throw new InfinispanException("Can't add protobuf schema <" + protoTypeName + "> to cache", e); } }); }
public static void testKeySet(RemoteCache<String, String> remoteCache) { remoteCache.clear(); remoteCache.put(KEY1, VALUE1); remoteCache.put(KEY2, VALUE2); assertEquals(2, remoteCache.keySet().size()); }
public void loadProtobufSchema(RemoteCache<String, String> metadataCache) { metadataCache.entrySet() .stream() .filter(entry -> !entry.getKey().equals(addCachePrefix(SCHEMA_PROTO))) .forEach((entry) -> { int index = entry.getKey().lastIndexOf('.'); String protoTypeName = entry.getKey().substring(0, index); String proto = entry.getValue(); try { marshaller.registerSchema(protoTypeName, proto, KObject.class); } catch (IOException e) { throw new InfinispanException("Can't add protobuf schema <" + protoTypeName + "> to cache", e); } }); }
/** * Retrieve the sessions using protobuf format and print them out to * confirm they're ok. */ public void checkConverted () { List<String> keys = null; try { keys = _protoCache.keySet().stream().collect(Collectors.toList()); } catch (Exception e) { System.err.println("Unable to read converted sessions, assuming still in legacy format. Run again without 'check' option to convert."); e.printStackTrace(); System.exit(1); } for (String s:keys) { InfinispanSessionData converted = (InfinispanSessionData)_protoCache.get(s); if (converted != null) { System.err.println("OK: "+converted); converted.getKeys().stream().forEach((ss)->{System.err.println(ss+":"+converted.getAttribute(ss));}); } else System.err.println("Failed: "+s); } System.err.println("Total converted sessions: "+keys.size()); }
@Override public Flowable<K> publishKeys(IntSet segments, Predicate<? super K> filter) { Flowable<K> keys = Flowable.using(Functions.justCallable(this.remoteCache.keySet(segments).iterator()), this, CloseableIterator::close); return (filter != null) ? keys.filter(filter::test) : keys; }
keys = _legacyCache.keySet().stream().collect(Collectors.toList());
@Override public void removeAll() { checkNotClosed(); try (CloseableIterator<K> it = cacheWithoutStats.keySet().iterator()) { while (it.hasNext()) { remove(it.next()); } } //FIXME locks }