chore: update build.gradle

upgrade io.grpc:grpc-all from 1.41.0 (uses io.netty:4.1.52.Final) to 1.43.1 (uses io.netty:4.1.63.Final); optimize logs in CMHttpHandler and NetworkManager; rename CMHttpServer.parseConf to CMHttpServer.configServer
This commit is contained in:
Frank.R.Wu 2021-12-23 21:42:41 +08:00
parent 5034e36d86
commit bc4eb8b828
4 changed files with 12 additions and 7 deletions

View File

@ -36,7 +36,7 @@ dependencies {
implementation project(":front-base")
implementation 'io.prometheus:simpleclient_httpserver:0.12.0'
implementation 'org.knowhowlab.osgi:sigar:1.6.5_01'
implementation 'io.grpc:grpc-all:1.41.0'
implementation 'io.grpc:grpc-all:1.43.1'
implementation 'org.apache.velocity:velocity-engine-core:2.3'
implementation 'com.nimbusds:nimbus-jose-jwt:9.10'
testImplementation 'junit:junit:4.13.2'

View File

@ -59,7 +59,7 @@ public class CMHttpServer {
this.port = port;
}
private static void parseConf(CMDConf cmdConf) throws IOException {
private static void configServer(CMDConf cmdConf) throws IOException {
if (cmdConf.disableDoRepo) {
DoConfig.callContractUsingDOI = false;
}
@ -103,7 +103,6 @@ public class CMHttpServer {
String[] filePaths = cmdConf.enableSsl.split(":");
File chainedFile = new File(filePaths[0]), keyFile = new File(filePaths[1]);
if (chainedFile.exists() && keyFile.exists()) {
LOGGER.info("openssl isAvailable:" + OpenSsl.isAvailable());
sslContext =
SslContextBuilder.forServer(chainedFile, keyFile)
.ciphers(
@ -113,6 +112,7 @@ public class CMHttpServer {
.filter(x -> null != x && !x.contains("RC4"))
.toArray(String[]::new))
.build();
LOGGER.info("openssl isAvailable:" + OpenSsl.isAvailable());
}
} catch (Exception e) {
LOGGER.warn("Enabling SSL failed: " + e.getMessage());
@ -189,7 +189,7 @@ public class CMHttpServer {
if (!confFile.exists() && confTemplate.exists()) {
FileUtils.copyFile(confTemplate, confFile);
}
CMDConf cmdConf = CMDConf.parseConf(CONFIG_PATH);
CMDConf cmdConf = CMDConf.parseFile(CONFIG_PATH);
// addDirToPath(new File("./dynamicLibrary").getAbsolutePath());
@ -207,7 +207,7 @@ public class CMHttpServer {
}
cmdConf.parseArgs(args);
parseConf(cmdConf);
configServer(cmdConf);
// check default key pair
File keyFile = new File("manager.key");

View File

@ -352,7 +352,12 @@ public class CMHttpHandler extends SimpleChannelInboundHandler<HttpObject> {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
LOGGER.warn("catch exception in " + this + ": " + cause.getClass().getSimpleName() + " " + ExceptionUtil.exceptionToString(cause));
LOGGER.warn("catch exception in " + parseCtx2String(ctx) + ": " + cause.getClass().getSimpleName());
LOGGER.debug(ExceptionUtil.exceptionToString(cause));
// ctx.close();
}
private String parseCtx2String(ChannelHandlerContext ctx) {
return ctx.name() + "@" + ctx.channel().id();
}
}

View File

@ -128,7 +128,7 @@ public class NetworkManager {
}
} catch (Exception e) {
// e.printStackTrace();
LOGGER.error("connecting to node center failed! " + e.getMessage());
LOGGER.warn("connecting to node center failed! " + e.getMessage());
}
},
0,