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.
|
Copyright © 2013. All rights reserved.