Jump to content
Changes to the Jaspersoft community edition download ×

Delay executing in network a jasperreport


Recommended Posts

By: anavarro - anavarrog

Delay executing in network a jasperreport

2006-03-10 10:25

Hi all. I have an application in which I use jasperReport. This application can work in local or network, but with one it differentiates significant at the time of visualizing and generating Report. When work in local is no problem, the problem comes when work in network and the file *.jasper is in the server, in which case, takes 20 times slower generating report that if the compiled file *.jasper were in local. The problem is greater when you have many report that to generate. Looking for in the code and with monitoring software I found the possible source of the problem. It is in the class and method JRLoader.loadObject(File cases out), concretely in the line of source "obj = ois.readObject();" , which reads the data of the file jasper from the server and generates the Jasper object. I have solved the problem but not if the correct form to do it. I have used the BufferedInputStream class instead of FileInputStream being the method loadObject of the following way:

public static Object loadObject(File file) throws JRException {

if (!file.exists() || !file.isFile()) {

throw new JRException(new FileNotFoundException(String.valueOf(file)));

}

 

Object obj = null;

BufferedInputStream fis = null;

ObjectInputStream ois = null;

 

try {

 

fis = new BufferedInputStream(new FileInputStream(file));

ois = new ObjectInputStream(fis);

obj = ois.readObject();

 

.....

....

..

 

The results are remarkable in speed. My question this solution is correct or if there is a solution better?

A greeting, anavarro.

 

 

 

By: Lucian Chirita - lucianc

RE: Delay executing in network a jasperreport

2006-03-13 02:00

Hi

 

The change you mention (using buffered streams when reading/writing files) was made on CVS about a month ago. You can check out the code from CVS and see whether it's ok..

 

If network transfer is a problem, you could also adopt the solution of compressing/decompressing the file. Still, this might not be suitable for *.jasper files as they are not very large usually.

 

Thanks,

Lucian

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...