We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
final File[] files = this.logFile.getParentFile().listFiles(new FilenameFilter() { @Override public boolean accept(final File dir, final String name) { return name.startsWith(logFileName); } }); Arrays.sort(files, Collections.reverseOrder());
final SQLTransaction<Integer> transaction = transOperator -> { uploadLogFile(transOperator, execId, name, attempt, files, this.defaultEncodingType); transOperator.getConnection().commit(); return 1; }; try { this.dbOperator.transaction(transaction); } catch (final SQLException e) { logger.error("uploadLogFile failed.", e); throw new ExecutorManagerException("uploadLogFile failed.", e); } public <T> T transaction(final SQLTransaction<T> operations) throws SQLException { Connection conn = null; try { conn = this.queryRunner.getDataSource().getConnection(); conn.setAutoCommit(false); final DatabaseTransOperator transOperator = new DatabaseTransOperator(this.queryRunner, conn); final T res = operations.execute(transOperator); conn.commit(); return res; } catch (final SQLException ex) { // todo kunkun-tang: Retry logics should be implemented here. logger.error("transaction failed", ex); if (this.dbMetrics != null) { this.dbMetrics.markDBFailTransaction(); } throw ex; } finally { DbUtils.closeQuietly(conn); } } @FunctionalInterface public interface SQLTransaction<T> { public T execute(DatabaseTransOperator transOperator) throws SQLException; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
遍历目录找到想要的日志文件
经典的回调函数写法
The text was updated successfully, but these errors were encountered: