Skip to content

Commit 1b9cbe2

Browse files
timwtglman
authored andcommitted
Eliminate duplicate scheduleTask code.
1 parent 9ec4885 commit 1b9cbe2

File tree

1 file changed

+1
-39
lines changed
  • core/src/main/java/com/orientechnologies/orient/core

1 file changed

+1
-39
lines changed

core/src/main/java/com/orientechnologies/orient/core/Orient.java

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -429,45 +429,7 @@ public void run() {
429429
}
430430

431431
public TimerTask scheduleTask(final Runnable task, final Date firstTime, final long period) {
432-
engineLock.readLock().lock();
433-
try {
434-
final TimerTask timerTask =
435-
new TimerTask() {
436-
@Override
437-
public void run() {
438-
try {
439-
task.run();
440-
} catch (Exception e) {
441-
OLogManager.instance()
442-
.error(
443-
this,
444-
"Error during execution of task " + task.getClass().getSimpleName(),
445-
e);
446-
} catch (Error e) {
447-
OLogManager.instance()
448-
.error(
449-
this,
450-
"Error during execution of task " + task.getClass().getSimpleName(),
451-
e);
452-
throw e;
453-
}
454-
}
455-
};
456-
457-
if (active) {
458-
if (period > 0) {
459-
timer.schedule(timerTask, firstTime, period);
460-
} else {
461-
timer.schedule(timerTask, firstTime);
462-
}
463-
} else {
464-
OLogManager.instance().warn(this, "OrientDB engine is down. Task will not be scheduled.");
465-
}
466-
467-
return timerTask;
468-
} finally {
469-
engineLock.readLock().unlock();
470-
}
432+
return scheduleTask(task, firstTime.getTime() - System.currentTimeMillis(), period);
471433
}
472434

473435
public boolean isActive() {

0 commit comments

Comments
 (0)