Package org.jgroups

Examples of org.jgroups.Address


  private void println(Object obj) {
    System.out.println(obj);
  }
 
  public void receive(Message msg) {
    Address sender = msg.getSrc();
    println("[" + sender + "] " + msg.getObject());
  }
View Full Code Here


    stack.init();
   
    channel.setReceiver(new ReceiverAdapter(){

      public void receive(Message msg) {
        Address sender=msg.getSrc();
        System.out.println(msg.getObject() + " [" + sender + "]");
      }

      public void viewAccepted(View view) {
        System.out.println("view: " + view);
View Full Code Here

    channel.connect("mperf");
    local_addr = channel.getAddress();
        JmxConfigurator.registerChannel(channel, Util.getMBeanServer(), "jgroups", "mperf", true);

        // send a CONFIG_REQ to the current coordinator, so we can get the current config
    Address coord = channel.getView().getMembers().get(0);
        if(coord != null && !local_addr.equals(coord)){
          send(coord,null,MPerfHeader.CONFIG_REQ, Message.Flag.RSVP);
        }
    }
View Full Code Here

      result_collector = msg.getSrc();
      sendMessages();
      break;

            case MPerfHeader.SENDING_DONE:
                Address sender=msg.getSrc();
                Stats tmp=received_msgs.get(sender);
                if(tmp != null)
                    tmp.stop();

                boolean all_done=true;
                List<Address> senders=getSenders();
                for(Map.Entry<Address,Stats> entry: received_msgs.entrySet()) {
                    Address mbr=entry.getKey();
                    Stats result=entry.getValue();
                    if(!senders.contains(mbr))
                        continue;
                    if(!result.isDone()) {
                        all_done=false;
View Full Code Here

  }

  private static final Logger logger = Logger.getLogger(MyRequestHandler.class);

  public Object handle(Message msg) throws Exception {
    Address sender = msg.getSrc();
    logger.info(sender + ", " + msg.getObject());
    return channel.getName() + "-" + msg.getObject();
  }
View Full Code Here

        if(view instanceof MergeView) {
            System.out.println("** MergeView = " + view);

      if (use_state && !members.isEmpty()) {
        Address coord = members.get(0);
        Address local_addr = channel.getAddress();
        if (local_addr != null && !local_addr.equals(coord)) {
          try {
            System.out.println("fetching state from " + coord);
            channel.getState(coord, 5000);
          } catch (Exception e) {
            logger.error(e);
View Full Code Here

    JChannel channel = new JChannel(args[0]);
   
    channel.setReceiver(new ReceiverAdapter(){

      public void receive(Message msg) {
        Address sender=msg.getSrc();
        System.out.println(msg.getObject() + " [" + sender + "]");
      }

      public void viewAccepted(View view) {
        System.out.println("view: " + view);
View Full Code Here

    /**
     Loop: determine coord. If coord is me --> handleLeave(). Else send handleLeave() to coord until
     success.
     */
    public void leave(Address mbr) {
        Address coord;

        if(mbr.equals(gms.local_addr))
            leaving=true;

        while((coord=gms.determineCoordinator()) != null && !received_final_view) {
View Full Code Here

    public void sendGetMembersRequest() {
        Message msg, copy;
        PingHeader hdr;
        List tmp_mbrs;
        Address mbr_addr;

        if(group_addr == null) {
            if(log.isErrorEnabled()) log.error("[FIND_INITIAL_MBRS]: group_addr is null, cannot get mbrship");
            passUp(new Event(Event.FIND_INITIAL_MBRS_OK, EMPTY_VECTOR));
            return;
View Full Code Here

     * <code>rsp_mutex</code> lock.
     * @param mbrs The new list of members
     */
    public final void reset(Vector mbrs) {
        if(mbrs != null) {
            Address mbr;
            synchronized(requests) {
                requests.clear();
                for(int i=0; i < mbrs.size(); i++) {
                    mbr=(Address)mbrs.elementAt(i);
                    requests.put(mbr, new Rsp(mbr));
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.