@Override public Publisher<K> apply(CloseableIterator<byte[]> iterator) { return Flowable.fromIterable(new SimpleIterable<>(new IteratorMapper<>(iterator, this::unmarshallKey))); }
@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; }
try (Batch batch = this.batcher.createBatch()) { try (CloseableIterator<Map.Entry<T, Set<Address>>> entries = this.cache.entrySet().iterator()) { while (entries.hasNext()) { Map.Entry<T, Set<Address>> entry = entries.next(); Set<Address> addresses = entry.getValue(); if (addresses.removeAll(leftMembers)) {
private static InputStream lookupFile(String configFile, ClassLoader classLoader, ClassLoader strictClassLoader) throws FileNotFoundException { FileLookup fileLookup = FileLookupFactory.newInstance(); InputStream input = fileLookup.lookupFile(configFile, classLoader); // when it's not a user-provided configuration file, it might be a default configuration file, // and if that's included in [this] module might not be visible to the ClassLoaderService: if (input == null) { // This time use lookupFile*Strict* so to provide an exception if we can't find it yet: input = fileLookup.lookupFileStrict(configFile, strictClassLoader); } return input; }
@Override public Set<Class<? extends IdViaBothObj>> getTypeClasses() { return Util.<Class<? extends IdViaBothObj>>asSet(IdViaBothObj.class); } }
@Test(expected = UnsupportedOperationException.class) public void testAddAll1() throws Exception { IntSet sis = new SingletonIntSet(3); SmallIntSet sis2 = new SmallIntSet(); sis.addAll(sis2); }
@Test(expected = UnsupportedOperationException.class) public void retainAll1() throws Exception { IntSet rs = new RangeSet(5); SmallIntSet sis = new SmallIntSet(); rs.retainAll(sis); }
/** * Returns an IntSet that contains all ints from the given Set that is mutable. Updates to the original Set or * the returned IntSet are not reflected in the other. * @param mutableSet set to copy from * @return IntSet with the values set */ public static IntSet mutableCopyFrom(Set<Integer> mutableSet) { if (mutableSet instanceof SingletonIntSet) { return mutableSet(((SingletonIntSet) mutableSet).value); } return new SmallIntSet(mutableSet); }
public static ClassLoader[] getClassLoaders(ClassLoader appClassLoader) { if (isOSGiContext()) { return SecurityActions.getOSGIContextClassLoaders(appClassLoader); } else { return SecurityActions.getClassLoaders(appClassLoader); } }
@Test(expected = UnsupportedOperationException.class) public void testAddAll2() throws Exception { Set<Integer> hashSet = CollectionFactory.makeSet(1, 4); IntSet sis = new SingletonIntSet(3); sis.addAll(hashSet); }
@SuppressWarnings("unchecked") private void putForCreate(K key, V value) { Entry<K, V>[] table = this.table; int hash = hash(key); int length = table.length; int index = index(hash, length); Entry<K, V> e = table[index]; while (e != null) { index = nextIndex(index, length); e = table[index]; } table[index] = new Entry<K, V>(key, hash, value); }
public static String getProperty(String key, String legacyKey) { String val = SecurityActions.getProperty(key); if (val == null) { val = SecurityActions.getProperty(legacyKey); if (val != null) warnLegacy(legacyKey, key); } return val; }
@Override public Set<Entry<K, V>> entrySet() { processQueue(); return new EntrySet(); }
@Override public Entry<K, V> next() { return new ImmutableEntry<>(super.next()); } };
@Override public Set<String> stringPropertyNames() { return new ImmutableSetWrapper<>(super.stringPropertyNames()); }
@Override public Collection<Object> values() { return new ImmutableCollectionWrapper<>(super.values()); }
@Override public Iterator<E> reverseIterator() { return new ImmutableIteratorWrapper<E>(((ReversibleOrderedSet<? extends E>) collection).reverseIterator()); } }
private void schedule(Locality oldLocality, Locality newLocality) { SessionMetaDataFactory<InfinispanSessionMetaData<L>, L> metaDataFactory = this.factory.getMetaDataFactory(); // Iterate over sessions in memory try (CloseableIterator<Key<String>> keys = this.cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL, Flag.SKIP_CACHE_LOAD).keySet().iterator()) { while (keys.hasNext()) { if (Thread.currentThread().isInterrupted()) break; Key<String> key = keys.next(); // If we are the new primary owner of this session then schedule expiration of this session locally if (this.filter.test(key) && !oldLocality.isLocal(key) && newLocality.isLocal(key)) { String id = key.getValue(); try (Batch batch = this.batcher.createBatch()) { try { // We need to lookup the session to obtain its meta data InfinispanSessionMetaData<L> value = metaDataFactory.tryValue(id); if (value != null) { this.scheduler.schedule(id, metaDataFactory.createImmutableSessionMetaData(id, value)); } return; } catch (CacheException e) { batch.discard(); } } } } } } }
@Override public Set<Class<? extends TooHighIdClass>> getTypeClasses() { return Util.<Class<? extends TooHighIdClass>>asSet(TooHighIdClass.class); } }
public static String getProperty(String key, String legacyKey, String defaultValue) { String val = SecurityActions.getProperty(key); if (val == null) { val = SecurityActions.getProperty(legacyKey); if (val != null) warnLegacy(legacyKey, key); else val = defaultValue; } return val; } }