I am trying to achieve the following :
EJB3 Singleton
@Singleton
@Startup
public class SomeSingleton implements SomeSingletonLoca
A @Singleton
is indeed by default read/write locked. This is not strictly related to transactions, but to concurrency. See also a.o. Java EE 7 tutorial on the subject.
One way to solve it is to set the @ConcurrencyManagement to BEAN. This way you basically tell the container to not worry about concurrency at all and that you take all responsibility on your own.
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class SomeSingleton {}
Another way is to explicitly set @Lock to READ on the class or the read-only methods so that they can concurrently be invoked. Only when a method with an explicit @Lock(LockType.WRITE)
is invoked on the same instance, then the lock will occur.
@Singleton
@Lock(LockType.READ)
public class SomeSingleton {}