I have a ServletFilter which sets up an identity object for each request.
Previously it was stored with setAttribute, but now I use a threaded
HiveMind service. So far it has worked just fine, but I can't seem to get
the _Discardable_ functionality to work properly.
PersonalIdentity extends Discardable. The first step I tried was to insert a
logging statement in void threadDidDiscardService().
Nothing happened!
Eventually I tried to just call a function on PersonalIdentity, which seemed
to work, and moreover it now threadDidDiscardService got called.
Does Tapestry do some threaded housecleaning in ApplicationServlet?
I suppose that I am missing something obvious, or just making a basic
blunder. But which one?
Thanks,
Henrik
The filter looks something like this:
try {
if (firstRegistry == null) {
firstRegistry = (Registry)
context.getAttribute("org.apache.tapestry.Registry:portalapp");
}
if (firstRegistry != null) {
logger.debug("Pushed PersonalIdentity to registry
"+firstRegistry.hashCode());
PersonalIdentity ident = (PersonalIdentity)
firstRegistry.getService(PersonalIdentity.class);
...
}
chain.doFilter(req,res);
}
finally {
if (firstRegistry != null) {
// PersonalIdentity ident = (PersonalIdentity)
firstRegistry.getService(PersonalIdentity.class);
// ident.saveChanges();
// ident = null;
firstRegistry.cleanupThread();
}
long processingTime = System.currentTimeMillis() - startTime;
webApp.publishEvent(new RequestHandledEvent(
this,req.getRequestURI(),processingTime,req.getRemoteAddr(),
req.getMethod(),null
));
}
The registration for ident is:
<service-point id="Identity"
interface="com.bluprinted.personal.market.PersonalIdentity">
<invoke-factory model="threaded">
<construct
class="com.bluprinted.personal.market.PersonalIdentityImpl"></construct>
</invoke-factory>
</service-point>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]