Jump to content
We've recently updated our Privacy Statement, available here ×

Are instances of JRFileVirtualizer reusable?


abdon

Recommended Posts

Is it safe (and thread-safe) to reuse an instance of JRFileVirtualizer (or any other JRVirtualizer implementation, for what is worth)?

In my code, I create a new instance every time I'm going to call some JasperFillManager's "fill" method. Could I use the same instance for every "fill" call?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Let me try to explain the situation

In my code, I create a JRFileVirtualizer evertime I'm going to fill a report, like this:

JRVirtualizer virtualizer = new JRFileVirtualizer(50,System.getProperty("java.io.tmpdir"))
Map parameters = new HashMap();
parameters.put(JRParameter.REPORT_VIRTUALIZER,virtualizer);
InputStream reportInputStream = ...
jasperPrint = JasperFillManager.fillReport(reportInputStream, parameters);

My question is, am I allowed to reuse the same virtualizer for other calls to JasperFillManager.fillReport? Like in:

JRVirtualizer virtualizer = this.virtualizer; //same instance every time!!
Map parameters = new HashMap();
parameters.put(JRParameter.REPORT_VIRTUALIZER,virtualizer);
InputStream reportInputStream = ...
jasperPrint = JasperFillManager.fillReport(reportInputStream, parameters);

Bruno Abdon

 



Post Edited by abdon at 05/08/2010 11:48
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...