Joined: 17 Mar 2011
Location: Israel
Online Status: Offline
Posts: 3
Topic: Session cleanup question Posted: 17 Mar 2011 at 12:34am
Hi,
We're using Crystal reports in Java (deployed as a Servlet under Tomcat 6). We're facing a problem with "ReportClientDocument" cleanup.
Say we have: ReportClientDocumentclientDoc =newReportClientDocument(); clientDoc.open(reportName, options);
We discovered that we must call clientDoc.close() at *some* point, otherwise our application runs out of memory. On the other hand we can't close it too soon, because this break the pagination support.
Currently we store in on the Http Session, and use a SessionListener to call clientDoc.close() when session terminates.
This works fine, but I wanted to please ask: can we ask Crystal to recognize when the user closes the report window (pression "X" or "Alt-F4"), and close the client document then?
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Posted: 18 Mar 2011 at 9:38am
The problem stems from the fact that the java classes for Crystal, just like the .NET classes, are wrappers for COM objects. Unfortunately, COM objects generally do not have very good memory management, which is why you have to explicitly close the report. I think they're getting away from the COM base code with the next version of Crystal, but I'm not absolutely certain about it.
Joined: 17 Mar 2011
Location: Israel
Online Status: Offline
Posts: 3
Posted: 19 Mar 2011 at 8:39pm
Thanks very much for this insight.
But would you happen to know whether Crystal can *tell* when the user closes the report window (and then either cleanup the ReportDocumentClient itself, or at least issue some event I can listen to)?
Currently we cleanup on session-timeout, but we'd like to do it sooner (the minute the user closes the window).
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Posted: 20 Mar 2011 at 1:26pm
No, I don't believe there is an event on the viewer that will tell you when it's being closed. In ASP.NET, there is a "FormClosing" event handler that we use for handling this. I'm just starting to learn Java, so I'm not sure whether there's something there.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum