Package org.jgroups

Examples of org.jgroups.Address


     * never received the request in the first place, therefore won't send a
     * response.
     * </ul>
     */
    public void viewChange(View new_view) {
        Address mbr;
        Vector mbrs=new_view != null? new_view.getMembers() : null;
        if(requests == null || requests.size() == 0 || mbrs == null)
            return;

        synchronized(this.members) {
View Full Code Here


     * then removes the Message from the send queue, performs a conversion and adds the
     * modified Message to the send queue of the layer below it, by calling Down).
     */
    public void down(Event evt) {
        Message msg;
        Address dest_addr;


        switch(evt.getType()) {

        case Event.MSG:
View Full Code Here

        ret.append("req_id=").append(req_id).append('\n');
        if(caller != null)
            ret.append("caller=").append(caller).append("\n");

        Map.Entry entry;
        Address mbr;
        Rsp rsp;
        synchronized(requests) {
            for(Iterator it=requests.entrySet().iterator(); it.hasNext();) {
                entry=(Map.Entry)it.next();
                mbr=(Address)entry.getKey();
View Full Code Here

    }


    public void up(Event evt) {
        Message msg;
        Address dest_addr;
        switch(evt.getType()) {

        case Event.MSG:
            if(done) {
                if(warn) log.warn("all done (discarding msg)");
View Full Code Here


    /** This method runs with rsp_mutex locked (called by <code>execute()</code>). */
    private boolean doExecute(boolean use_anycasting, long timeout) throws Exception {
        long start_time=0;
        Address suspect;
        req_id=getRequestId();
        reset(null); // clear 'responses' array

        synchronized(requests) {
            for(int i=0; i < suspects.size(); i++) {  // mark all suspects in 'received' array
                suspect=(Address)suspects.elementAt(i);
                Rsp rsp=(Rsp)requests.get(suspect);
                if(rsp != null) {
                    rsp.setSuspected(true);
                    break; // we can break here because we ensure there are no duplicate members
                }
            }
        }

        try {
            if(log.isTraceEnabled()) log.trace(new StringBuffer("sending request (id=").append(req_id).append(')'));
            if(corr != null) {
                java.util.List tmp=new Vector(members);
                corr.sendRequest(req_id, tmp, request_msg, rsp_mode == GET_NONE? null : this, use_anycasting);
            }
            else {
                if(use_anycasting) {
                    List tmp=new ArrayList(members);
                    Message copy;
                    Address mbr;
                    for(Iterator it=tmp.iterator(); it.hasNext();) {
                        mbr=(Address)it.next();
                        copy=request_msg.copy(true);
                        copy.setDest(mbr);
                        transport.send(copy);
View Full Code Here

    private void adjustMembership() {
        if(requests.size() == 0)
            return;

        Map.Entry entry;
        Address mbr;
        Rsp rsp;
        for(Iterator it=requests.entrySet().iterator(); it.hasNext();) {
            entry=(Map.Entry)it.next();
            mbr=(Address)entry.getKey();
            if((!this.members.contains(mbr)) || suspects.contains(mbr)) {
View Full Code Here

           if(log.isErrorEnabled()) log.error("receiver is null (not set) !");
   }

   public String toString() {
       StringBuffer ret=new StringBuffer();
       Address key;
       Connection val;
       Map.Entry entry;
       HashMap copy;

       synchronized(conns) {
View Full Code Here

      passUp(evt);
   }

   public void down(Event evt)
   {
      Address target;
      StateTransferInfo info;

      switch (evt.getType())
      {

         case Event.TMP_VIEW :
         case Event.VIEW_CHANGE :
            handleViewChange((View) evt.getArg());
            break;

         case Event.GET_STATE :
            info = (StateTransferInfo) evt.getArg();
            if (info.target == null)
            {
               target = determineCoordinator();
            }
            else
            {
               target = info.target;
               if (target.equals(local_addr))
               {
                  if (log.isErrorEnabled())
                     log.error("GET_STATE: cannot fetch state from myself !");
                  target = null;
               }
View Full Code Here

         {
            String tmp_state_id = (String) it.next();
            Set requesters = (Set) state_requesters.get(tmp_state_id);
            for (Iterator iter = requesters.iterator(); iter.hasNext();)
            {
               Address requester = (Address) iter.next();
               Message state_rsp = new Message(requester);
               StateHeader hdr = new StateHeader(StateHeader.STATE_RSP, local_addr, spawner.getServerSocketAddress(),
                                     isDigestNeeded()?digest:null, tmp_state_id);
               state_rsp.putHeader(NAME, hdr);
View Full Code Here

      return threadPool;
   }

   private Address determineCoordinator()
   {
      Address ret = null;
      synchronized (members)
      {
         if (!members.isEmpty())
         {
            for (int i = 0; i < members.size(); i++)
View Full Code Here

TOP

Related Classes of org.jgroups.Address

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.