mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
= code cleanup
- for loop replaceable with enhanced 'for' loop - using diamond in generic type - collapse try catch exception - using try-with-resource - using List#sort instead of Collections#sort - replaced lambda with method reference - using native compare method to compare numbers - using switch instead of if for in ESSyncUtil
This commit is contained in:
@@ -12,8 +12,7 @@ import com.taobao.tddl.dbsync.binlog.LogEvent;
|
||||
public class FetcherPerformanceTest {
|
||||
|
||||
public static void main(String args[]) {
|
||||
DirectLogFetcher fetcher = new DirectLogFetcher();
|
||||
try {
|
||||
try (DirectLogFetcher fetcher = new DirectLogFetcher()) {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306", "root", "hello");
|
||||
Statement statement = connection.createStatement();
|
||||
@@ -40,11 +39,6 @@ public class FetcherPerformanceTest {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
fetcher.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user