use of io.seata.server.ParameterParser in project seata by seata.
the class AbstractServerTest method startSeataServer.
protected static void startSeataServer() throws InterruptedException {
(new Thread(new Runnable() {
@Override
public void run() {
File file = new File("sessionStore/root.data");
if (file.exists()) {
file.delete();
}
ParameterParser parameterParser = new ParameterParser(new String[] {});
// initialize the metrics
MetricsManager.get().init();
System.setProperty(ConfigurationKeys.STORE_MODE, parameterParser.getStoreMode());
nettyServer = new NettyRemotingServer(workingThreads);
// server port
nettyServer.setListenPort(parameterParser.getPort());
UUIDGenerator.init(parameterParser.getServerNode());
// log store mode : filećdb
SessionHolder.init(parameterParser.getStoreMode());
DefaultCoordinator coordinator = new DefaultCoordinator(nettyServer);
coordinator.init();
nettyServer.setHandler(coordinator);
// register ShutdownHook
ShutdownHook.getInstance().addDisposable(coordinator);
// 127.0.0.1 and 0.0.0.0 are not valid here.
if (NetUtil.isValidIp(parameterParser.getHost(), false)) {
XID.setIpAddress(parameterParser.getHost());
} else {
XID.setIpAddress(NetUtil.getLocalIp());
}
XID.setPort(nettyServer.getListenPort());
nettyServer.init();
}
})).start();
Thread.sleep(5000);
}
Aggregations