use of org.jgroups.protocols.relay.SiteAddress in project JGroups by belaban.
the class UnicastRequest method viewChange.
/**
* If the target address is not a member of the new view, we'll mark the response as suspected and unblock
* the caller of execute()
*/
public void viewChange(View view) {
if (view == null)
return;
// SiteAddresses are not checked as they might be in a different cluster
if (!(target instanceof SiteAddress) && !view.containsMember(target) && !isDone()) {
completeExceptionally(new SuspectedException(target));
corrDone();
}
}
use of org.jgroups.protocols.relay.SiteAddress in project JGroups by belaban.
the class UnicastRequest method siteUnreachable.
public void siteUnreachable(String site) {
if (!(target instanceof SiteAddress) || !((SiteAddress) target).getSite().equals(site) || isDone())
return;
completeExceptionally(new UnreachableException(target));
corrDone();
}
use of org.jgroups.protocols.relay.SiteAddress in project JGroups by belaban.
the class GroupRequest method viewChange.
/**
* Any member of 'membership' that is not in the new view is flagged as SUSPECTED. Any member in the new view that
* is <em>not</em> in the membership (ie, the set of responses expected for the current RPC) will <em>not</em> be
* added to it. If we did this we might run into the following problem:
* <ul>
* <li>Membership is {A,B}
* <li>A sends a synchronous group RPC (which sleeps for 60 secs in the invocation handler)
* <li>C joins while A waits for responses from A and B
* <li>If this would generate a new view {A,B,C} and if this expanded the response set to {A,B,C}, A would wait
* forever on C's response because C never received the request in the first place, therefore won't send a response.
* </ul>
*/
public void viewChange(View view, boolean handle_previous_subgroups) {
if (view == null || rsps == null || rsps.isEmpty())
return;
boolean changed = false;
lock.lock();
try {
if (view instanceof MergeView && handle_previous_subgroups) {
// unless that rsp has already been received (https://issues.redhat.com/browse/JGRP-2575)
for (View v : ((MergeView) view).getSubgroups()) {
if (!v.containsMember(corr.local_addr)) {
for (Address mbr : v.getMembersRaw()) if (setSuspected(mbr))
changed = true;
}
}
}
for (Map.Entry<Address, Rsp<T>> entry : rsps.entrySet()) {
Address mbr = entry.getKey();
// SiteAddresses are not checked as they might be in a different cluster
if (!(mbr instanceof SiteAddress) && !view.containsMember(mbr)) {
Rsp<T> rsp = entry.getValue();
if (rsp.setSuspected()) {
if (!(rsp.wasReceived() || rsp.wasUnreachable()))
num_received++;
changed = true;
}
}
}
if (changed && responsesComplete()) {
complete(this.rsps);
corrDone();
}
} finally {
lock.unlock();
}
}
use of org.jgroups.protocols.relay.SiteAddress in project JGroups by belaban.
the class GroupRequest method viewChange.
/**
* Any member of 'membership' that is not in the new view is flagged as
* SUSPECTED. Any member in the new view that is <em>not</em> in the
* membership (ie, the set of responses expected for the current RPC) will
* <em>not</em> be added to it. If we did this we might run into the
* following problem:
* <ul>
* <li>Membership is {A,B}
* <li>A sends a synchronous group RPC (which sleeps for 60 secs in the
* invocation handler)
* <li>C joins while A waits for responses from A and B
* <li>If this would generate a new view {A,B,C} and if this expanded the
* response set to {A,B,C}, A would wait forever on C's response because C
* never received the request in the first place, therefore won't send a
* response.
* </ul>
*/
public void viewChange(View view) {
if (view == null || rsps == null || rsps.isEmpty())
return;
boolean changed = false;
lock.lock();
try {
for (Map.Entry<Address, Rsp<T>> entry : rsps.entrySet()) {
Address mbr = entry.getKey();
// SiteAddresses are not checked as they might be in a different cluster
if (!(mbr instanceof SiteAddress) && !view.containsMember(mbr)) {
Rsp<T> rsp = entry.getValue();
if (rsp.setSuspected()) {
if (!(rsp.wasReceived() || rsp.wasUnreachable()))
num_received++;
changed = true;
}
}
}
if (changed && responsesComplete()) {
complete(this.rsps);
corrDone();
}
} finally {
lock.unlock();
}
}
use of org.jgroups.protocols.relay.SiteAddress in project JGroups by belaban.
the class GroupRequest method siteUnreachable.
public void siteUnreachable(String site) {
lock.lock();
try {
for (Map.Entry<Address, Rsp<T>> entry : rsps.entrySet()) {
Address member = entry.getKey();
if (!(member instanceof SiteAddress))
continue;
SiteAddress addr = (SiteAddress) member;
if (addr.getSite().equals(site)) {
Rsp<T> rsp = entry.getValue();
if (rsp != null && rsp.setUnreachable()) {
lock.lock();
try {
if (!(rsp.wasReceived() || rsp.wasSuspected()))
num_received++;
} finally {
lock.unlock();
}
}
}
}
if (responsesComplete()) {
complete(this.rsps);
corrDone();
}
} finally {
lock.unlock();
}
}
Aggregations