Skip to content
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

Merged
merged 5 commits into from
Oct 13, 2021

Conversation

KazankovMarch
Copy link
Contributor

@KazankovMarch KazankovMarch commented Jul 28, 2020

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

@KazankovMarch KazankovMarch marked this pull request as draft July 29, 2020 06:43
@KazankovMarch KazankovMarch force-pushed the move_jobs_execuitons_management_to_separate_class branch from 4806970 to c201bf2 Compare September 27, 2020 18:27
@KazankovMarch KazankovMarch marked this pull request as ready for review September 27, 2020 18:29
Profiler profiler,
String workerId,
DynamicProperty<DistributedJobManagerSettings> settings,
AtomicBoolean isWorkerShutdown
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be private?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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) {
Copy link
Member

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

@swarmshine swarmshine merged commit 92ff031 into master Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants