Package com.linkedin.databus.client.pub

Examples of com.linkedin.databus.client.pub.DatabusClientGroupMember


            2000,
            5000,
            namespace,
            groupname,
            memberName,false,sharedDir));
        DatabusClientGroupMember member = clusterNode.getMember(namespace,groupname,memberName);
        if (member == null  || !member.joinWithoutLeadershipDuties()) 
        {
          System.err.println("Initialization failed for: " +  member);
          System.exit(1);
        }
       
        if (function.equals("members")) {
          List<String> mlist = member.getMembers();
          for (String m: mlist) {
            System.out.println(m);
          }

        } else if (function.equals("leader")) {
          String leader = member.getLeader();
          System.out.println(leader);

        } else if (function.equals("keys")) {
          List<String> keyList = member.getSharedKeys();
          if (keyList != null) {
            for (String m: keyList) {
              System.out.println(m);
            }
          }
        } else if (function.equals("readSCN")) {
          List<String> keyList ;
          if (arg1 == null)
          {
            keyList = member.getSharedKeys();
          } else {
            keyList = new ArrayList<String>();
            keyList.add(arg1);
          }
          if (keyList != null)
          {
            for (String k: keyList)
            {
              if (!k.equals(DatabusClientDSCUpdater.DSCKEY))
              {
                Checkpoint cp = (Checkpoint) member.readSharedData(k);
                if (cp != null)
                {
                  System.out.println(k + " " + cp.getWindowScn() + " "+cp.getWindowOffset());
                }
                else
                {
                  System.err.println(k + " null null");
                }
              }
            }
          }
           
        } else if (function.equals("writeSCN")) {
          if (arg1 != null && arg2 != null)
          {
            Checkpoint cp = new Checkpoint();
            cp.setConsumptionMode(DbusClientMode.ONLINE_CONSUMPTION);
            cp.setWindowScn(Long.parseLong(arg2));
            if (fns.length > 3)
            {
              cp.setWindowOffset(Integer.parseInt(fns[3]));
            } else {
              cp.setWindowOffset(-1);
            }
            if (member.writeSharedData(arg1, cp))
            {
              System.out.println(arg1 + " " + cp.getWindowScn() + " " + cp.getWindowOffset());
            }
            else
            {
              System.err.println("Write failed! " + member +  " couldn't write key=" + arg1);
              System.exit(1);
            }
          }
          else
         
            usage();
            System.exit(1);
          }
        } else if (function.equals("readLastTs")) {
          Long timeInMs = (Long) member.readSharedData(DatabusClientDSCUpdater.DSCKEY);
          if (timeInMs != null)
                  {
                    System.out.println(DatabusClientDSCUpdater.DSCKEY + " " + timeInMs.longValue());
                  }
                  else
                  {
                    System.err.println(DatabusClientDSCUpdater.DSCKEY + " null");
                  }
        } else if (function.equals("writeLastTs")) {
          if (arg1 != null)
          {
            Long ts = Long.parseLong(arg1);
            if (member.writeSharedData(DatabusClientDSCUpdater.DSCKEY, ts))
                    {
                        System.out.println(DatabusClientDSCUpdater.DSCKEY + " " + ts);
                    }
                    else
                    {
                        System.err.println("Write failed! " + member +  " couldn't write key=" + DatabusClientDSCUpdater.DSCKEY);
                        System.exit(1);
                    }
           
          }
          else
          {
            usage();
            System.exit(1);
          }
        } else if (function.equals("remove")) {
          if (!member.removeSharedData(arg1))   
          {
            System.err.println("Remove failed! " + arg1);
            System.exit(1);
          }
        } else if (function.equals("create")) {
          if (!member.createPaths())
          {
            System.err.println("Create path failed!" );
            System.exit(1);
          }
         
View Full Code Here


  /**
   *
   */
  protected boolean waitForLeadership()
  {
    DatabusClientGroupMember member = _groupMember;
    if (member != null)
    {
      if (member.join())
      {
        LOG.info("Waiting for leadership: " + member.toString());
      //lauch dscUpdater thread
        if (_dscUpdater != null)
        {
          Thread t = new Thread(_dscUpdater, "DscUpdater");
          t.setDaemon(true);
          t.start();
        }
        boolean acquiredLeadership = member.waitForLeaderShip();
        LOG.info("Acquired leadership=  " + acquiredLeadership + " member=" +  member.toString());
        return acquiredLeadership;
      }
    }
    LOG.info("Started Failed! Non availability of group/cluster handler! http relay connection for sources:" + getRelayGroupStreamConsumers());
    return false;
View Full Code Here

TOP

Related Classes of com.linkedin.databus.client.pub.DatabusClientGroupMember

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.