-
1. Re: Locking, Transaction, SFSB, 2 apps
wdfink Dec 6, 2011 4:52 AM (in response to braca)As long you use a DB inside the transaction and lock the table (row) you will have such behaviour.
The application(s) are not very scalable.
You should decouple the key generation and use a different for each app.
Or you might cache a couple of keys in each application outside this transactions (i.e. use a new transaction to refill the internal cache)
Drawback is that you might loose some keys if the server goes down or crash.
-
2. Re: Locking, Transaction, SFSB, 2 apps
braca Dec 6, 2011 8:07 AM (in response to wdfink)Thanks for the hint. I solved the problem - as you suggested - by creating a new transaction when generating the key.
@TransactionAttribute( TransactionAttributeType.REQUIRES_NEW )
public Long findKeyAndSaveKey(){
}
That's ok because this method is called only once per session and further keys are generated using an algorithm.