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

Cannot shutdown WebfilesServer #566

Open
ptmphuong opened this issue Dec 8, 2022 · 0 comments
Open

Cannot shutdown WebfilesServer #566

ptmphuong opened this issue Dec 8, 2022 · 0 comments

Comments

@ptmphuong
Copy link
Contributor

ptmphuong commented Dec 8, 2022

The WebfilesServer currently lacks a shutdown method.

Simply shutting down the ExecutorService that runs the server doesn't work:

  public static void main(String[] args) throws Exception {
    ExecutorService executor = Executors.newCachedThreadPool();
    WebfilesServer server =
        DaggerWebfilesServer_Server.builder()
            .args(ImmutableList.of(serverConfig))
            .executor(executor)
            .fs(FileSystems.getDefault())
            .serverSocketFactory(ServerSocketFactory.getDefault())
            .build()
            .server();

    server.spawn();
    executor.shutdownNow();

    // at this point, the server is still running
  }

WebfilesServer also contains MetadataLoader and MetadataReloader instances that also implement Runnable and loop infinitely. Some work needs to be done to break the loops and release the resources properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant