Class RemoteWorkspaceServer

java.lang.Object
aQute.bnd.remoteworkspace.server.RemoteWorkspaceServer
All Implemented Interfaces:
Closeable, AutoCloseable

public class RemoteWorkspaceServer extends Object implements Closeable
Implements an RPC interface to a workspace. When a workspace is created then it can create a Remote Workspace Server to allow remote access.

This server will register the ephemeral port it uses in the cnf/cache/remotews directory so that it can be found by clients. This registration is deleted when the process properly exits.

  • Field Details

    • logger

      final org.slf4j.Logger logger
    • server

      final Closeable server
    • remotewsPort

      final File remotewsPort
    • workspace

      final Workspace workspace
    • registerPort

      final ScheduledFuture<?> registerPort
    • startingTime

      private final long startingTime
  • Constructor Details

    • RemoteWorkspaceServer

      public RemoteWorkspaceServer(Workspace workspace) throws UnknownHostException, IOException
      Create a new Remote Workspace Server. This will create a server socket on a random port. The protocole over this socket is defined by the RemoteWorkspace interface. The port number will be registered in cnf/cache/remotews/<portnr>. That is, it is possible to have multiple workspaces open on the system workspace. (Locking between workspaces is not handled though.)
      Parameters:
      workspace - the given workspace
      Throws:
      UnknownHostException
      IOException
  • Method Details

    • register

      void register()
    • close

      public void close() throws IOException
      Close the server. This generally happens when the corresponding workspace is closed. It will release the ephemeral port and delete the registration file.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException