Package com.sishuok.es.maintain.dynamictask.entity

Examples of com.sishuok.es.maintain.dynamictask.entity.TaskDefinition


        taskDefinitionService.delete(taskDefinitionIds);
    }

    private synchronized void startTask(boolean forceStart, Long... taskDefinitionIds) {
        for(Long taskDefinitionId : taskDefinitionIds) {
            TaskDefinition td = taskDefinitionService.findOne(taskDefinitionId);
            if(td == null || (forceStart == false && Boolean.TRUE.equals(td.getStart()))) {
                return;
            }

            try {
                ScheduledFuture<?> future = taskScheduler.schedule(createTask(td), new CronTrigger(td.getCron()));
                taskMap.put(taskDefinitionId, future);
                td.setStart(Boolean.TRUE);
            } catch (Exception e) {
                logger.error("start task error, task id:" + taskDefinitionId, e);
                td.setDescription(e.getMessage());
            }
            taskDefinitionService.update(td);
        }
    }
View Full Code Here



    @Override
    public synchronized void stopTask(boolean forceTermination, Long... taskDefinitionIds) {
        for(Long taskDefinitionId : taskDefinitionIds) {
            TaskDefinition td = taskDefinitionService.findOne(taskDefinitionId);

            if(td == null || Boolean.FALSE.equals(td.getStart())) {
                return;
            }

            try {
                ScheduledFuture<?> future = taskMap.get(taskDefinitionId);
                if(future != null) {
                    future.cancel(forceTermination);
                }
                td.setStart(Boolean.FALSE);
            } catch (Exception e) {
                logger.error("stop task error, task id:" + taskDefinitionId, e);
                td.setDescription(e.getMessage());
            }
            taskDefinitionService.update(td);
        }

    }
View Full Code Here

TOP

Related Classes of com.sishuok.es.maintain.dynamictask.entity.TaskDefinition

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.