Package javax.management.timer

Examples of javax.management.timer.TimerMBean


      // FIXME: unschedule on unregistration/descriptor field change

      try
      {
         ObjectName timerName = new ObjectName(PERSISTENCE_TIMER);
         TimerMBean timer = (TimerMBean)MBeanProxy.create(Timer.class, TimerMBean.class, timerName, server);
         timer.start();

// FIXME FIXME FIXME FIXME        
//         if (!server.isRegistered(timerName))
//            timer.start();
        
         timer.addNotification(
            "persistence.timer.notification",
            null,                                  // msg
            name,                                  // userData
            new Date(System.currentTimeMillis())// timestamp
            persistPeriod
View Full Code Here


   public void testFixedRate() throws Exception
   {
      try
      {
         startTimerService();
         TimerMBean timer = (TimerMBean)MBeanServerInvocationHandler.newProxyInstance(server, timerName, TimerMBean.class, false);

         // calculate all times from now
         startTime = System.currentTimeMillis();
        
         // This must cause a fixed-rate timer notification production
         // with TIMES notification produced, spaced at PERIOD msecs, starting in now+PERIOD
         timer.addNotification("timer.notification", null, null, new Date(startTime + PERIOD), PERIOD, TIMES, true);
        
         long expectedDuration = FIXED_RATE_TOTAL;           
         waitForNotifications(TIMES, expectedDuration * 2);
        
         long testDuration = System.currentTimeMillis() - startTime;
View Full Code Here

              checked(rn2.getNewRoleValue(), ObjectName.class)
              .equals(singletonList(moduleA)));

        ObjectName timerName = new ObjectName(":type=timer");
        mbs.registerMBean(new Timer(), timerName);
        TimerMBean timer =
            MBeanServerInvocationHandler.newProxyInstance(mbs,
                                                          timerName,
                                                          TimerMBean.class,
                                                          false);
        Date doomsday = new Date(Long.MAX_VALUE);
        int timer1 = timer.addNotification("one", "one", null, doomsday);
        int timer2 = timer.addNotification("two", "two", null, doomsday);
        Vector<Integer> idsOne = timer.getNotificationIDs("one");
        check("Vector<Integer> TimerMBean.getNotificationIDs",
              idsOne.equals(singletonList(timer1)));
        Vector<Integer> allIds = timer.getAllNotificationIDs();
        check("Vector<Integer> TimerMBean.getAllNotificationIDs",
              equalListContents(allIds,
                                Arrays.asList(new Integer[]{timer1, timer2})));

        // ADD NEW TEST CASES ABOVE THIS COMMENT
View Full Code Here

TOP

Related Classes of javax.management.timer.TimerMBean

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.