Package org.jgroups.blocks

Examples of org.jgroups.blocks.MethodCall


        //Flush my view
        gms.flush(gms.mbrs.getMembers(), null);

        //Install new view
        MethodCall call=new MethodCall("handleViewChange", new Object[]{vid, new_mbrs},
                new String[]{ViewId.class.getName(), Vector.class.getName()});
        gms.callRemoteMethods(gms.mbrs.getMembers(), call, GroupRequest.GET_ALL, 0);
        return new_view;
    }
View Full Code Here


     * @param sender The sender of the gossip message (obviously :-))
     */
    public void gossip(ViewId view_id, long gossip_round,
                       long[] gossip_seqnos, boolean[] heard, Object sender) {
        Object[] params;
        MethodCall call;

        synchronized(this) {

                if(log.isInfoEnabled()) log.info("sender=" + sender + ", round=" + gossip_round + ", seqnos=" +
                        Util.array2String(gossip_seqnos) + ", heard=" +
                        Util.array2String(heard));
            if(vid == null || view_id == null || !vid.equals(view_id)) {

                    if(log.isInfoEnabled()) log.info("view ID s are different (" + vid + " != " + view_id +
                            "). Discarding gossip received");
                return;
            }
            if(gossip_round < this.round) {

                    if(log.isInfoEnabled()) log.info("received a gossip from a previous round (" +
                            gossip_round + "); my round is " + round +
                            ". Discarding gossip");
                return;
            }
            if(gossip_seqnos == null || seqnos == null ||
                    seqnos.length != gossip_seqnos.length) {

                    if(warn) log.warn("size of seqnos and gossip_seqnos are not equal ! " +
                            "Discarding gossip");
                return;
            }

            // (1) If round greater than local round:
            // i. Adjust the local to the received round
            //
            // (2)
            // i. local_seqnos = arrayMin(local_seqnos, gossip_seqnos)
            // ii. local_heard = arrayMax(local_heard, gossip_heard)
            // iii. If heard from all, bcast our seqnos (stability vector)
            if(round == gossip_round) {
                update(sender, gossip_seqnos, heard);
            }
            else if(round < gossip_round) {

                    if(log.isInfoEnabled()) log.info("received a gossip from a higher round (" +
                            gossip_round + "); adopting my round (" + round +
                            ") to " + gossip_round);
                round=gossip_round;
                set(sender, gossip_seqnos, heard_from);
            }

             if(log.isInfoEnabled()) log.info("heard_from=" + Util.array2String(heard_from));
            if(!heardFromAll())
                return;

            params=new Object[]{
                vid.clone(),
                new Long(gossip_round),
                seqnos.clone(),
                local_addr};
        } // synchronized(this)

        call=new MethodCall("stability", params,
            new String[] {ViewId.class.getName(), long.class.getName(), long[].class.getName(), Object.class.getName()});
        callRemoteMethods(null, call, GroupRequest.GET_NONE, 0);
    }
View Full Code Here

     * Send our <code>seqnos</code> array to a subset of the membership
     */
    private void sendGossip() {
        Vector gossip_subset;
        Object[] params;
        MethodCall call;

        synchronized(this) {
            gossip_subset=Util.pickSubset(mbrs, subset);
            if(gossip_subset == null || gossip_subset.size() < 1) {
                 if(warn) log.warn("picked empty subset !");
                return;
            }


                if(log.isInfoEnabled()) log.info("subset=" + gossip_subset + ", round=" + round + ", seqnos=" +
                        Util.array2String(seqnos));

            params=new Object[]{
                vid.clone(),
                new Long(round),
                seqnos.clone(),
                heard_from.clone(),
                local_addr};
        }

        call=new MethodCall("gossip", params,
            new String[] {ViewId.class.getName(), long.class.getName(), long[].class.getName(), boolean[].class.getName(), Object.class.getName()});
        for(int i=0; i < gossip_subset.size(); i++) {
            try {
                callRemoteMethod((Address)gossip_subset.get(i), call, GroupRequest.GET_NONE, 0);
            }
View Full Code Here

        passDown(view_event); // needed e.g. by failure detector or UDP

         if(log.isInfoEnabled()) log.info("mcasting view {" + new_vid + ", " + view_dest + '}');
        passDown(new Event(Event.SWITCH_NAK_ACK))// use ACK scheme for view bcast
        Object[] args=new Object[]{new_vid, new_view.getMembers() /* these are the mbrs in the new view */};
        MethodCall call=new MethodCall("handleViewChange", args, new String[]{ViewId.class.getName(), Vector.class.getName()});
        callRemoteMethods(view_dest, // send to all members in 'view_dest'
                call,
                GroupRequest.GET_ALL, view_change_timeout);
         if(log.isInfoEnabled()) log.info("mcasting view completed");
        passDown(new Event(Event.SWITCH_NAK))// back to normal NAKs ...
View Full Code Here

   @Override
   public <T> ArrayList<T> callMethodOnCluster(String serviceName, String methodName, Object[] args, Class<?>[] types,
         Class<T> returnType, boolean excludeSelf, ResponseFilter filter, long methodTimeout, boolean unordered)
         throws InterruptedException
   {
      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);
      RspFilterAdapter rspFilter = filter == null ? null : new RspFilterAdapter(filter, this.nodeFactory);
      RequestOptions ro = new RequestOptions(Request.GET_ALL, methodTimeout, false, rspFilter);
      if (excludeSelf)
      {
         ro.setExclusionList(this.localJGAddress);
View Full Code Here

   {
      T retVal = null;
      Object handler = this.rpcHandlers.get(serviceName);
      if (handler != null)
      {
         MethodCall call = new MethodCall(methodName, args, types);
         try
         {
            Object result = call.invoke(handler);
            if (returnType != null && void.class != returnType)
            {
               retVal = returnType.cast(result);
               if (remoteResponses != null && (filter == null || filter.isAcceptable(retVal, me)))
               {
View Full Code Here

   public <T> T callMethodOnCoordinatorNode(String serviceName, String methodName,
          Object[] args, Class<?>[] types, Class<T> returnType, boolean excludeSelf, long methodTimeout, boolean unordered) throws Exception
   {
      boolean trace = this.log.isTraceEnabled();

      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);
     
      if( trace )
      {
         this.log.trace("callMethodOnCoordinatorNode(false), objName="+serviceName
            +", methodName="+methodName);
View Full Code Here

         throw new IllegalArgumentException("targetNode " + targetNode + " is not an instance of " +
                                          ClusterNodeImpl.class + " -- only targetNodes provided by this HAPartition should be used");
      }
      boolean trace = this.log.isTraceEnabled();

      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);

      if (trace)
      {
         this.log.trace("callMethodOnNode( objName=" + serviceName + ", methodName=" + methodName);
      }
View Full Code Here

         throw new IllegalArgumentException("targetNode " + targetNode + " is not an instance of " +
                                         ClusterNodeImpl.class + " -- only targetNodes provided by this HAPartition should be used");
      }
      boolean trace = this.log.isTraceEnabled();

      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);

      if (trace)
      {
         this.log.trace("callAsyncMethodOnNode( objName=" + serviceName + ", methodName=" + methodName);
      }
View Full Code Here

    */
   @Override
   public void callAsynchMethodOnCluster(final String serviceName, final String methodName, final Object[] args, final Class<?>[] types,
         boolean excludeSelf, boolean unordered) throws InterruptedException
   {
      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);
      RequestOptions ro = new RequestOptions(Request.GET_NONE, this.getMethodCallTimeout());
      if (excludeSelf)
      {        
         ro.setExclusionList(this.localJGAddress);
      }
View Full Code Here

TOP

Related Classes of org.jgroups.blocks.MethodCall

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.