BrightSide Workbench Full Report + Source Code
org.turro.scheduler.motor.Motor Class Reference
Inheritance diagram for org.turro.scheduler.motor.Motor:
Collaboration diagram for org.turro.scheduler.motor.Motor:

Public Member Functions

Set< AbstractTaskgetTasks ()
 
void run ()
 
void stop ()
 
ScheduledFuture<?> runTask (AbstractTask task)
 

Static Public Member Functions

static Motor getInstance ()
 
static Motor getInstance (IConstructor constructor, long period, TimeUnit unit)
 
static synchronized Motor getInstance (IConstructor constructor, long period, TimeUnit unit, boolean forceNew)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 39 of file Motor.java.

Member Function Documentation

◆ getInstance() [1/3]

static Motor org.turro.scheduler.motor.Motor.getInstance ( )
static

Definition at line 62 of file Motor.java.

62  {
63  return motor;
64  }
Here is the caller graph for this function:

◆ getInstance() [2/3]

static Motor org.turro.scheduler.motor.Motor.getInstance ( IConstructor  constructor,
long  period,
TimeUnit  unit 
)
static

Definition at line 66 of file Motor.java.

66  {
67  return getInstance(constructor, period, unit, false);
68  }
static Motor getInstance()
Definition: Motor.java:62
Here is the call graph for this function:

◆ getInstance() [3/3]

static synchronized Motor org.turro.scheduler.motor.Motor.getInstance ( IConstructor  constructor,
long  period,
TimeUnit  unit,
boolean  forceNew 
)
static

Definition at line 70 of file Motor.java.

70  {
71  if(forceNew && motor != null) motor.stop();
72  if(motor == null || forceNew) motor = new Motor(constructor, period, unit);
73  return motor;
74  }
Here is the call graph for this function:

◆ getTasks()

Set<AbstractTask> org.turro.scheduler.motor.Motor.getTasks ( )

Definition at line 76 of file Motor.java.

76  {
77  return tasks;
78  }
Here is the caller graph for this function:

◆ run()

void org.turro.scheduler.motor.Motor.run ( )

Definition at line 81 of file Motor.java.

81  {
82  Thread.currentThread().setName("ElephantTaskMotorPool");
83  Date now = new Date();
84 
85  for(AbstractTask task : tasks) {
86  if(handle.isCancelled()) break;
87  if(task.isDone() &&
88  task.getSettings().isActive() &&
89  task.shouldRun(now)) {
90  WebLoggers.info(this).message(I_.format("%s:%s started.",
91  task.getName(), task.getSettings().getDescription())).log();
92  task.doRun(this);
93  }
94  }
95 
96  CheckDate cd = new CheckDate(now);
97  int dayOfYear = cd.getDayOfYear();
98  if(dayOfYear != entityDay) {
99  entityDay = dayOfYear;
100  entityTask = new EntityTask();
101  WebLoggers.info(this).message(I_.format("%s:%s started.",
102  entityTask.getName(), entityTask.getDescription())).log();
103  entityTask.doRun(this);
104  }
105 
106  //LastActivities.generateUserContent(now);
107  }
Here is the call graph for this function:

◆ runTask()

ScheduledFuture<?> org.turro.scheduler.motor.Motor.runTask ( AbstractTask  task)

Definition at line 125 of file Motor.java.

125  {
126  return scheduler.schedule(task, 5, TimeUnit.SECONDS);
127  }
Here is the caller graph for this function:

◆ stop()

void org.turro.scheduler.motor.Motor.stop ( )

Definition at line 109 of file Motor.java.

109  {
110  for(AbstractTask task : tasks) {
111  task.stop();
112  WebLoggers.info(this).message(I_.format("%s:%s stopped.",
113  task.getName(), task.getSettings().getDescription())).log();
114  }
115  if(entityTask != null) {
116  entityTask.stop();
117  WebLoggers.info(this).message(I_.format("%s:%s stopped.",
118  entityTask.getName(), entityTask.getDescription())).log();
119  }
120  handle.cancel(true);
121  scheduler.shutdown();
122  WebLoggers.info(this).message("Scheduler shutdown.").log();
123  }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: