Package org.apache.activemq.broker.jmx

Examples of org.apache.activemq.broker.jmx.JobSchedulerViewMBean


        assertTrue(nextTime < toLate);
    }

    @Test
    public void testGetExecutionCount() throws Exception {
        final JobSchedulerViewMBean view = getJobSchedulerMBean();
        assertNotNull(view);
        assertTrue(view.getAllJobs().isEmpty());
        scheduleMessage(10000, 1000, 10);
        assertFalse(view.getAllJobs().isEmpty());
        TabularData jobs = view.getAllJobs();
        assertEquals(1, jobs.size());
        String jobId = null;
        for (Object key : jobs.keySet()) {
            jobId = ((List<?>)key).get(0).toString();
        }

        final String fixedJobId = jobId;
        LOG.info("Attempting to get execution count for Job: {}", jobId);
        assertEquals(0, view.getExecutionCount(jobId));

        assertTrue("Should execute again", Wait.waitFor(new Wait.Condition() {

            @Override
            public boolean isSatisified() throws Exception {
                return view.getExecutionCount(fixedJobId) > 0;
            }
        }));
    }
View Full Code Here


        return (JobSchedulerViewMBean) newProxyInstance(name, JobSchedulerViewMBean.class, true);
    }

    @Override
    public Collection<JobFacade> getScheduledJobs() throws Exception {
        JobSchedulerViewMBean jobScheduler = getJobScheduler();
        List<JobFacade> result = new ArrayList<JobFacade>();
        TabularData table = jobScheduler.getAllJobs();
        for (Object object : table.values()) {
            CompositeData cd = (CompositeData) object;
            JobFacade jf = new JobFacade(cd);
            result.add(jf);
        }
View Full Code Here


    @Override
    public boolean isJobSchedulerStarted() {
        try {
            JobSchedulerViewMBean jobScheduler = getJobScheduler();
            return true;
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here

     */
    protected Broker addInterceptors(Broker broker) throws Exception {
        if (isSchedulerSupport()) {
            SchedulerBroker sb = new SchedulerBroker(this, broker, getJobSchedulerStore());
            if (isUseJmx()) {
                JobSchedulerViewMBean view = new JobSchedulerView(sb.getJobScheduler());
                try {
                    ObjectName objectName = BrokerMBeanSupport.createJobSchedulerServiceName(getBrokerObjectName());
                    AnnotatedMBean.registerMBean(getManagementContext(), view, objectName);
                    this.adminView.setJMSJobScheduler(objectName);
                } catch (Throwable e) {
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.jmx.JobSchedulerViewMBean

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.