B4J Question Thread safe code in server application.

wl

Well-Known Member
Licensed User
Longtime User
Hi,

In a (Jetty) server application I would like to write some (cusom) thread safe code (so a single thread handler is too restrictive).

Can I use the threadsafe map for this in some sorts ?

Something like: when entering the threadsafe code I check for the existance of a key in the threadsafe map.
If it exists I retry ...
If it does not exist ...
I set the key, do some code, and remove the key

As checking the existence of the key and set a key value are two B4J commands/instructions, how can I make sure these are atomic ?

Thanks
 
Top