[
Lists Home |
Date Index |
Thread Index
]
another optimization strategy(which will further optimize my program,
in addition to suggestions Pete gave) strikes me..
My program(the most current version) has this high level structure -
for(;;)
{
//1. Get XML from remote host
//2. Parse it completely and create a bulkier XML response message
//3. Send response to users : SenderHelper.send(xml_string);
//4. Set pooling interval of 5 seconds
Thread.sleep(5*1000);
}
Thats it basically..
I have a helper class SenderHelper which has a public static method
send(String xml)
SenderHelper.Send() does:
HTTPConnection con = new HTTPConnection("host"); //open HTTP
connection to remote host
HTTPResponse resp = con.Post("/service-url", form_data); //post to URL
If I make this statement "public static field" of class SenderHelper,
HTTPConnection con = new HTTPConnection("host")
Then it would not be created again-and-again for each invocation of
SenderHelper.Send() and a significant optimization will happen ..
BUT I have a doubt here..
If I make this statement "public static field"
HTTPConnection con = new HTTPConnection("host")
Would the HTTPConnection have some timeout? i.e. would it close after
some "inactive interval" ? If yes, can I make it infinitely
persistent..?
Any thoughts please?
Best regards,
> I implemented your suggestions in my application ..
> 1) Sending a bulkier message (there was a mechanism in the API) - now
> I am opening only 1 HTTP connection "per response" from remote
> service.
> 2) Reducing pooling interval to 5 seconds
>
> Thank you (and to all who answered my questions) ..
>
> I am happy with the performance of my application.
>
> best regards,
>
> >
> > > Pete
> > >
> > > ********************************************************************
> > > This email and any attachments are confidential to the intended
> > > recipient and may also be privileged. If you are not the intended
> > > recipient please delete it from your system and notify the sender.
> > > You should not copy it or use it for any purpose nor disclose or
> > > distribute its contents to any other person.
> > > ********************************************************************
> > >
> >
>
|