Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Session cleanup question Post Reply Post New Topic
Author Message
solmyr72
Newbie
Newbie


Joined: 17 Mar 2011
Location: Israel
Online Status: Offline
Posts: 3
Quote solmyr72 Replybullet 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:
ReportClientDocument clientDoc = new ReportClientDocument();
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?

Thansk
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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.
 
-Dell
IP IP Logged
solmyr72
Newbie
Newbie


Joined: 17 Mar 2011
Location: Israel
Online Status: Offline
Posts: 3
Quote solmyr72 Replybullet 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).

Thanks :)
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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.
 
-Dell
IP IP Logged
solmyr72
Newbie
Newbie


Joined: 17 Mar 2011
Location: Israel
Online Status: Offline
Posts: 3
Quote solmyr72 Replybullet Posted: 20 Mar 2011 at 8:18pm
Thanks so much :)
IP IP Logged
Printable version Printable version

Forum Jump
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