Skip to content

Commit

Permalink
Better handle of exceptions in work load in stress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed Dec 8, 2016
1 parent e9a6a2c commit f478c2f
Showing 1 changed file with 36 additions and 7 deletions.
Expand Up @@ -55,19 +55,48 @@ protected void doWork()
tx.success();
} );
}
catch ( InterruptedException e )
catch ( Throwable e )
{
// whatever let's go on with the workload
Thread.interrupted();
if ( isInterrupted( e ) || isTransient( e ) )
{
// whatever let's go on with the workload
return;
}

throw new RuntimeException( e );
}
catch ( TimeoutException | DatabaseShutdownException | TransactionFailureException e )
}

private boolean isTransient( Throwable e )
{
if ( e == null )
{
// whatever let's go on with the workload
return false;
}
catch ( Throwable e )

if ( e instanceof TimeoutException || e instanceof DatabaseShutdownException ||
e instanceof TransactionFailureException )
{
throw new RuntimeException( e );
return true;
}

return isInterrupted( e.getCause() );
}

private boolean isInterrupted( Throwable e )
{
if ( e == null )
{
return false;
}

if ( e instanceof InterruptedException )
{
Thread.interrupted();
return true;
}

return isInterrupted( e.getCause() );
}

static void setupIndexes( Cluster cluster )
Expand Down

0 comments on commit f478c2f

Please sign in to comment.