0

I'am designing a winform application which should works in a redundant Environement (Main and Backup).

Both applications have to run 7/7 24/24, they connect in backend to an ODATA service to get list of objects.

what i want to achieve is to lock the object entry to be processed then just one application( first one get order to send command) handles it and continue the process.

Here what i am guessing to do .

design method AcquireLock that give one of the following values to the object to be handled : AcquireLock_Attempt = to be set in first line of code of AcquireLock method. AcquireLock_ACK = if the object was not locked by a concurrent application. AcquireLock_NAK = either the object was already locked or an error has been occured.

Please don't hesitate to share with me your experience if you already face similar scenarion.

N.B : 1- my Service is configured to Per-call. 2- the treatment between acquiring the lock and setting new state (Cmd_Send_OK, Failed_Transaction, ..) can be in range of millisecond to seconds).

Grant Thomas
  • 44,454
  • 10
  • 85
  • 129
xPridex
  • 91
  • 1
  • 8

2 Answers2

0

Your question is not very clear to me but for locking individual objects from list I suggest using sql server objects table row locking within/during critical section transaction (even read): its inter-process and allow you to handle large lists of objects. See discussion here

Community
  • 1
  • 1
SalientBrain
  • 2,431
  • 16
  • 18
0

Your WCF service could be decorated with

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
schglurps
  • 1,387
  • 1
  • 14
  • 26