public class ReadWriteLockProxyFactory<T> extends Object
ReentrantReadWriteLock
based
on the ReadLock
and WriteLock
annotations. The annotations must be
applied to the service implementation methods. Annotations on the interfaces are ignored.
It uses fair read-write locking.
For example:
class Service implements MyApi { @ReadLock void doX() { ... } @WriteLock void doY() { ... } // no locking by default void doZ() { ... } } // create service Service svc = new Service(); // create service guarded by read-write locking. MyApi guardedSvc = new ReadWriteLockProxyFactory().getProxy(svc, MyApi.class);
Constructor and Description |
---|
ReadWriteLockProxyFactory()
Constructs the factory.
|
Modifier and Type | Method and Description |
---|---|
T |
getProxy(T aService,
Class... aInterfaces)
Gets the proxy that delegates to the thread-specific instance set by
#set(Object)
When at runtime the proxy cannot find lookup the object in JNDI, it
throws LookupException . |
Copyright © 2024. All rights reserved.