/** * Start the thread. * * @return this */ public Task execute() { return execute(getClass().getName() + ":" + counter.getAndIncrement()); }
@Override public void run() { try { call(); } catch (Exception e) { this.ex = e; } finished = true; }
@Override public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } };
/** * Calling this method will set the stop flag and wait until the thread is * stopped. * * @return the result, or null * @throws RuntimeException if an exception in the method call occurs */ public Object get() { Exception e = getException(); if (e != null) { throw new RuntimeException(e); } return result; }
task.execute(); return new BufferedOutputStream(out); } catch (Exception e) {
@Override public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } };
task.execute(); return IOUtils.getBufferedWriter(out); } catch (Exception e) {