Singletone bean, concurrency and transactions
Posted: Tue Oct 01, 2013 6:48 am
Hi Paul,
I've passed an exam today 95% and found a new question regarding Singletone bean.
Could you please explain how does work the concurrency and transactions together for singletone bean.
The question was following:
We have an Singletone bean and two threads try to access firstMethod() simultaneously. How many transactions will be created?
Answers: 0 or 1 or 2
@Singleton
@Lock(LockType.READ)
public class PoJo {
public void firstMethod () { ... }
public void secondMethod () { ... } // Lock (Read) class level
}
Thanks in advance,
Alex
I've passed an exam today 95% and found a new question regarding Singletone bean.
Could you please explain how does work the concurrency and transactions together for singletone bean.
The question was following:
We have an Singletone bean and two threads try to access firstMethod() simultaneously. How many transactions will be created?
Answers: 0 or 1 or 2
@Singleton
@Lock(LockType.READ)
public class PoJo {
public void firstMethod () { ... }
public void secondMethod () { ... } // Lock (Read) class level
}
Thanks in advance,
Alex