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();
}
#API-Management#webMethods#webMethods-Tamino-XML-Server-APIs