I am having multi threaded application running on multi tenant (separate physical boxes). One of functionality is to update balances for a customer in this scenario if there are two transactions Tr1 and Tr2 coming on separate tenants at same time t1 then its not updating balances correctly. i cant synchronize this as its a multi tenant so boundaries are JVM on a single machine.
Technologies : Spring, hibernate and MS SQL.
I want to block the application thread tr2 (thread on tenant 1) to read the data (of-course for same customer) and process it if tr1 (Thread on another tenant) thread is already working on it.