@Override
public Object call()
{
StoreConnection sConn = tts.getStoreConnection() ;
DatasetGraphTxn dsg = null ;
try {
int id = gen.incrementAndGet() ;
for ( int i = 0 ; i < repeats ; i++ )
{
log.debug("writer start "+id+"/"+i) ;
dsg = sConn.begin(ReadWrite.WRITE) ;
int x1 = count("SELECT * { ?s ?p ?o }", dsg) ;
int z = change(dsg, id, i) ;
pause(maxpause) ;
int x2 = count("SELECT * { ?s ?p ?o }", dsg) ;
if ( x1+z != x2 )
{
TransactionManager txnMgr = dsg.getTransaction().getTxnMgr() ;
SysTxnState state = txnMgr.state() ;
String label = dsg.getTransaction().getLabel() ;
log.warn(format("WRITER: %s Change seen: %d + %d != %d : id=%d: i=%d", label, x1, z, x2, id, i)) ;
log.warn(state.toString()) ;
dsg.abort() ;
dsg.end() ;
dsg = null ;
return null ;
}
if (commit)
dsg.commit() ;
else
dsg.abort() ;
SysTxnState state = sConn.getTransMgrState() ;
log.debug(state.toString()) ;
log.debug("writer finish "+id+"/"+i) ;
dsg.end() ;
dsg = null ;
}
return null ;
}
catch (RuntimeException ex)
{
ex.printStackTrace(System.err) ;
if ( dsg != null )
{
dsg.abort() ;
dsg.end() ;
dsg = null ;
}
return null ;
}
}