Package org.eclipse.epsilon.eol.dap
Class EpsilonDebugServer
java.lang.Object
org.eclipse.epsilon.eol.dap.EpsilonDebugServer
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
ReusableEpsilonDebugServer
Network-based server for the debug adapter protocol, which listens via TCP at
a given host and port, and exposes a given IEolModule
.
The module should be fully configured the first time that someone connects to
this server. The server will automatically call IEolModule.execute()
the first time that anyone connects to it.
An instance of this class can only be run()
once. If you need to
restart the server, you will need to create another instance. After
run()
completes, the result of executing the module will be
available via getResult()
.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEpsilonDebugServer
(IEolModule module, int port) Convenience version ofEpsilonDebugServer(IEolModule, String, int)
for listening at the loopback address (i.e.EpsilonDebugServer
(IEolModule module, String host, int port) Creates a new instance, without starting the server. -
Method Summary
Modifier and TypeMethodDescriptiongetHost()
Returns theRunnable
to be executed in its own thread once the server is started.int
getPort()
Returns a Future which will contain the result of running the Epsilon script.Returns a Future that can be used to check if the server has started and if it has started successfully, or wait until that moment.protected void
onAttach()
Starts the module in a background thread upon first attachment.void
run()
Runs the server in the current thread.protected void
Runs the module, and shuts down the server when execution completes (whether successfully or unsuccessfully).void
setOnStart
(Runnable onStart) Sets theRunnable
to be executed in its own thread once the server is started.void
shutdown()
Shuts down the server, if it was listening.
-
Field Details
-
module
-
-
Constructor Details
-
EpsilonDebugServer
Convenience version ofEpsilonDebugServer(IEolModule, String, int)
for listening at the loopback address (i.e.localhost
). -
EpsilonDebugServer
Creates a new instance, without starting the server.- Parameters:
module
- Module to be debugged.port
- Port to listen on, or0
to use an available port from an ephemeral range.
-
-
Method Details
-
run
public void run()Runs the server in the current thread. In the absence of server errors, this method will block until a DAP client has attached to the module, and the module has completed its execution. -
onAttach
protected void onAttach()Starts the module in a background thread upon first attachment. Needed because modules don't track the fact that they are running themselves. -
runModule
protected void runModule()Runs the module, and shuts down the server when execution completes (whether successfully or unsuccessfully). -
isStarted
Returns a Future that can be used to check if the server has started and if it has started successfully, or wait until that moment. -
shutdown
public void shutdown()Shuts down the server, if it was listening. Will not do anything if the server is not listening or has already been shut down. -
getDebugAdapter
-
getHost
-
getPort
public int getPort() -
getModule
-
getOnStart
Returns theRunnable
to be executed in its own thread once the server is started. -
setOnStart
Sets theRunnable
to be executed in its own thread once the server is started. -
getResult
Returns a Future which will contain the result of running the Epsilon script. This result may be a regular object (equivalent to the value returned byIEolModule.execute()
), or an exception thrown by it.
-