Examples of Scheduler


Examples of org.apache.sling.commons.scheduler.Scheduler

     * If a scheduler is available, a job is scheduled or stopped.
     * @param event The incoming event.
     * @return
     */
    protected boolean processEvent(final Event event, final ScheduleInfo scheduleInfo) {
        final Scheduler localScheduler = this.scheduler;
        if ( localScheduler != null ) {
            // is this a stop event?
            if ( scheduleInfo.isStopEvent() ) {
                if ( this.logger.isDebugEnabled() ) {
                    this.logger.debug("Stopping timed event " + event.getProperty(EventUtil.PROPERTY_TIMED_EVENT_TOPIC) + "(" + scheduleInfo.jobId + ")");
                }
                this.startedSchedulerJobs.remove(scheduleInfo.jobId);
                localScheduler.unschedule(scheduleInfo.jobId);
                return true;
            }

            // Create configuration for scheduled job
            final Map<String, Serializable> config = new HashMap<String, Serializable>();
            // copy properties
            final Hashtable<String, Object> properties = new Hashtable<String, Object>();
            config.put(JOB_TOPIC, (String)event.getProperty(EventUtil.PROPERTY_TIMED_EVENT_TOPIC));
            final String[] names = event.getPropertyNames();
            if ( names != null ) {
                for(int i=0; i<names.length; i++) {
                    properties.put(names[i], event.getProperty(names[i]));
                }
            }
            config.put(JOB_CONFIG, properties);
            config.put(JOB_SCHEDULE_INFO, scheduleInfo);

            final ScheduleOptions options;
            if ( scheduleInfo.expression != null ) {
                if ( this.logger.isDebugEnabled() ) {
                    this.logger.debug("Adding timed event " + config.get(JOB_TOPIC) + "(" + scheduleInfo.jobId + ")" + " with cron expression " + scheduleInfo.expression);
                }
                options = localScheduler.EXPR(scheduleInfo.expression);
            } else if ( scheduleInfo.period != null ) {
                if ( this.logger.isDebugEnabled() ) {
                    this.logger.debug("Adding timed event " + config.get(JOB_TOPIC) + "(" + scheduleInfo.jobId + ")" + " with period " + scheduleInfo.period);
                }
                final Date startDate = new Date(System.currentTimeMillis() + scheduleInfo.period * 1000);
                options = localScheduler.AT(startDate, -1, scheduleInfo.period);
            } else {
                // then it must be date
                if ( this.logger.isDebugEnabled() ) {
                    this.logger.debug("Adding timed event " + config.get(JOB_TOPIC) + "(" + scheduleInfo.jobId + ")" + " with date " + scheduleInfo.date);
                }
                options = localScheduler.AT(scheduleInfo.date);
            }
            localScheduler.schedule(this, options.canRunConcurrently(false).name(scheduleInfo.jobId).config(config));
            this.startedSchedulerJobs.add(scheduleInfo.jobId);
            return true;
        } else {
            this.logger.error("No scheduler available to start timed event " + event);
        }
View Full Code Here

Examples of org.apache.uima.ducc.rm.scheduler.Scheduler

    NodeStability stabilityManager = null;

    public ResourceManagerComponent(CamelContext context) {
        super("ResourceManager", context);
        this.scheduler = new Scheduler();
    }
View Full Code Here

Examples of org.cometd.server.AbstractServerTransport.Scheduler

    {
        if (isLocalSession())
            return;

        boolean remove = false;
        Scheduler scheduler = null;
        synchronized (getLock())
        {
            if (_intervalTimestamp == 0)
            {
                if (_maxServerInterval > 0 && now > _connectTimestamp + _maxServerInterval)
                {
                    _logger.info("Emergency sweeping session {}", this);
                    remove = true;
                }
            }
            else
            {
                if (now > _intervalTimestamp)
                {
                    if (_logger.isDebugEnabled())
                        _logger.debug("Sweeping session {}", this);
                    remove = true;
                }
            }
            if (remove)
                scheduler = _scheduler;
        }
        if (remove)
        {
            if (scheduler != null)
                scheduler.cancel();
            _bayeux.removeServerSession(this, true);
        }
    }
View Full Code Here

Examples of org.drools.core.phreak.PhreakTimerNode.Scheduler

    }
   
    public Scheduler removeTimerNodeScheduler( int nodeId, TupleKey key ) {
        Map<TupleKey, Scheduler> timers = timerNodeSchedulers.get( nodeId );
        if( timers != null ) {
            Scheduler scheduler = timers.remove( key );
            if( timers.isEmpty() ) {
                timerNodeSchedulers.remove( nodeId );
            }
            return scheduler;
        }
View Full Code Here

Examples of org.eclipse.jetty.util.thread.Scheduler

        _channel.execute(_channel);
    }

    protected void scheduleTimeout()
    {
        Scheduler scheduler = _channel.getScheduler();
        if (scheduler!=null && _timeoutMs>0)
            _event.setTimeoutTask(scheduler.schedule(_event,_timeoutMs,TimeUnit.MILLISECONDS));
    }
View Full Code Here

Examples of org.ggp.base.apps.server.scheduling.Scheduler

        schedulingPanel = new SchedulingPanel();
        leaderboardPanel = new LeaderboardPanel();
    matchesTabbedPane.addTab("Overview", new OverviewPanel());

    scheduler = new Scheduler(matchesTabbedPane, schedulingPanel, leaderboardPanel);
    schedulingPanel.setScheduler(scheduler);
    scheduler.start();
  }
View Full Code Here

Examples of org.jgroups.util.Scheduler

    }


    void startScheduler() {
        if(scheduler == null) {
            scheduler=new Scheduler();
            if(deadlock_detection && call_stack_setter == null) {
                call_stack_setter=new CallStackSetter();
                scheduler.setListener(call_stack_setter);
            }
            if(concurrent_processing)
View Full Code Here

Examples of org.jgroups.util.Scheduler

        super(name);
    }


    public void testScheduler() throws Exception {
        Scheduler sch=new Scheduler();
        sch.setListener(new Listener());
        sch.add(new MyThread("Bela"));
        sch.add(new MyThread("Janet"));
        sch.add(new MyThread("Ralph"));
        sch.start();
        sch.add(new MyThread("Frank"));
        sch.add(new MyThread("Marco"));

        Util.sleep(1000);
        sch.addPrio(new MyThread("Gabi"));
        sch.add(new MyThread("Rolf"));
        Util.sleep(100);
        sch.addPrio(new MyThread("Gabi2"));
        Util.sleep(100);
        sch.addPrio(new MyThread("Gabi3"));
        Util.sleep(100);
        sch.addPrio(new MyThread("Gabi4"));
        Util.sleep(1000)// increase this if you want to see all thread running (and possibly completing)
        sch.stop();
    }
View Full Code Here

Examples of org.jitterbit.integration.client.admin.engine.Scheduler

* @since 3.0.0
*/
public final class SchedulerEngineUi extends AbstractEngineUi {

    public SchedulerEngineUi() {
        super(new Scheduler());
    }
View Full Code Here

Examples of org.jresearch.gossip.scheduler.Scheduler

     *
     * @return @throws
     *         SchedulerException
     */
    private Scheduler initScheduler() throws SchedulerException, IOException {
        Scheduler sched = new Scheduler();
        sched.start();
        return sched;
    }
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.