New answers tagged

0

There may be another solution than one proposed by Ewan, though his is excellent. Suppose you have a pool of queues. At any moment, a queue is either free (not being used at all) or assigned to a specific bank account. You still need a master worker to allocate a queue for use, assign it to a bank account, and make it available to the next free subordinate ...


1

So, You have two issues here 1: Prevent/Resolve Simultaneous actions (withdrawals) on a single resource (bank account) 2: Enforce processing actions (withdrawals) in a particular order In your example, you could resolve 1 in a number of ways, but lets take the simplest. Processing the withdrawal calls ReduceBalance(accountId, amount) on some bank account ...


0

This is an old question, but in case you are still interested, you might look at Qore, which is an interpreted language with fundamental support for multithreading and also has a unique garbage collection approach (Prompt Collection) which allows for the language to support the RAII idiom (c++-like destructors for resource management and exception-safe ...


4

Look at the way TicketMaster and similar sites do it. What they do is take the item off the shelf for a brief period of time and start a transaction while the user consummates the payment. If the user fails to complete the payment during that brief period, the entire transaction is cancelled, the item goes back on the shelf, and the user has to start ...


0

That's the problem with mutable objects, that they can mutate. Quite obviously, if you managed to correctly serialise the state that your object has right now, it won't be the state that your object will have two seconds from now. So having the serialised state not match the current state must be acceptable, otherwise you have lost. If the changes to ...


0

I realize that your question is specifically about serialization, but I think you may be trying to solve the wrong problem here. I suggest you to think about whether you have separated concerns correctly in your application design. It may make more sense to consider the serialized state of a media file as a composition of some unique ID and some possibly ...


1

First of all I thank all the members who answered this question, especially Robert Harvey whose answer seems very close to mine. I have been researching on concurrency concepts for two years and according to my findings, no language provide guarantee that its concurrency constructs are composable. A perfectly good running code using immutable data ...



Top 50 recent answers are included