Permalink
Browse files

We can only change the status to DOWN from UNKNOWN (not from DOWN or UP)

  • Loading branch information...
1 parent 514ca00 commit 1866c8cd9f7e295f0f728e50a9bce0d6311f8878 Bela Ban committed Nov 26, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/org/jgroups/protocols/relay/Relayer.java
@@ -340,10 +340,10 @@ public void run() {
protected void changeStatusToDown(short id) {
Route route=routes[id];
- if(route.status() == RELAY2.RouteStatus.UP)
+ if(route.status() == RELAY2.RouteStatus.UNKNOWN)
route.status(RELAY2.RouteStatus.DOWN); // SITE-UNREACHABLE responses are sent in this state
else {
- log.warn(relay.getLocalAddress() + ": didn't change status of " + id + " to DOWN as it is UP");
+ log.warn(relay.getLocalAddress() + ": didn't change status of " + SiteUUID.getSiteName(id) + " to DOWN as it is UP");
return;
}
BlockingQueue<Message> msgs=fwd_queue.remove(id);
@@ -374,11 +374,13 @@ protected void changeStatusToUp(final short id, JChannel bridge, Address site_ma
case UNKNOWN:
case DOWN: // queue should be empty, but anyway...
cancelTask(id);
- relay.getTimer().execute(new Runnable() {
- public void run() {
- flushQueue(id, route);
- }
- });
+ if(old_status == RELAY2.RouteStatus.UNKNOWN) {
+ relay.getTimer().execute(new Runnable() {
+ public void run() {
+ flushQueue(id, route);
+ }
+ });
+ }
break;
}
}
@@ -398,7 +400,6 @@ protected void flushQueue(short id, Route route) {
JChannel bridge=route.bridge();
if(log.isTraceEnabled())
log.trace(relay.getLocalAddress() + ": forwarding " + msgs.size() + " queued messages");
- System.out.println(relay.getLocalAddress() + ": forwarding " + msgs.size() + " queued messages");
while((msg=msgs.poll()) != null && route.status() == RELAY2.RouteStatus.UP) {
try {
msg.setDest(route.siteMaster()); // the message in the queue is already a copy !

0 comments on commit 1866c8c

Please sign in to comment.