Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » How to block a specific Job
How to block a specific Job [message #1816532] Wed, 30 October 2019 15:39 Go to next message
Luis Nothvogel is currently offline Luis NothvogelFriend
Messages: 56
Registered: October 2019
Member
Hey,

So I have a list of jobs that are running at the start of the Server. What i want to do is build an Administrator-Overviewpage where one could see every job that is running and some additional Info. I now how to that. What i dont understand is how to block a specific job. Say from the Overviewpage you would have an Menu which blocks a selected job. Or the job, which runs every week at 1 day, blocks itself if it fails. I tried using the blocking condition described in the technical guide but it didnt work.

Could someone please explain how to block a specific job either with a menu click or by blocking itself on failure.

Thank you
- Luis
Re: How to block a specific Job [message #1816557 is a reply to message #1816532] Thu, 31 October 2019 10:32 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
Hi Luis

I am not sure what you mean with "block a job". Do you want to prevent a job (that is currently running or not) from being re-scheduled again afterwards? Or do you want to cancel a job that is currently running?

Thanks for clarifying
Re: How to block a specific Job [message #1816561 is a reply to message #1816557] Thu, 31 October 2019 10:57 Go to previous messageGo to next message
Luis Nothvogel is currently offline Luis NothvogelFriend
Messages: 56
Registered: October 2019
Member
Hi Matthias,

What i meant is, that when a job is pending because the execution trigger isnt reached yet. I want to be able to say block, so as soon as it hits its execution trigger(or before that), the job realises that it was blocked and then falls into the state WAITING_FOR_BLOCKING_CONDITION as stated in the technical guide. So at the end the job doesnt get executed, but it remains in the JobManager so I can restart it later. Maybe I missunderstood the concept of it or something else, cause I am a Beginner, so please correct me if I am wrong.
If your still not sure what i mean, please tell me :) i am happy to clarify.

Thank you for trying to help
Re: How to block a specific Job [message #1816567 is a reply to message #1816561] Thu, 31 October 2019 12:33 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
Hi Luis

What you describe should be possible using BlockingConditions. The job must call waitFor() to get the permit to run. What did not work with this solution?

Anyway, this implementation has the disadvantage that the thread waiting in the blocking condition is wasted. This thread from the pool could be used for other tasks during the waiting time if it would not have been blocked in the condition. But while it is blocked the pool cannot reassign any other work to the tread because from the pools perspective this thread is in use. Hence the pool would have to create a new thread for the work. And creating threads is a resource intensive task (that's why thread pools are used).

So, if you have a thread that performs any task and must wait at a certain point until a condition is met and continues the task afterwards, a BlockingCondition is fine.
In cases in which the task must not be performed at all (e.g. skip the execution) it would be better to find another solution.

Depending on the type of execution trigger (single or recurring) a solution could be to cancel the job and re-schedule as soon as needed again.
Or the task has an internal flag indicating if it should run or not and then at the start of the task immediately returning if false.

Hope this helps
Mat

[Updated on: Thu, 31 October 2019 12:35]

Report message to a moderator

Re: How to block a specific Job [message #1816569 is a reply to message #1816567] Thu, 31 October 2019 13:40 Go to previous message
Luis Nothvogel is currently offline Luis NothvogelFriend
Messages: 56
Registered: October 2019
Member
Hey Matthias,

Thank you for your help. Well when i tried with whenDone() it just ignored it and i dont have a waitFor() method, or at least I didnt find it.

Anyway I found a way to make it work. What I did is that i have a boolean which is set to false per default. And in the Run method I have an if that checks on said boolean. And if the boolean is true the run method does nothing. I dont know if thats an optimal solution, but at least i can now control my Jobs.

Thanks again and have a good one
- Luis
Previous Topic:"Keyboard Navigation" in Table
Next Topic:Database Connection Pool causing JUnit tests to timeout
Goto Forum:
  


Current Time: Tue Apr 23 08:09:09 GMT 2024

Powered by FUDForum. Page generated in 0.02989 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top