Package org.quartz

Examples of org.quartz.JobListener


    p.setProperty("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
    System.setProperties(p);
    ERQSSchedulerFP4Test fp = new ERQSSchedulerFP4Test();
    ERQSSchedulerServiceFrameworkPrincipal.setSharedInstance(fp);
    fp.addJobListener(fp.getDefaultJobListener());
    JobListener aJobListener = fp.getScheduler().getListenerManager().getJobListener(ERQSJobListener.class.getName());
    assertNotNull(aJobListener);
  }
View Full Code Here


      catch (IOException localIOException1)
      {
        throw new MarshalException("error marshalling arguments", localIOException1);
      }
      this.ref.invoke((RemoteCall)localObject1);
      JobListener localJobListener;
      try
      {
        ObjectInput localObjectInput = ((RemoteCall)localObject1).getInputStream();
        localJobListener = (JobListener)localObjectInput.readObject();
      }
View Full Code Here

/*      */
/*      */   private List buildJobListenerList(String[] additionalLstnrs) throws SchedulerException
/*      */   {
/* 1516 */     List jobListeners = getGlobalJobListeners();
/* 1517 */     for (int i = 0; i < additionalLstnrs.length; i++) {
/* 1518 */       JobListener jl = getJobListener(additionalLstnrs[i]);
/*      */
/* 1520 */       if (jl != null) jobListeners.add(jl);
/*      */       else {
/* 1522 */         throw new SchedulerException("JobListener '" + additionalLstnrs[i] + "' not found.", 610);
/*      */       }
View Full Code Here

/*      */   {
/* 1607 */     List jobListeners = buildJobListenerList(jec.getJobDetail().getJobListenerNames());
/*      */
/* 1611 */     Iterator itr = jobListeners.iterator();
/* 1612 */     while (itr.hasNext()) {
/* 1613 */       JobListener jl = (JobListener)itr.next();
/*      */       try {
/* 1615 */         jl.jobToBeExecuted(jec);
/*      */       } catch (Exception e) {
/* 1617 */         SchedulerException se = new SchedulerException("JobListener '" + jl.getName() + "' threw exception: " + e.getMessage(), e);
/*      */
/* 1620 */         se.setErrorCode(600);
/* 1621 */         throw se;
/*      */       }
/*      */     }
View Full Code Here

/*      */   {
/* 1629 */     List jobListeners = buildJobListenerList(jec.getJobDetail().getJobListenerNames());
/*      */
/* 1633 */     Iterator itr = jobListeners.iterator();
/* 1634 */     while (itr.hasNext()) {
/* 1635 */       JobListener jl = (JobListener)itr.next();
/*      */       try {
/* 1637 */         jl.jobExecutionVetoed(jec);
/*      */       } catch (Exception e) {
/* 1639 */         SchedulerException se = new SchedulerException("JobListener '" + jl.getName() + "' threw exception: " + e.getMessage(), e);
/*      */
/* 1642 */         se.setErrorCode(600);
/* 1643 */         throw se;
/*      */       }
/*      */     }
View Full Code Here

/*      */   {
/* 1651 */     List jobListeners = buildJobListenerList(jec.getJobDetail().getJobListenerNames());
/*      */
/* 1655 */     Iterator itr = jobListeners.iterator();
/* 1656 */     while (itr.hasNext()) {
/* 1657 */       JobListener jl = (JobListener)itr.next();
/*      */       try {
/* 1659 */         jl.jobWasExecuted(jec, je);
/*      */       } catch (Exception e) {
/* 1661 */         SchedulerException se = new SchedulerException("JobListener '" + jl.getName() + "' threw exception: " + e.getMessage(), e);
/*      */
/* 1664 */         se.setErrorCode(600);
/* 1665 */         throw se;
/*      */       }
/*      */     }
View Full Code Here

/*  528 */       scheduleJob(bndle, sched, overWriteExistingJobs);
/*      */     }
/*      */
/*  531 */     itr = this.listenersToSchedule.iterator();
/*  532 */     while (itr.hasNext()) {
/*  533 */       JobListener listener = (JobListener)itr.next();
/*  534 */       getLog().info("adding listener " + listener.getName() + " of class " + listener.getClass().getName());
/*  535 */       sched.addJobListener(listener);
/*      */     }
/*  537 */     getLog().info(jobBundles.size() + " scheduled jobs.");
/*      */   }
View Full Code Here

/*  832 */       if (listenerClass == null) {
/*  833 */         this.initException = new SchedulerException("JobListener class not specified for listener '" + jobListenerNames[i] + "'", 50);
/*      */
/*  837 */         throw this.initException;
/*      */       }
/*  839 */       JobListener listener = null;
/*      */       try {
/*  841 */         listener = (JobListener)loadHelper.loadClass(listenerClass).newInstance();
/*      */       }
/*      */       catch (Exception e) {
/*  844 */         this.initException = new SchedulerException("JobListener class '" + listenerClass + "' could not be instantiated.", e);
/*      */
/*  847 */         this.initException.setErrorCode(50);
/*      */
/*  849 */         throw this.initException;
/*      */       }
/*      */       try {
/*  852 */         Method nameSetter = listener.getClass().getMethod("setName", strArg);
/*  853 */         if (nameSetter != null)
/*  854 */           nameSetter.invoke(listener, new Object[] { jobListenerNames[i] });
/*  855 */         setBeanProps(listener, lp);
/*      */       } catch (Exception e) {
/*  857 */         this.initException = new SchedulerException("JobListener '" + listenerClass + "' props could not be configured.", e);
/*      */
/*  860 */         this.initException.setErrorCode(50);
/*      */
/*  862 */         throw this.initException;
/*      */       }
/*  864 */       jobListeners[i] = listener;
/*      */     }
/*      */
/*  870 */     String[] triggerListenerNames = this.cfg.getPropertyGroups("org.quartz.triggerListener");
/*  871 */     TriggerListener[] triggerListeners = new TriggerListener[triggerListenerNames.length];
/*  872 */     for (int i = 0; i < triggerListenerNames.length; i++) {
/*  873 */       Properties lp = this.cfg.getPropertyGroup("org.quartz.triggerListener." + triggerListenerNames[i], true);
/*      */
/*  876 */       String listenerClass = lp.getProperty("class", null);
/*      */
/*  878 */       if (listenerClass == null) {
/*  879 */         this.initException = new SchedulerException("TriggerListener class not specified for listener '" + triggerListenerNames[i] + "'", 50);
/*      */
/*  883 */         throw this.initException;
/*      */       }
/*  885 */       TriggerListener listener = null;
/*      */       try {
/*  887 */         listener = (TriggerListener)loadHelper.loadClass(listenerClass).newInstance();
/*      */       }
/*      */       catch (Exception e) {
/*  890 */         this.initException = new SchedulerException("TriggerListener class '" + listenerClass + "' could not be instantiated.", e);
/*      */
/*  893 */         this.initException.setErrorCode(50);
/*      */
/*  895 */         throw this.initException;
/*      */       }
/*      */       try {
/*  898 */         Method nameSetter = listener.getClass().getMethod("setName", strArg);
/*  899 */         if (nameSetter != null)
/*  900 */           nameSetter.invoke(listener, new Object[] { triggerListenerNames[i] });
/*  901 */         setBeanProps(listener, lp);
/*      */       } catch (Exception e) {
/*  903 */         this.initException = new SchedulerException("TriggerListener '" + listenerClass + "' props could not be configured.", e);
View Full Code Here

                        "JobListener class not specified for listener '"
                                + jobListenerNames[i] + "'",
                        SchedulerException.ERR_BAD_CONFIGURATION);
                throw initException;
            }
            JobListener listener = null;
            try {
               listener = (JobListener)
                       loadHelper.loadClass(listenerClass).newInstance();
            } catch (Exception e) {
                initException = new SchedulerException(
                        "JobListener class '" + listenerClass
                                + "' could not be instantiated.", e);
                initException
                        .setErrorCode(SchedulerException.ERR_BAD_CONFIGURATION);
                throw initException;
            }
            try {
                Method nameSetter = listener.getClass().getMethod("setName", strArg);
                if(nameSetter != null)
                    nameSetter.invoke(listener, new Object[] {jobListenerNames[i] } );
                setBeanProps(listener, lp);
            } catch (Exception e) {
                initException = new SchedulerException(
                        "JobListener '" + listenerClass
                                + "' props could not be configured.", e);
                initException
                        .setErrorCode(SchedulerException.ERR_BAD_CONFIGURATION);
                throw initException;
            }
            jobListeners[i] = listener;
        }
              
        // Set up any TriggerListeners
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        String[] triggerListenerNames = cfg.getPropertyGroups(PROP_TRIGGER_LISTENER_PREFIX);
        TriggerListener[] triggerListeners = new TriggerListener[triggerListenerNames.length];
        for (int i = 0; i < triggerListenerNames.length; i++) {
            Properties lp = cfg.getPropertyGroup(PROP_TRIGGER_LISTENER_PREFIX + "."
                    + triggerListenerNames[i], true);
           
            String listenerClass = lp.getProperty(PROP_LISTENER_CLASS, null);

            if (listenerClass == null) {
                initException = new SchedulerException(
                        "TriggerListener class not specified for listener '"
                                + triggerListenerNames[i] + "'",
                        SchedulerException.ERR_BAD_CONFIGURATION);
                throw initException;
            }
            TriggerListener listener = null;
            try {
               listener = (TriggerListener)
                       loadHelper.loadClass(listenerClass).newInstance();
            } catch (Exception e) {
                initException = new SchedulerException(
                        "TriggerListener class '" + listenerClass
                                + "' could not be instantiated.", e);
                initException
                        .setErrorCode(SchedulerException.ERR_BAD_CONFIGURATION);
                throw initException;
            }
            try {
                Method nameSetter = listener.getClass().getMethod("setName", strArg);
                if(nameSetter != null)
                    nameSetter.invoke(listener, new Object[] {triggerListenerNames[i] } );
                setBeanProps(listener, lp);
            } catch (Exception e) {
                initException = new SchedulerException(
View Full Code Here

    @Test
    public void testJobExecutesInTime() throws InterruptedException, SchedulerException {
        final AtomicReference<JobExecutionException> jobExecutionResult = new AtomicReference<JobExecutionException>();
        final CountDownLatch jobExecutionLatch = new CountDownLatch(1);
        scheduler.getListenerManager().addJobListener(new JobListener() {
            @Override
            public String getName() {
                return "job execution result validator";
            }
View Full Code Here

TOP

Related Classes of org.quartz.JobListener

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.