Tag Info

New answers tagged

1

There's a subtle distinction between the two. Let's take a look the following sample code. public class Foo { private static Object lockFunction = new Object(); private static Bar myBar = new Bar(); public void fooFunc(float someValue) { synchronized (lockFunction){ //locking against the function ...


1

At the end it seems necessary that the cache service also needs some optimistic concurrency implementation. Instead of blindly writing whatever "new" version the application has to the cache tier, it must first retrieve a copy (if cached) to determine the cached version and current optimistic concurrency key. E.g. Couchbase Server provides CAS values; ...


2

You can introduce an expiry column for your pins. Once you query the pin table to see if your pin is valid (and not expired), you update that expiry date to current time. If your API call succeeds, No further action is required and you have a record of what has happened (you have only done one db write). If the API call fails, you need to go set the expiry ...


0

If your PIN is valid only once, then why don't you write the stored procedure using DELETE INTO so that, given the proper isolation level, you know the PIN can be used exactly once. Then you query the temp table you inserted into to see if it has any values--if it does, the PIN is valid. That way you can eliminate step 4 entirely.


2

There are two main types of multitasking: Cooperative - where code explicitly calls a function to say "do something else now" Pre-emptive - where the threading system automatically stops one thread to allow another to run These days, most multitasking code is pre-emptive, although event driven code (e.g. Twisted) is cooperative. I do remember using ...



Top 50 recent answers are included