Package org.jgroups

Examples of org.jgroups.Event


    public void init() throws Exception {
        local_addr=new org.jgroups.stack.IpAddress("localhost", 10000); // fake address
    }

    public void start() throws Exception {
        passUp(new Event(Event.SET_LOCAL_ADDRESS, local_addr));
    }
View Full Code Here


                if(log.isInfoEnabled()) log.info("all done (num_msgs=" + num_msgs + ", expected_msgs=" + expected_msgs);
            }
            break;

        case Event.CONNECT:
            passUp(new Event(Event.CONNECT_OK));
            return;

        case Event.DISCONNECT:
            passUp(new Event(Event.DISCONNECT_OK));
            return;
        }

        if(down_prot != null)
            passDown(evt);
View Full Code Here

      map.put("protocol_class", getClass().getName());
   }

   public void start() throws Exception
   {
      passUp(new Event(Event.CONFIG, map));
      if(!flushProtocolInStack && use_flush)
      {
         log.warn("use_flush is true, however, FLUSH protocol not found in stack.");
         use_flush = false;
      }
View Full Code Here

            }
            if (target == null)
            {
               if (log.isDebugEnabled())
                  log.debug("GET_STATE: first member (no state)");
               passUp(new Event(Event.GET_STATE_OK, new StateTransferInfo()));
            }
            else
            {
               boolean successfulFlush = false;
               if(use_flush) {
                  successfulFlush = startFlush(flush_timeout, 5);
               }
               if (successfulFlush)
               {
                  log.debug("Successful flush at " + local_addr);
               }
               Message state_req = new Message(target, null, null);
               state_req.putHeader(NAME, new StateHeader(StateHeader.STATE_REQ, local_addr, info.state_id));
               String stateRequested = info.state_id==null?"full":info.state_id;
               if (log.isDebugEnabled())
                  log.debug("Member " + local_addr + " asking " + target + " for " + stateRequested + " state");

               // suspend sending and handling of mesage garbage collection gossip messages,
               // fixes bugs #943480 and #938584). Wake up when state has been received
               if (log.isTraceEnabled())
                  log.trace("passing down a SUSPEND_STABLE event");
               passDown(new Event(Event.SUSPEND_STABLE, new Long(info.timeout)));               
               passDown(new Event(Event.MSG, state_req));
            }
            return; // don't pass down any further !

         case Event.STATE_TRANSFER_INPUTSTREAM_CLOSED :
            if (use_flush)
            {
               stopFlush();
            }

            if (log.isTraceEnabled())
               log.trace("STATE_TRANSFER_INPUTSTREAM_CLOSED received");
            //resume sending and handling of message garbage collection gossip messages,
            // fixes bugs #943480 and #938584). Wakes up a previously suspended message garbage
            // collection protocol (e.g. STABLE)
            if (log.isTraceEnabled())
               log.trace("passing down a RESUME_STABLE event");
            passDown(new Event(Event.RESUME_STABLE));
            return;
         case Event.SUSPEND_OK :
            if (use_flush)
            {
               flush_promise.setResult(Boolean.TRUE);
View Full Code Here

               state_rsp.putHeader(NAME, hdr);

               if (log.isTraceEnabled())
                  log.trace("Responding to state requester " + requester + " with address "
                        + spawner.getServerSocketAddress() + " and digest " + digest);
               passDown(new Event(Event.MSG, state_rsp));
               if (stats)
               {
                  num_state_reqs++;
               }
            }
View Full Code Here

   private boolean startFlush(long timeout, int numberOfAttempts)
   {
      boolean successfulFlush = false;
      flush_promise.reset();
      passUp(new Event(Event.SUSPEND));
      try
      {        
         Boolean r = (Boolean) flush_promise.getResultWithTimeout(timeout);
         successfulFlush = r.booleanValue();
      }
View Full Code Here

      return successfulFlush;
   }

   private void stopFlush()
   {
      passUp(new Event(Event.RESUME));
   }
View Full Code Here

         else if (empty)
         {
            digest = null;
            if (log.isTraceEnabled())
               log.trace("passing down GET_DIGEST_STATE");
            passDown(new Event(Event.GET_DIGEST_STATE));
         }
      }
   }
View Full Code Here

               log.warn("digest received from " + hdr.sender + " is null, skipping setting digest !");
         }
         else
         {
            // set the digest (e.g.in NAKACK)
            passDown(new Event(Event.SET_DIGEST, tmp_digest));
         }
      }     
      connectToStateProvider(hdr);
   }
View Full Code Here

            //since socket did not connect properly we have to
            //clear our entry in state providers hashmap "manually"
            Message m = new Message(hdr.sender);
            StateHeader mhdr = new StateHeader(StateHeader.STATE_REMOVE_REQUESTER, local_addr, tmp_state_id);
            m.putHeader(NAME, mhdr);
            passDown(new Event(Event.MSG, m));
         }
         passStreamUp(sti);
      }
   }
View Full Code Here

TOP

Related Classes of org.jgroups.Event

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.