on 04-08-2009 5:15 PM
I have implemented a standalone JCo-Client which has to make multiple calls to the same BAPI.
Java 1.5
SAP JCo 3.01
Windows Server 2003
Now I have the problem that each BAPI-Call opens a new network connection (checked with netstat). I use a pooled connection, I have only one JCoDestination object and one JCoFunction object on which I do many function.execute(destination).
Under JCO 2 i used a ClientPool and didn't have the increasing number of network connections.
Any ideas how to solve this.
I add the rump coding so you get the idea:
String destinationName = "ConnPool";
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "XXX");
...
connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "5");
connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "5");
createDestinationDataFile(destinationName, connectProperties);
int count = 0;
try {
JCoDestination destination = JCoDestinationManager.getDestination(destinationName);
JCoFunction function = destination.getRepository().getFunction("BAPI_NAME");
if (function == null)
throw new RuntimeException("BAPI not found in SAP.");
do {
count++;
try {
JCoStructure importStruktur = function.getImportParameterList().getStructure("IMPORT");
...
function.execute(destination);
JCoStructure exportStruktur = function.getExportParameterList().getStructure("EXPORT");
...
}
catch (AbapException e) {
System.out.println(e.toString());
}
} while (count < 50000);
}
catch(JCoException ex) {
System.out.println(ex.toString());
}
Edited by: Jochen Lang on Apr 29, 2009 1:30 PM
Further testing showed that Pooling connections doesn't affect the number of actual network connections generated.
But with encapsulating the numerous function-calls into a Stateful Connection via
JCoContext.begin(destination);
...lots of function calls...
JCoContext.end(destination);
only one network connection would be used. Sadly I can't use this in my actual application.
Your comments and experiences to this are appreciated!
Greetings Jochen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.