scheduling

What's the best way to implement a scheduled job using a windows service

柔情痞子 提交于 2019-12-02 02:48:23
I have a database job that runs occasionally at night and I need a windows service to poll the database regularly to do some more work after the SQL job is done. I am a looking for a solid example to write a scheduler that can fail gracefully without crashing the service. Take a look at http://codeplex.com/TaskService Mark Ransom Just make it a scheduled task. See windows service vs scheduled task I would use MSMQ, add a final step to the job that adds a message to the queue (Via ActiveX Script / COM or a .net call if you can) Then have your service monitoring the Queue. As far as not crashing

Built in background-scheduling system in .NET?

ぐ巨炮叔叔 提交于 2019-12-01 22:34:37
I ask though I doubt there is any such system. Basically I need to schedule tasks to execute at some point in the future (usually no more than a few seconds or possibly minutes from now), and have some way of cancelling that request unless too late. Ie. code that would look like this: var x = Scheduler.Schedule(() => SomethingSomething(), TimeSpan.FromSeconds(5)); ... x.Dispose(); // cancels the request Is there any such system in .NET? Is there anything in TPL that can help me? I need to run such future-actions from various instances in a system here, and would rather avoid each such class

Linux pthread mutex and kernel scheduler

左心房为你撑大大i 提交于 2019-12-01 21:21:57
With a friend of mine, we disagree on how synchronization is handled at userspace level (in the pthread library). a. I think that during a pthread_mutex_lock, the thread actively waits. Meaning the linux scheduler rises this thread, let it execute his code, which should looks like: while (mutex_resource->locked); Then, another thread is scheduled which potentially free the locked field, etc. So this means that the scheduler waits for the thread to complete its schedule time before switching to the next one, no matter what the thread is doing. b. My friend thinks that the waiting thread somehow

How to Pass Arguments to Timertask Run Method

蓝咒 提交于 2019-12-01 19:26:15
问题 I have a method and I want it to be scheduled for execution in later times. The scheduling time and method's arguments depend on user inputs. I already have tried Timers, but I have a question. How could It be possible to pass arguments to Java TimerTask run method ? TimerTask timert = new TimerTask() { @Override public void run() { //do something } } 回答1: You will need to extend the TimerTask and create a constructor and/or setter fields.. Then set the values you want before scheduling the

Checking if new interval overlaps - MySQL (or PHP)

二次信任 提交于 2019-12-01 19:04:50
I've been thinking on how I can simplify the problem presented here. Complex MySQL Query - Checking for overlapping DATE intervals At it's heart, minus all the fancy magic with DATES this is simply a problem of checking for overlapping intervals. After all dates can be thought of as numbers and it may make the logic easier. Imagine the following table: Schedules schedule_id | start | end 1 | 1 | 3 2 | 4 | 7 3 | 8 | 13 4 | 15 | 16 5 | 18 | 24 6 | 25 | 28 I'm trying to insert a new interval such that [a,b] do not overlap with any other interval. The considerations: Yes, I can pull the whole

How to Pass Arguments to Timertask Run Method

爷,独闯天下 提交于 2019-12-01 18:34:39
I have a method and I want it to be scheduled for execution in later times. The scheduling time and method's arguments depend on user inputs. I already have tried Timers, but I have a question. How could It be possible to pass arguments to Java TimerTask run method ? TimerTask timert = new TimerTask() { @Override public void run() { //do something } } sethu You will need to extend the TimerTask and create a constructor and/or setter fields.. Then set the values you want before scheduling the TimerTask for execution. You can write you own class which extends from TimerTask class and you can

QEventLoop: get time when an event was scheduled

丶灬走出姿态 提交于 2019-12-01 12:12:52
Is it possible to get the time when an event has been scheduled to a QEventLoop (e.g. the QCoreApplication event loop)? I have a situation where the main event loop is paused. When it's reactivated the events are fired and I am interested in the time when the events where added to the queue. The events are not custom events but system (and other) events. Regards, It mainly depends on what are the system events you are interested in, for you have already the timestamp in some cases. As an example, QInputEvent ( base class for events that describe user input , like QMouseEvent , QKeyEvent , and

Timer vs. ScheduledExecutorService scheduling

别来无恙 提交于 2019-12-01 11:23:00
One of the recommended uses of the ScheduledExecutorService is as a direct replacement for the Timer class, as discussed in numerous StackOverflow topics already: Java Timer vs ExecutorService? Difference between TimerTask and Executors.newScheduledThreadPool(1) What is the difference between schedule and scheduleAtFixedRate? Android Timer schedule vs scheduleAtFixedRate However, the naming conventions of the methods supported by ScheduledExecutorService and Timer , are not identical. For example, whereas they both have a scheduleAtFixedRate() method, the Timer method schedule​(TimerTask task,

QEventLoop: get time when an event was scheduled

百般思念 提交于 2019-12-01 11:20:02
问题 Is it possible to get the time when an event has been scheduled to a QEventLoop (e.g. the QCoreApplication event loop)? I have a situation where the main event loop is paused. When it's reactivated the events are fired and I am interested in the time when the events where added to the queue. The events are not custom events but system (and other) events. Regards, 回答1: It mainly depends on what are the system events you are interested in, for you have already the timestamp in some cases. As an

Special case scheduling [closed]

感情迁移 提交于 2019-12-01 11:19:19
So here's the question. While studying about process scheduling I came across two seemingly contradictory examples I just can't get my head around. The problem arises if for instance in the priority non-preemptive scheduling algorithm which always chooses the process with the highest priority to be run next and once running, process can only volontarily give up its CPU time, that is no other process can run until the currently running process finishes. It seems that what the solution the book proposes is that if both end of one process and arrival of the new high-priority process occur at the