Skip to content

Commit

Permalink
ISPN-658 - Clarified the recovery process a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Berindei authored and galderz committed Oct 18, 2011
1 parent 81ca8d9 commit 24bc165
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 78 deletions.
27 changes: 24 additions & 3 deletions core/src/main/java/org/infinispan/cacheviews/CacheView.java
Expand Up @@ -23,11 +23,13 @@
import org.infinispan.marshall.AbstractExternalizer;
import org.infinispan.marshall.Ids;
import org.infinispan.remoting.transport.Address;
import org.infinispan.util.Immutables;
import org.infinispan.util.Util;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
Expand All @@ -39,12 +41,14 @@
public class CacheView {
public static final CacheView EMPTY_CACHE_VIEW = new CacheView(-1, Collections.<Address>emptyList());

private int viewId;
private List<Address> members;
private final int viewId;
private final List<Address> members;

public CacheView(int viewId, List<Address> members) {
if (members == null)
throw new IllegalArgumentException("Member list cannot be null");
this.viewId = viewId;
this.members = members;
this.members = Immutables.immutableListCopy(members);
}

public int getViewId() {
Expand All @@ -55,6 +59,23 @@ public List<Address> getMembers() {
return members;
}

public boolean isEmpty() {
return members.isEmpty();
}

public boolean contains(Address node) {
return members.contains(node);
}

public boolean containsAny(Collection<Address> nodes) {
for (Address node : nodes) {
if (members.contains(node))
return true;
}

return false;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down

0 comments on commit 24bc165

Please sign in to comment.