@@ -296,17 +296,17 @@ public static class DBMSExecutor<G extends GlobalState<O, ?>, O extends DBMSSpec
296296 private final MainOptions options ;
297297 private final O command ;
298298 private final String databaseName ;
299- private final long seed ;
300299 private StateLogger logger ;
301300 private StateToReproduce stateToRepro ;
301+ private final Randomly r ;
302302
303303 public DBMSExecutor (DatabaseProvider <G , O > provider , MainOptions options , O dbmsSpecificOptions ,
304- String databaseName , long seed ) {
304+ String databaseName , Randomly r ) {
305305 this .provider = provider ;
306306 this .options = options ;
307307 this .databaseName = databaseName ;
308- this .seed = seed ;
309308 this .command = dbmsSpecificOptions ;
309+ this .r = r ;
310310 }
311311
312312 private G createGlobalState () {
@@ -324,10 +324,9 @@ public O getCommand() {
324324 public void run () throws SQLException {
325325 G state = createGlobalState ();
326326 stateToRepro = provider .getStateToReproduce (databaseName );
327- stateToRepro .seedValue = seed ;
327+ stateToRepro .seedValue = r . getSeed () ;
328328 state .setState (stateToRepro );
329329 logger = new StateLogger (databaseName , provider , options );
330- Randomly r = new Randomly (seed );
331330 state .setRandomly (r );
332331 state .setDatabaseName (databaseName );
333332 state .setMainOptions (options );
@@ -390,10 +389,10 @@ public O getCommand() {
390389 }
391390
392391 @ SuppressWarnings ("unchecked" )
393- public DBMSExecutor <G , O > getDBMSExecutor (String databaseName , long seed ) {
392+ public DBMSExecutor <G , O > getDBMSExecutor (String databaseName , Randomly r ) {
394393 try {
395394 return new DBMSExecutor <G , O >(provider .getClass ().getDeclaredConstructor ().newInstance (), options ,
396- command , databaseName , seed );
395+ command , databaseName , r );
397396 } catch (Exception e ) {
398397 throw new AssertionError (e );
399398 }
@@ -461,7 +460,6 @@ private String formatInteger(long intValue) {
461460 } else {
462461 seed = options .getRandomSeed () + i ;
463462 }
464-
465463 execService .execute (new Runnable () {
466464
467465 @ Override
@@ -471,17 +469,17 @@ public void run() {
471469 }
472470
473471 private void runThread (final String databaseName ) {
472+ Randomly r = new Randomly (seed );
474473 try {
475474 if (options .getMaxGeneratedDatabases () == -1 ) {
476475 // run without a limit
477476 boolean continueRunning = true ;
478477 while (continueRunning ) {
479- continueRunning = run (options , execService , executorFactory , seed , databaseName );
478+ continueRunning = run (options , execService , executorFactory , r , databaseName );
480479 }
481480 } else {
482481 for (int i = 0 ; i < options .getMaxGeneratedDatabases (); i ++) {
483- boolean continueRunning = run (options , execService , executorFactory , seed ,
484- databaseName );
482+ boolean continueRunning = run (options , execService , executorFactory , r , databaseName );
485483 if (!continueRunning ) {
486484 break ;
487485 }
@@ -496,8 +494,8 @@ private void runThread(final String databaseName) {
496494 }
497495
498496 private boolean run (MainOptions options , ExecutorService execService ,
499- DBMSExecutorFactory <?, ?> executorFactory , final long seed , final String databaseName ) {
500- DBMSExecutor <?, ?> executor = executorFactory .getDBMSExecutor (databaseName , seed );
497+ DBMSExecutorFactory <?, ?> executorFactory , Randomly r , final String databaseName ) {
498+ DBMSExecutor <?, ?> executor = executorFactory .getDBMSExecutor (databaseName , r );
501499 try {
502500 executor .run ();
503501 return true ;
0 commit comments