Package javax.management

Examples of javax.management.StringValueExp


        if (includeProcessors) {
            MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
            if (server != null) {
                // get all the processor mbeans and sort them accordingly to their index
                ObjectName query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=processors,*");
                QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp(getRouteId()));
                Set<ObjectName> names = server.queryNames(query, queryExp);
                for (ObjectName name : names) {
                    server.invoke(name, "reset", null, null);
                }
            }
View Full Code Here


            MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
            if (server != null) {
                // get all the processor mbeans and sort them accordingly to their index
                String prefix = getContext().getManagementStrategy().getManagementAgent().getIncludeHostName() ? "*/" : "";
                ObjectName query = ObjectName.getInstance("org.apache.camel:context=" + prefix + getContext().getManagementName() + ",type=processors,*");
                QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp(getRouteId()));
                Set<ObjectName> names = server.queryNames(query, queryExp);
                for (ObjectName name : names) {
                    server.invoke(name, "reset", null, null);
                }
            }
View Full Code Here

    controller.stopAndWait();
  }

  private boolean expireAppMasterZKSession(TwillController controller, long timeout, TimeUnit timeoutUnit) {
    MBeanServer mbeanServer = MBeanRegistry.getInstance().getPlatformMBeanServer();
    QueryExp query = Query.isInstanceOf(new StringValueExp(ConnectionMXBean.class.getName()));

    Stopwatch stopwatch = new Stopwatch();

    do {
      // Find the AM session and expire it
View Full Code Here

      return new ServiceNotFoundException("ServiceNotFoundException");
   }

   public StringValueExp createStringValueExp()
   {
      return new StringValueExp("StringValueExp");
   }
View Full Code Here

      assertTrue(!operation.apply(null));
   }

   public void testStrings() throws Exception
   {
      StringValueExp value1 = new StringValueExp("a");
      StringValueExp value2 = new StringValueExp("a");
      QueryExp operation = Query.eq(value1, value2);
      assertTrue(operation.apply(null));
      operation = Query.geq(value1, value2);
      assertTrue(operation.apply(null));
      operation = Query.gt(value1, value2);
      assertTrue(!operation.apply(null));
      operation = Query.leq(value1, value2);
      assertTrue(operation.apply(null));
      operation = Query.lt(value1, value2);
      assertTrue(!operation.apply(null));

      value1 = new StringValueExp("a");
      value2 = new StringValueExp("b");

      operation = Query.geq(value1, value2);
      assertTrue(!operation.apply(null));
      operation = Query.geq(value2, value1);
      assertTrue(operation.apply(null));
View Full Code Here

      compareOperationsException(o1, o2);
   }

   public void compareStringValueExp(Object o1, Object o2)
   {
      StringValueExp s1 = (StringValueExp)o1;
      StringValueExp s2 = (StringValueExp)o2;
      if (!s1.getValue().equals(s2.getValue())) throw new RuntimeException();
   }
View Full Code Here

        }

        // get the stats for the route
        MBeanServer mbeanServer = getMBeanServer();

        QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("first"));
        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        ObjectName on = set.iterator().next();

        // send in 5 messages
        template.sendBody("direct:start", "A");
        template.sendBody("direct:start", "B");
        template.sendBody("direct:start", "C");
        template.sendBody("direct:start", "D");
        template.sendBody("direct:start", "E");

        // and 1 for the 2nd route
        template.sendBody("direct:baz", "F");

        assertMockEndpointsSatisfied();

        // should be 5 on the route
        Long completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(5, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(5, completed.longValue());
        }

        // reset which should reset all routes also
        ObjectName ctx = ObjectName.getInstance("org.apache.camel:context=camel-1,type=context,name=\"camel-1\"");
        mbeanServer.invoke(ctx, "reset", new Object[]{true}, new String[]{"boolean"});

        // should be 0 on the route
        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(0, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(0, completed.longValue());
        }

        // test that the 2nd route is also reset
        queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("second"));
        set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        on = set.iterator().next();

        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
View Full Code Here

        }

        // get the stats for the route
        MBeanServer mbeanServer = getMBeanServer();

        QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("first"));
        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        ObjectName on = set.iterator().next();

        // send in 5 messages
        template.sendBody("direct:start", "A");
        template.sendBody("direct:start", "B");
        template.sendBody("direct:start", "C");
        template.sendBody("direct:start", "D");
        template.sendBody("direct:start", "E");

        // and 1 for the 2nd route
        template.sendBody("direct:baz", "F");

        assertMockEndpointsSatisfied();
       
        // should be 5 on the route
        Long completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(5, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(5, completed.longValue());
        }

        // reset which should reset all processors also
        mbeanServer.invoke(on, "reset", new Object[]{true}, new String[]{"boolean"});

        // should be 0 on the route
        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
        assertEquals(0, completed.longValue());

        // and on the processors as well
        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), queryExp);
        assertEquals(3, set.size());
        for (ObjectName name : set) {
            completed = (Long) mbeanServer.getAttribute(name, "ExchangesCompleted");
            assertEquals(0, completed.longValue());
        }

        // test that the 2nd route is untouched, as we only reset the first route
        queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp("second"));
        set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), queryExp);
        assertEquals(1, set.size());
        on = set.iterator().next();

        completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
View Full Code Here

        if (includeProcessors) {
            MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
            if (server != null) {
                // get all the processor mbeans and sort them accordingly to their index
                ObjectName query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=processors,*");
                QueryExp queryExp = Query.match(new AttributeValueExp("RouteId"), new StringValueExp(getRouteId()));
                Set<ObjectName> names = server.queryNames(query, queryExp);
                for (ObjectName name : names) {
                    server.invoke(name, "reset", null, null);
                }
            }
View Full Code Here

    controller.stopAndWait();
  }

  private boolean expireAppMasterZKSession(TwillController controller, long timeout, TimeUnit timeoutUnit) {
    MBeanServer mbeanServer = MBeanRegistry.getInstance().getPlatformMBeanServer();
    QueryExp query = Query.isInstanceOf(new StringValueExp(ConnectionMXBean.class.getName()));

    Stopwatch stopwatch = new Stopwatch();

    do {
      // Find the AM session and expire it
View Full Code Here

TOP

Related Classes of javax.management.StringValueExp

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.