abdon Posted August 4, 2010 Share Posted August 4, 2010 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 More sharing options...
abdon Posted August 5, 2010 Author Share Posted August 5, 2010 Let me try to explain the situationIn 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 More sharing options...
lucianc Posted August 9, 2010 Share Posted August 9, 2010 That should work fine. Just make sure that the virtualizer max page argument is bigger than the number of reports that will be using it.HTH,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now