Skip to content
New issue

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

Simplify server startup and dagger usage #1601

Merged
merged 2 commits into from
Nov 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
review feedback
niloc132 committed Nov 23, 2021
commit 35b2dd1912b9629af9bcd65300ac83e16b8545ab
Original file line number Diff line number Diff line change
@@ -23,6 +23,10 @@
import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
* Entrypoint for the Deephaven gRPC server, starting the various engine and script components, running any specified
* application, and enabling the gRPC endpoints to be accessed by consumers.
*/
public class DeephavenApiServer {
private static final Logger log = LoggerFactory.getLogger(DeephavenApiServer.class);

@@ -57,7 +61,17 @@ public Server server() {
return server;
}

public void start() throws IOException, ClassNotFoundException, InterruptedException {
/**
* Starts the various server components, and blocks until the gRPC server has shut down. That shutdown is mediated
* by the ShutdownManager, and will call the gRPC server to shut it down when the process is itself shutting down.
* Only once that is complete will this method return.
*
* @throws IOException thrown in event of an error with logging, finding and running an application, and starting
* the gRPC service.
* @throws ClassNotFoundException thrown if a class can't be found while finding and running an application.
* @throws InterruptedException thrown if this thread is interrupted while blocking for the server to halt.
*/
public void run() throws IOException, ClassNotFoundException, InterruptedException {
// Stop accepting new gRPC requests.
ProcessEnvironment.getGlobalShutdownManager().registerTask(ShutdownManager.OrderingCategory.FIRST,
server::shutdown);
Original file line number Diff line number Diff line change
@@ -58,6 +58,6 @@ public static void main(String[] args) throws IOException, InterruptedException,
.withErr(PrintStreamGlobals.getErr())
.build()
.getServer()
.start();
.run();
}
}