Re-launch Avoidance (JRAC) (version beta 1.0)

When a user in the GenomeSpace UI clicks a tool icon to launch it, and doesn't close the tool, and then later clicks the tool icon again, the tool should re-open the existing instance, and not start a second instance.

The way GenomeSpace and the tool coordinate to handle this is:

When the tool starts up, it open a socket on a predefined port number, and listens for an HTTP GET request.

When the user clicks a tool icon, the GenomeSpace UI (or another GenomeSpace tool capable of doing launches) will send a HTTP GET request to that tool's predefined port.

If the user does a launch on file, then the GenomeSpace UI passes the filename as a query parameter on the HTTP GET url.

These CDK classes implement and test an example of JRAC relaunch:

SimpleWebServer opens the server socket demon.

GSLoadEventListener is an Observer class that gets called when a GET request arrives.

Port are pre-defined in GenomeSpace database and can be hardcoded in the GenomeSpace tool for use when it starts its socket listener. The predefined port numbers neither depend on the local machine nor are configurable after the initial selection. Port numbers currently used are:

60151 (IGV)

60161 (Cytoscape)

60171 (Genomica)

60181 (geWorkbench)

A tool should not respond to HTTP GET requests on port belonging to another tool.

Relaunch URL

The GenomeSpace UI (or another GenomeSpace tool capable of doing launches) creates a url for the HTTP GET request in the form