Re: Process big Object in java
On 1=D4 7=C8=D5, =CF =CE=E76=CA=B134=B7=D6, Roedy Green <see_webs...@min=
dprod.com.invalid>
wrote:
On Mon, 7 Jan 2008 00:39:55 -0800 (PST), Colin Song
<song6...@gmail.com> wrote, quoted or indirectly quoted someone who
said :
I think maybe in the process,java generate many big temp
Object.How to optimization this kind of programme?
seehttp://mindprod.com/jgloss/sscce.html
in my program,I use junit testcase call a webservice,and this
webservice call another webservice(I call it service provider).
code:
in junit testcase(web service client):
StringBuffer request = new StringBuffer();
String str = "!@#$%^ *<>";//10Byte
for(int j=0;j<1000000;j++)
{
request.append(str); //10MB
}
CommonServicePortClient proxy=new CommonServicePortClient();//
webservice client
proxy.sendRequest(request.toString());
in server side(webservice deployed on OC4J):
this webservice only pass parameter to another webservice(service
provicer),it is a common service,give a single interface to
customer,the implement :
public XXXXResponseDTO sendRequest(String request) throws
RemoteException,
FWServiceException {
XXXXServicePortClient proxy = null;
try {
proxy = new XXXXServicePortClient();
} catch (Exception e) {
e.printStackTrace();
}
// cast ,set url,so I can call many different service provider
XXXXServiceBinding_Stub stub = (XXXXServiceBinding_Stub) proxy
.getPort();
stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,
this.getRequestType()
.getUrl());
// call service
return proxy.sendRequest(request);
}
Now the service provider just return the request(big String ....).
and my webservice and service provider is on the same oc4j.