Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISPN-9008 RpcManager.invokeCommandOnAll ignores cache member missing …
…from cluster view
- Loading branch information
1 parent
4026bfc
commit d1da51d
Showing
14 changed files
with
286 additions
and
58 deletions.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
commons/src/main/java/org/infinispan/commons/util/ImmutableHopscotchHashSet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package org.infinispan.commons.util; | ||
|
||
import java.util.Collection; | ||
import java.util.Iterator; | ||
import java.util.Set; | ||
import java.util.function.Consumer; | ||
import java.util.function.Predicate; | ||
|
||
/** | ||
* Wrap a {@link HopscotchHashMap} and allow using it as a {@link Set}. | ||
* | ||
* @param <E> The element type | ||
* @since 9.3 | ||
* @author Dan Berindei | ||
*/ | ||
public class ImmutableHopscotchHashSet<E> implements Set<E> { | ||
private static final Object PRESENT = new Object(); | ||
|
||
private final HopscotchHashMap<E, Object> map; | ||
|
||
public ImmutableHopscotchHashSet(Collection<E> collection) { | ||
map = new HopscotchHashMap<>(collection.size()); | ||
for (E e : collection) { | ||
map.put(e, PRESENT); | ||
} | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return map.size(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return map.isEmpty(); | ||
} | ||
|
||
@Override | ||
public boolean contains(Object o) { | ||
return map.containsKey(o); | ||
} | ||
|
||
@Override | ||
public Iterator<E> iterator() { | ||
return new Immutables.ImmutableIteratorWrapper<>(map.keySet().iterator()); | ||
} | ||
|
||
@Override | ||
public void forEach(Consumer<? super E> action) { | ||
map.keySet().forEach(action); | ||
} | ||
|
||
@Override | ||
public Object[] toArray() { | ||
return map.keySet().toArray(); | ||
} | ||
|
||
@Override | ||
public <T> T[] toArray(T[] a) { | ||
return map.keySet().toArray(a); | ||
} | ||
|
||
@Override | ||
public boolean add(E e) { | ||
throw new UnsupportedOperationException("add"); | ||
} | ||
|
||
@Override | ||
public boolean remove(Object o) { | ||
throw new UnsupportedOperationException("remove"); | ||
} | ||
|
||
@Override | ||
public boolean containsAll(Collection<?> c) { | ||
return map.keySet().containsAll(c); | ||
} | ||
|
||
@Override | ||
public boolean addAll(Collection<? extends E> c) { | ||
throw new UnsupportedOperationException("addAll"); | ||
} | ||
|
||
@Override | ||
public boolean retainAll(Collection<?> c) { | ||
throw new UnsupportedOperationException("retainAll"); | ||
} | ||
|
||
@Override | ||
public boolean removeAll(Collection<?> c) { | ||
throw new UnsupportedOperationException("removeAll"); | ||
} | ||
|
||
@Override | ||
public boolean removeIf(Predicate<? super E> filter) { | ||
throw new UnsupportedOperationException("removeIf"); | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
throw new UnsupportedOperationException("clear"); | ||
} | ||
|
||
// Use the default implementation of spliterator(), stream(), and parallelStream() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.