Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
mxdzs0612 committed Nov 11, 2024
1 parent b89f51f commit c52aaf4
Showing 1 changed file with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public void testAlterHiveTableParameters() {
}

@Test
public void testHiveClient() {
public void testListTablesLock() {
try {
String databaseName = "test_db";
catalog.createDatabase(databaseName, false);
Expand All @@ -300,22 +300,28 @@ public void testHiveClient() {
List<String> tables1 = new ArrayList<>();
List<String> tables2 = new ArrayList<>();

Thread thread1 = new Thread(() -> {
System.out.println("First thread started at " + System.currentTimeMillis());
try {
tables1.addAll(catalog.listTables(databaseName));
} catch (Catalog.DatabaseNotExistException e) {
throw new RuntimeException(e);
}
});
Thread thread2 = new Thread(() -> {
System.out.println("Second thread started at " + System.currentTimeMillis());
try {
tables2.addAll(catalog.listTables(databaseName));
} catch (Catalog.DatabaseNotExistException e) {
throw new RuntimeException(e);
}
});
Thread thread1 =
new Thread(
() -> {
System.out.println(
"First thread started at " + System.currentTimeMillis());
try {
tables1.addAll(catalog.listTables(databaseName));
} catch (Catalog.DatabaseNotExistException e) {
throw new RuntimeException(e);
}
});
Thread thread2 =
new Thread(
() -> {
System.out.println(
"Second thread started at " + System.currentTimeMillis());
try {
tables2.addAll(catalog.listTables(databaseName));
} catch (Catalog.DatabaseNotExistException e) {
throw new RuntimeException(e);
}
});

thread1.start();
thread2.start();
Expand All @@ -339,7 +345,6 @@ public void testHiveClient() {
assertThat(tables1).size().isEqualTo(100);
assertThat(tables1).containsAll(tables2);
assertThat(tables2).containsAll(tables1);

} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit c52aaf4

Please sign in to comment.