**Framework Version** :- Teiid 8.13 with WildFly 9.0.2
Hello,
I am using Teiid Admin APIs and Teiid JDBC to connect to the Dynamic VDBs that are created.
Everything works fine, as expected but due to some application specific requirement i had to implement concurrent architecture using Akka actors. When i executed 2 DIFFERENT queries on SAME VDB, the results were SAME, which should NOT have been the case.
So i came up with a Java Thread example and it behaved the same way giving wrong result.
I have this `calculateRowCount()` which gives me row count of the Result Set
statement = makeConnection(); // Some method that establishes the connection
resultSet = statement.executeQuery(query);
resultSet.last();
return String.valueOf(resultSet.getRow());
The Multi-Threaded Test for this
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
String selectQuery = "SELECT * FROM TableName limit 5";
String actualCount = dataConnector.getQueryCount(selectQuery);
Assert.assertEquals(5, actualCount);
}
catch (Exception e) {
e.printStackTrace();
}
}});
Thread thread1 = new Thread(new Runnable() {
@Override
public void run() {
try {
String selectQuery = "SELECT * FROM TableName limit 15";
String actualCount = dataConnector.getQueryCount(selectQuery);
Assert.assertEquals(15, actualCount);
}
catch (Exception e) {
e.printStackTrace();
}}
});
thread.start();
thread1.start();
while ( thread.isAlive() || thread1.isAlive()){
}
System.out.println("DONE");
One of the `Assertion` will actually fail because both will return similar row counts.
I tried to dig out info on Multi-Thread configuration for Teiid but couldn't make anything work.
I have posted same question on stack overflow also multithreading - Teiid JDBC give same result set object for different queries - Stack Overflow