Is there a problem with Java API ???

The following code which is taken directly from the documentation’s examples of Tamino Java API also crashes Tamino. Basically I am calling the function connectToTamino 1000000 times to open a connection to Tamino and I close it. However it seems that Tamino cannot catch up with the speed so eventually it crashes at somepoint in the loop. Putting a delay somewhere in this loop fixes the problem, but this is not an acceptable solution for me. Whats wrong here please respond!! :evil:

public class TaminoCommon {

public static String DATABASE_URI = “http://localhost/tamino/XXXX”;
public TConnectionFactory connectionFactory = null;
public boolean processed = false;
public TConnection connection = null;
public TLocalTransaction myTransaction = null;

public TXMLObjectAccessor connectToTamino()
{

TXMLObjectAccessor accessor = null;

try {
TaminoRescue rescue = new TaminoRescue();
connectionFactory = TConnectionFactory.getInstance();
connection = connectionFactory.newConnection( DATABASE_URI );
myTransaction = connection.useLocalTransactionMode();
connection.setLockMode(TLockMode.PROTECTED);

try
{
if ( !checkServerAndPrintSystemInformation( connection ) )
return null;

accessor = connection.newXMLObjectAccessor(
TAccessLocation.newInstance( "MARS" ),
TDOMObjectModel.getInstance() );

}
catch (TException taminoException) {
if (myTransaction != null) myTransaction.rollback();
taminoException.printStackTrace();
}
}

catch(Exception e) {e.printStackTrace();
}

return accessor; 

}

public static void main(String[] args) throws TException {

TaminoCommon test = new TaminoCommon();
String r = null;
for(int y = 0; y < 1000000; y++)
{
TXMLObjectAccessor tacc = test.connectToTamino();
test.connection.close();

// or you can put
while(!test.connection.isClosed()) test.connection.close();
}

Hello,
Would you please report this problem to your local Software AG Customer Support Centre. They will need details of the Tamino version you are using, and they will be able to help.
Thanks and best regards,
Bill

Can you please look at my previous post? The code above may fail actually with SQL Server because it may exhaust the database due to the size of the loop. However, Java Api’s also fail when you open only one connection and keep updating a node or when you try to read a value from a schema. Without giving a delay of at least 1000ms these APIs fail!

I’ve also contacted my local Software AG and they will contact Germany I believe. There might be also a good possibility that I am doing something wrong in the code, but the codes that I modified are directly taken from Software AG’s documentation. We have also tried to patch the Tamino to the latest version of 4.4.1 and used the newest Java APIs but it fails. And this is the most basic example I am giving you. Think about the following scenario:

Some data is retrieved from a different database system and it will be inserted as a node by XQuery methods (also shown in Tamino doc and I also asked this in the forum). Now lets say the structure looks like this:





Let say you want to add node to and lets say you will add another after the first you’ve just added. What will happen with XQuery is that you will get an nested exception error if you don’t put a delay of couple 1000ms between your two updates. Because the first node you’ve just committed is actually not commited yet even though if you are using manual commit!

The scenario above is the biggest problem I have, my code is surrounded with delays. Sometimes these delays don’t seem to work and worst thing happens the database shutsdown itself which is totally not acceptable!!!
The Tamino version we are using is 4.4.1, tried to patch 4.4.1.3 but did not help. Used the latest SDK which came with 4.4.1.3 also failed. This version of Tamino is installed on customer’s PC with Windows 2003 Platform also failed, with Windows XP also failed.

I got the answer for this problem. The TCP/IP paramaters must be altered in order to correct this problem.

In Windows Registry please locate HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters

You need to add two keys here if they dont exist

Key: MaxUserPort
Description: Determines the highest port number TCP is permitted to assign when an application requests an available user port from the system.
Range: 5000 - 65534

This one I set to 65534

Key: TcpTimedWaitDelay
Description: Determines the time that must elapse before TCP can release a closed connection and reuse its resources.
Range: 30 - 300

This one I set to 30

It works great right now, and I hope it won’t fail again.
Thanks.