(keitai-l) Re: "i-appli taking long time connecting to servlet"

From: Peter Van der Weeen <pvanderweeen_at_cerego.co.jp>
Date: 06/10/05
Message-ID: <5B7792BCE2065647A133C5800CDF83801ABD6F@exchange.cerego.co.jp>
Time measurement is indeed a good point to start.

I'm not a Java servlet programmer but looking at the source below I
believe there are a few things you could take out of the for-loop.
No need to call getRealPath() 5 times. Idem dito for the getMimeType()
and setContentType()...

BTW, what's the spec of your server (hardware)?


Peter


-----Original Message-----
From: keitai-l-bounce@appelsiini.net
[mailto:keitai-l-bounce@appelsiini.net] On Behalf Of necrodome@gmail.com

have you debugged for time measurement for each operation?

what about implemetimg threads?

On 6/9/05, Kapil Sharma <kapes.endless@gmail.com> wrote:
> My servlet code looks like
> //sending 5 image files to outputstream
> 
> for(i=1;i<=5;i++)
> {
>        filename = sc.getRealPath("pic"+i+".jpeg" ;//get path of pic.
>        file = new File(filename);
>        mimeType = sc.getMimeType(filename);
>        resp.set ontentType(mimeType);
>        in = new FileInputStream(file);
>        count = in.read(buf);
>        out.writ (buf,0,count);
> }
>        in.close );
>        out.clos ();
> }
Received on Fri Jun 10 05:56:33 2005