Package org.kiwiproject.eureka
Class EmbeddedEurekaServer
- java.lang.Object
-
- org.kiwiproject.eureka.EmbeddedEurekaServer
-
public class EmbeddedEurekaServer extends Object
Creates, configures, starts and stops an embedded Jetty server running a Eureka Server.If using this class outside of
EurekaServerExtension
then you may want to set the eureka.numberRegistrySyncRetries to zero in the System properties. This will allow the server to spin up quickly an not try to connect to other non-existent Eureka servers. See https://github.com/Netflix/eureka/issues/42#issuecomment-75614903 for dialog on this.
-
-
Constructor Summary
Constructors Constructor Description EmbeddedEurekaServer()
EmbeddedEurekaServer(String basePath)
Creates a new EmbeddedEurekaServer allowing Jetty to pick an available port.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getEurekaPort()
Retrieves the port that the server is listening on.boolean
isStarted()
Returns whether the server is running or not.boolean
isStopped()
void
start()
Starts the server.void
stop()
Stops the server.
-
-
-
Constructor Detail
-
EmbeddedEurekaServer
public EmbeddedEurekaServer()
-
EmbeddedEurekaServer
public EmbeddedEurekaServer(String basePath)
Creates a new EmbeddedEurekaServer allowing Jetty to pick an available port.- Parameters:
basePath
- the context path for the JettyWebAppContext
-
-
Method Detail
-
start
public void start()
Starts the server.
-
stop
public void stop()
Stops the server.- Throws:
IllegalStateException
- when the server is not running.
-
getEurekaPort
public int getEurekaPort()
Retrieves the port that the server is listening on.- Returns:
- the server port.
-
isStarted
public boolean isStarted()
Returns whether the server is running or not.- Returns:
- true if the server is running, false otherwise.
-
isStopped
public boolean isStopped()
-
-