(improvement)(headless) refactor duck source configure (#1170)

This commit is contained in:
jipeli
2024-06-20 14:24:18 +08:00
committed by GitHub
parent 0d9afb5d87
commit 9e72d239f1
5 changed files with 90 additions and 54 deletions

View File

@@ -36,6 +36,7 @@ public class FlightSqlListener implements CommandLineRunner {
private ExecutorService executorService;
private FlightServer flightServer;
private BufferAllocator allocator;
private Boolean isRunning = false;
public FlightSqlListener(FlightService flightService) {
this.allocator = new RootAllocator();
@@ -60,12 +61,27 @@ public class FlightSqlListener implements CommandLineRunner {
try {
log.info("Arrow Flight JDBC server started on {} {}", host, port);
flightServer.start();
isRunning = true;
} catch (Exception e) {
log.error("FlightSqlListener start error {}", e);
}
}
public Boolean isRunning() {
return isRunning;
}
public void stop() {
try {
log.info("Arrow Flight JDBC server stop on {} {}", host, port);
flightServer.close();
allocator.close();
} catch (Exception e) {
log.error("FlightSqlListener start error {}", e);
}
}
@Override
public void run(String... args) throws Exception {
if (enable) {