Show the worker-id when the worker starts.
This commit is contained in:
parent
714938531b
commit
cc55354e73
|
@ -31,10 +31,17 @@ public class UrlsWorkerApplication {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(UrlsWorkerApplication.class);
|
private static final Logger logger = LoggerFactory.getLogger(UrlsWorkerApplication.class);
|
||||||
|
|
||||||
|
private static String workerId;
|
||||||
|
|
||||||
private static ConfigurableApplicationContext context;
|
private static ConfigurableApplicationContext context;
|
||||||
|
|
||||||
|
|
||||||
|
public UrlsWorkerApplication(@Value("${info.workerId}") String workerId)
|
||||||
|
{
|
||||||
|
UrlsWorkerApplication.workerId = workerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
context = SpringApplication.run(UrlsWorkerApplication.class, args);
|
context = SpringApplication.run(UrlsWorkerApplication.class, args);
|
||||||
|
|
||||||
|
@ -43,6 +50,8 @@ public class UrlsWorkerApplication {
|
||||||
logger.debug("HeapSize: " + (javaRuntime.totalMemory() / mb) + " mb");
|
logger.debug("HeapSize: " + (javaRuntime.totalMemory() / mb) + " mb");
|
||||||
logger.debug("HeapMaxSize: " + (javaRuntime.maxMemory() / mb) + " mb");
|
logger.debug("HeapMaxSize: " + (javaRuntime.maxMemory() / mb) + " mb");
|
||||||
logger.debug("HeapFreeSize: " + (javaRuntime.freeMemory() / mb) + " mb");
|
logger.debug("HeapFreeSize: " + (javaRuntime.freeMemory() / mb) + " mb");
|
||||||
|
|
||||||
|
logger.info("The Worker has started running. Its id is: \"" + workerId + "\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
server.port = 1881
|
server.port = 1881
|
||||||
# Set the above value to < 0 >, in order to choose a random port (it will automatically choose a new random port, if the previously chosen is already in use)..
|
# Set the above value to < 0 >, in order to choose a random port (it will automatically choose a new random port, if the previously chosen is already in use)..
|
||||||
|
|
||||||
|
|
||||||
# Server api path
|
# Server api path
|
||||||
server.servlet.context-path=/api
|
server.servlet.context-path=/api
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue