473,395 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

lock (mutex) between services on multiple machines

Hi there,

I have a .NET Windows Service which utilizes System.Threading.Timer and
performs a task every 15 minutes. The task is performed on a shared
database (e.g. querying, creation of records, etc.)
I would like to install the service on 2 or more servers for redundancy
reasons.
However, I need only one server to perform the task at a time.
E.g. if the service on Server1 is already processing, other servers
should wait.

How can I make the services on all servers to talk to each other and
ensure that only one is processing?
Are there any .NET or Windows OS specific facilities I could utilize?

Thank you.
-Oleg.

Sep 11 '06 #1
1 2466
Oleg,

you could use a WaitHandle subclass. As WaitHandles can be used accross
appDomains it could work for your scenario.

Regards,
Tasos

Ol*********@gmail.com wrote:
Hi there,

I have a .NET Windows Service which utilizes System.Threading.Timer and
performs a task every 15 minutes. The task is performed on a shared
database (e.g. querying, creation of records, etc.)
I would like to install the service on 2 or more servers for redundancy
reasons.
However, I need only one server to perform the task at a time.
E.g. if the service on Server1 is already processing, other servers
should wait.

How can I make the services on all servers to talk to each other and
ensure that only one is processing?
Are there any .NET or Windows OS specific facilities I could utilize?

Thank you.
-Oleg.
Sep 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Marco Bubke | last post by:
Hi There is the Lock object in the threading module. But there is no medode there I could aquire a scoped lock like: mutex = threading.Lock() my_lock = mutex.scoped_acquire() # maybe...
14
by: Antoon Pardon | last post by:
The queue and condition class allow threads to wait only a limited time. However this currently is implemented by a polling loop. Now for those who like to avoid polling I have here a Tlock...
4
by: Vinay C | last post by:
Hi, Can anyone clear me that, when should we use go for mutex, and in which situation should we opt for monitor, lock, semaphone and other objects, in a multithreaded application for synchronization...
7
by: Sunny | last post by:
Hi, I can not understend completely the lock statement. Actally what is locked: 1. the part of the code between {...} or 2. the object in lock() In the docs is written: for 1: The lock...
3
by: Ron Vecchi | last post by:
I have a single line file where the line will be read and updated each time it is opened. My question is I need to open it with a lock so noone else can read or write to it untill the lock is...
4
by: UJ | last post by:
What's the easiest/best way to open a single file from multiple applications but so only one can read it at a time? I tried a mutex but had problems. I noticed there is something called a...
190
by: blangela | last post by:
If you had asked me 5 years ago about the future of C++, I would have told you that its future was assured for many years to come. Recently, I have been starting to wonder. I have been teaching...
8
by: Dan Pavel | last post by:
Hi, I did not used Mutex before and I need now. I have an application that control some workflows on different machines. I use SNMP for that. The problem is that the thread used for starting an...
45
by: Chris Forone | last post by:
hello group, is there a chance for other functions to get the lock if i have following loop: while (running) { Lock local(mutex); }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.