-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move all management of jobs executions to ScheduledJobManager #81
move all management of jobs executions to ScheduledJobManager #81
Conversation
4806970
to
c201bf2
Compare
distributed-job-manager/src/main/java/ru/fix/distributed/job/manager/ScheduledJobManager.java
Show resolved
Hide resolved
Profiler profiler, | ||
String workerId, | ||
DynamicProperty<DistributedJobManagerSettings> settings, | ||
AtomicBoolean isWorkerShutdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isWorkerShutdown breaked borders and leaked into ScheduledJobManager. Maybe isWorkerShutdown should stay in worker class, and worker should use and decide whether to call restartJobsAccordingToNewAssignments or not depending on Worker state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I have a suggestion for ReschedulableScheduler
API: ru-fix/jfix-stdlib#73
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
profiler | ||
); | ||
} | ||
|
||
synchronized List<ScheduledJobExecution> getScheduledJobExecutions(JobDescriptor distributedJob) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
…s_management_to_separate_class # Conflicts: # distributed-job-manager/src/main/java/ru/fix/distributed/job/manager/Worker.java
return scheduledJobs.get(distributedJob); | ||
} | ||
|
||
synchronized void removeIf(Predicate<Map.Entry<JobDescriptor, List<ScheduledJobExecution>>> predicate) { | ||
private synchronized void removeIf(Predicate<Map.Entry<JobDescriptor, List<ScheduledJobExecution>>> predicate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like there is no need for synchronized
for this private methods
I wanted to resolve issue #71, but management of jobs executions is separated between Worker and ScheduledJobManager
Worker is too complex class, so let's make that only ScheduledJobManager now responsible for management of jobs executions. Such a first step for refactoring Worker class
Note: I didn't change any DJM logic in this PR, I only moved some blocks of code from Worker to ScheduledJobManager; I suggest refactor ScheduledJobManager in next PR