private static <T> T getFuture(final String comment, final Future<T> future) { try { return Uninterruptibles.getUninterruptibly(future); // No need to catch cancellationexception - we never cancel these futures } catch (ExecutionException e) { Throwable t = e.getCause(); if (t instanceof SQLiteException) { final RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode()); sqlException.initCause(e); throw sqlException; } else { throw new RuntimeException(e); } } }
public <T> T execute(final String comment, final Callable<T> work) { try { return Uninterruptibles.getUninterruptibly(dbExecutor.submit(work)); // No need to catch cancellationexception - we never cancel these futures } catch (ExecutionException e) { Throwable t = e.getCause(); if (t instanceof SQLiteException) { RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode()); sqlException.initCause(e); throw sqlException; } else { throw new RuntimeException(e); } } }
public <T> T execute(final String comment, final Callable<T> work) { try { return Uninterruptibles.getUninterruptibly(dbExecutor.submit(work)); // No need to catch cancellationexception - we never cancel these futures } catch (ExecutionException e) { Throwable t = e.getCause(); if (t instanceof SQLiteException) { RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode()); sqlException.initCause(e); throw sqlException; } else { throw new RuntimeException(e); } } }
private static <T> T getFuture(final String comment, final Future<T> future) { try { return Uninterruptibles.getUninterruptibly(future); // No need to catch cancellationexception - we never cancel these futures } catch (ExecutionException e) { Throwable t = e.getCause(); if (t instanceof SQLiteException) { final RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode()); sqlException.initCause(e); throw sqlException; } else { throw new RuntimeException(e); } } }
private static <T> T getFuture(final String comment, final Future<T> future) { try { return Uninterruptibles.getUninterruptibly(future); // No need to catch cancellationexception - we never cancel these futures } catch (ExecutionException e) { Throwable t = e.getCause(); if (t instanceof SQLiteException) { final RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode()); sqlException.initCause(e); throw sqlException; } else { throw new RuntimeException(e); } } }