Examples of MasterContext


Examples of com.pcmsolutions.device.EMU.E4.master.MasterContext

        super(dev);
        this.ids = new Integer[ids.length];
        this.vals = new Integer[ids.length];
        //this.valStrings = new String[ids.length];
        this.category = category;
        MasterContext mc = dev.getMasterContext();
        DeviceParameterContext dpc = dev.getDeviceParameterContext();
        this.ids = (Integer[]) ids.clone();
        vals = mc.getMasterParams(ids);

        /*for (int i = 0, n = ids.length; i < n; i++) {
            try {
                valStrings[i] = deviceParameterContext.getMasterContext().getParameterDescriptor(ids[i]).getStringForValue(vals[i]);
            } catch (ParameterValueOutOfRangeException e) {
View Full Code Here

Examples of com.pcmsolutions.device.EMU.E4.master.MasterContext

        checkPopup(e);
    }

    public boolean checkPopup(MouseEvent e) {
        if (e.isPopupTrigger()) {
            MasterContext mc;
            try {
                mc = device.getMasterContext();
            } catch (ZDeviceNotRunningException e1) {
                return false;
            }
View Full Code Here

Examples of com.taobao.zeus.socket.master.MasterContext

 
  public void startup(int port){
    if(!running.compareAndSet(false, true)){
      return;
    }
    context=new MasterContext(applicationContext);
    context.init(port);
  }
View Full Code Here

Examples of com.taobao.zeus.socket.master.MasterContext

        zeusScheduleField.setAccessible(true);
        ZeusSchedule zeusSchedule=(ZeusSchedule) zeusScheduleField.get(locker);
        if(zeusSchedule!=null){
          Field masterContextField=zeusSchedule.getClass().getDeclaredField("context");
          masterContextField.setAccessible(true);
          MasterContext context=(MasterContext)masterContextField.get(zeusSchedule);
          if(context!=null){
            String op=req.getParameter("op");
            if("workers".equals(op)){
              Map<Channel, MasterWorkerHolder> workers=context.getWorkers();
              SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
              for(Channel channel:workers.keySet()){
                MasterWorkerHolder holder=workers.get(channel);
                Set<String> runnings=holder.getRunnings().keySet();
                Set<String> manualRunnings=holder.getManualRunnings().keySet();
                Set<String> debugRunnings=holder.getDebugRunnings().keySet();
                HeartBeatInfo heart=holder.getHeart();
                resp.getWriter().println(channel.getRemoteAddress()+":");
                resp.getWriter().println("\t runnings:"+runnings.toString());
                resp.getWriter().println("\t manual runnings:"+manualRunnings.toString());
                resp.getWriter().println("\t debug runnings:"+debugRunnings.toString());
                resp.getWriter().println("\t heart beat: ");
                resp.getWriter().println("\t\t last heartbeat:"+ format.format(heart.timestamp));
                resp.getWriter().println("\t\t mem use rate:"+heart.memRate);
                resp.getWriter().println("\t\t runnings:"+heart.runnings.toString());
                resp.getWriter().println("\t\t manual runnings:"+heart.manualRunnings.toString());
                resp.getWriter().println("\t\t debug runnings:"+heart.debugRunnings.toString());
              }
            }else if("queue".equals(op)){
              Queue<String> queue=context.getQueue();
              Queue<String> debugQueue=context.getDebugQueue();
              Queue<String> manualQueue=context.getManualQueue();
              resp.getWriter().println("schedule jobs in queue:");
              for(String jobId:queue){
                resp.getWriter().print(jobId+"\t");
              }
              resp.getWriter().println("manual jobs in queue:");
              for(String jobId:manualQueue){
                resp.getWriter().print(jobId+"\t");
              }
              resp.getWriter().println("debug jobs in queue");
              for(String jobId:debugQueue){
                resp.getWriter().print(jobId+"\t");
              }
            }else if("jobstatus".equals(op)){
              Dispatcher dispatcher=context.getDispatcher();
              if(dispatcher!=null){
                for(Controller c:dispatcher.getControllers()){
                  resp.getWriter().println(c.toString());
                }
              }
View Full Code Here

Examples of net.sf.katta.master.MasterContext

    LoadTestMasterOperation operation = new LoadTestMasterOperation(nodeCount, 10, 20, 2, 20000, _queryExecutor,
            _temporaryFolder.newFolder("result"));
    operation.execute(_context, Collections.EMPTY_LIST);

    _master = Mocks.mockMaster();
    _context = new MasterContext(_protocol, _master, new DefaultDistributionPolicy(), _queue);
    operation.execute(_context, Collections.EMPTY_LIST);
  }
View Full Code Here

Examples of net.sf.katta.master.MasterContext

    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    assertEquals(0, nodeQueue3.size());
    BalanceIndexOperation balanceOperation = new BalanceIndexOperation(_indexName);
    FileSystem fileSystem = mock(FileSystem.class);
    when(fileSystem.exists(any(Path.class))).thenReturn(false);
    MasterContext spiedContext = spy(_context);
    doReturn(fileSystem).when(spiedContext).getFileSystem(any(IndexMetaData.class));
    List<OperationId> nodeOperations = balanceOperation.execute(spiedContext, EMPTY_LIST);
    assertEquals(null, nodeOperations);
  }
View Full Code Here

Examples of net.sf.katta.master.MasterContext

    // add node and then balance again
    Node node3 = Mocks.mockNode();
    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    assertEquals(0, nodeQueue3.size());
    BalanceIndexOperation balanceOperation = new BalanceIndexOperation(_indexName);
    MasterContext spiedContext = spy(_context);
    doThrow(new RuntimeException("test-exception")).when(spiedContext).getFileSystem(any(IndexMetaData.class));
    List<OperationId> nodeOperations = balanceOperation.execute(spiedContext, EMPTY_LIST);
    assertEquals(null, nodeOperations);
  }
View Full Code Here

Examples of net.sf.katta.master.MasterContext

  public void testMockRemove() throws Exception {
    String nodeName = "nodeA";
    String someOldShard = AbstractIndexOperation.createShardName("someOldIndex", "someOldShard");
    InteractionProtocol protocol = mock(InteractionProtocol.class);
    MasterQueue queue = mock(MasterQueue.class);
    MasterContext context = new MasterContext(protocol, Mocks.mockMaster(), new DefaultDistributionPolicy(), queue);
    when(protocol.getNodeShards(nodeName)).thenReturn(Arrays.asList(someOldShard));

    RemoveObsoleteShardsOperation operation = new RemoveObsoleteShardsOperation(nodeName);
    operation.execute(context, EMPTY_LIST);
View Full Code Here

Examples of net.sf.katta.master.MasterContext

    String nodeName = "nodeA";
    String indexName = "someOldIndex";
    String someOldShard = AbstractIndexOperation.createShardName(indexName, "someOldShard");
    InteractionProtocol protocol = mock(InteractionProtocol.class);
    MasterQueue queue = mock(MasterQueue.class);
    MasterContext context = new MasterContext(protocol, Mocks.mockMaster(), new DefaultDistributionPolicy(), queue);
    when(protocol.getNodeShards(nodeName)).thenReturn(Arrays.asList(someOldShard));

    RemoveObsoleteShardsOperation operation = new RemoveObsoleteShardsOperation(nodeName);
    operation.execute(context, new ArrayList<MasterOperation>(Arrays.asList(new IndexDeployOperation(indexName, "path",
            1))));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.