Hi,
Extract the locking managing code in a service.
Then use Spring/CDI/Guice/... to manage the service dependencies for you.
Martin Grigorov
Wicket Training and Consulting
On Mon, Feb 3, 2014 at 2:38 PM, ChambreNoire a...@tentelemed.com wrote:
Hey,
I've just been sketching out an entity
Hello,
OK so no storing my MapString, EntityLock in the Application MetaData
then?
Many thanks,
Chambre
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Accessing-WebApplication-from-the-service-layer-tp4664145p4664147.html
Sent from the Users forum mailing list
Well, you can either store it as application metadata or make your
locking service implementation a singleton (managed by your dependency
injection framework of choice).
Either way, you abstract away the exact storage location of your locks
behind the facade of your EntityLockingService.
Yes however I also store the id of the session that owns the lock in a map so
that I can easily flush locks when a user session expires. This would mean
that EntityLockService would need access to the current WebSession which
also seems messy...
Chambre
--
View this message in context:
class MyApp extends WebApplication {
@Inject EntityLockService lockService;
@Override
public void sessionUnbound(String sessionId) {
lockService.cleanup(sessionId);
}
}
Martin Grigorov
Wicket Training and Consulting
On Mon, Feb 3, 2014 at 3:09 PM, ChambreNoire a...@tentelemed.com wrote:
Yup that's exactly what I have done. My problem lies with the lock creation
in newEntityLock(PersistentEntity entity) which needs the session Id...
Chambre
--
View this message in context: