Skip to content

Commit 0072382

Browse files
Feature2.4.10 (#280)
* enable configurable TimeZone for JSON parser in Nio and Http config * updated log4j2.xml * updated log4j2.xml * wip * wip * afterProcess only get triggered when beforeProcess success * release2.4.9 * fixed: rename config file will pause/resume service * added CLI: -psv <envId> * wip: config namespace * wip * refactoring * refactoring file upload handler * HttpClient: remotet Http response status will not be set to the response status of ServiceContext * refactoring * support ISO9601 offset with no colon * PingHandler returns status reason; NioServer only log status on change * refactoring * PingHandler returns 502 Bad Gateway when service paused; 503 Service Unavailable when health check failed * refactoring: HealthInspector can set log level and status of pause/healthcheck * java doc plugin to 17 * service pause by multiple reasons via password, and can only be resumed by all those reasons via correct password * service pause by multiple reasons via password, and can only be resumed by all those reasons via correct password * refactoring * refactoring * refactoring * refactoring * refactoring * refactoring * refactoring * refactoring * refactoring * refactoring * release2.4.10
1 parent 870c9af commit 0072382

31 files changed

+725
-410
lines changed

pom.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.summerboot</groupId>
66
<artifactId>jexpress</artifactId>
7-
<version>2.4.9</version>
7+
<version>2.4.10</version>
88
<packaging>jar</packaging>
99
<name>Summer Boot jExpress</name>
1010
<description>Summer Boot jExpress focuses on solving non-functional and operational maintainability requirements,
@@ -92,7 +92,7 @@
9292
<artifactId>maven-javadoc-plugin</artifactId>
9393
<version>3.6.3</version>
9494
<configuration>
95-
<source>11</source>
95+
<source>17</source>
9696
<!-- <aggregate>true</aggregate>-->
9797
<charset>UTF-8</charset>
9898
<encoding>UTF-8</encoding>
@@ -190,7 +190,7 @@
190190
<maven.resources.version>3.3.1</maven.resources.version>
191191
<maven-surefire.version>3.2.5</maven-surefire.version>
192192
<!-- Commons -->
193-
<commons-lang3.version>3.14.0</commons-lang3.version>
193+
<commons-lang3.version>3.15.0</commons-lang3.version>
194194
<commons-cli.version>1.8.0</commons-cli.version>
195195
<commons-io.version>2.16.1</commons-io.version>
196196
<!-- <commons-text.version>1.11.0</commons-text.version>-->
@@ -206,12 +206,12 @@
206206
<jwt.version>0.11.5</jwt.version>
207207

208208
<!-- NIO Netty -->
209-
<netty.version>4.1.111.Final</netty.version>
209+
<netty.version>4.1.112.Final</netty.version>
210210
<netty-tcnative.version>2.0.65.Final</netty-tcnative.version>
211211
<!-- gRPC and protobuf -->
212-
<grpc.version>1.65.0</grpc.version>
212+
<grpc.version>1.65.1</grpc.version>
213213
<guava.version>33.2.1-jre</guava.version>
214-
<protobuf.version>4.27.2</protobuf.version>
214+
<protobuf.version>4.27.3</protobuf.version>
215215
<!-- Web JAX-RS -->
216216
<swagger.core.version>2.2.22</swagger.core.version>
217217
<!--<elastic-apm.version>1.36.0</elastic-apm.version>-->
@@ -228,7 +228,7 @@
228228
<jackson.version>2.17.2</jackson.version>
229229
<!-- Bean Validation -->
230230
<hibernate-validator.version>8.0.1.Final</hibernate-validator.version>
231-
<jakarta.el.version>6.0.0</jakarta.el.version>
231+
<jakarta.el.version>6.0.1</jakarta.el.version>
232232

233233
<!-- IOC Injection -->
234234
<guice.version>7.0.0</guice.version>
@@ -238,7 +238,7 @@
238238
<hikari-cp.version>5.1.0</hikari-cp.version>
239239

240240
<!-- Cache -->
241-
<jedis.version>5.1.3</jedis.version>
241+
<jedis.version>5.1.4</jedis.version>
242242

243243
<quartz.version>2.5.0-rc1</quartz.version>
244244
<mqtt.version>1.2.5</mqtt.version>
@@ -253,8 +253,8 @@
253253
<openhtml.version>1.0.10</openhtml.version>
254254
<batik-transcoder.version>1.17</batik-transcoder.version>
255255
<!-- PDF - iText -->
256-
<itext7-core.version>8.0.4</itext7-core.version>
257-
<itext7-html2pdf.version>5.0.4</itext7-html2pdf.version>
256+
<itext7-core.version>8.0.5</itext7-core.version>
257+
<itext7-html2pdf.version>5.0.5</itext7-html2pdf.version>
258258

259259
<!-- Testing -->
260260
<testng.version>7.10.2</testng.version>

src/main/java/org/summerboot/jexpress/boot/BackOffice.java

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ public Map<Integer, Integer> getBootErrorCodeMapping() {
187187
private String portInUseAlertMessage = ALERT_MSG_PORT_IN_USE;
188188

189189
@Config(key = "backoffice.executor.core", defaultValue = "3",
190-
desc = "MaxSize 0 = current computer/VM's available processors + 1")
190+
desc = "0 = current computer/VM's available processors + 1")
191191
private int tpeCore = 3;
192192

193-
@Config(key = "backoffice.executor.max", defaultValue = "" + Integer.MAX_VALUE,
194-
desc = "MaxSize 0 = current computer/VM's available processors + 1")
195-
private int tpeMax = Integer.MAX_VALUE;
193+
@Config(key = "backoffice.executor.max", defaultValue = "3",
194+
desc = "0 = current computer/VM's available processors + 1")
195+
private int tpeMax = 3;
196196

197-
@Config(key = "backoffice.executor.queue", defaultValue = "0")
198-
private int tpeQueue = 0;
197+
@Config(key = "backoffice.executor.queue", defaultValue = "" + Integer.MAX_VALUE)
198+
private int tpeQueue = Integer.MAX_VALUE;
199199

200200
@Config(key = "backoffice.executor.keepAliveTimeSec", defaultValue = "60")
201201
private int tpeKeepAliveSeconds = 60;
@@ -231,6 +231,12 @@ public Map<Integer, Integer> getBootErrorCodeMapping() {
231231
@Config(key = "naming.file.gRPCConfig", defaultValue = "cfg_grpc.properties")
232232
private String gRPCConfigFileName = "cfg_grpc.properties";
233233

234+
@Config(key = "HealthMonitor.PauseLockCode.viaFile", defaultValue = "PauseLockCode.file")
235+
private String pauseLockCodeViaFile = "PauseLockCode.file";
236+
237+
@Config(key = "HealthMonitor.PauseLockCode.viaWeb", defaultValue = "PauseLockCode.web")
238+
private String pauseLockCodeViaWeb = "PauseLockCode.web";
239+
234240
@ConfigHeader(title = "4.2 Default Log4j2.xml Variables Naming")
235241
@Config(key = "naming.log4j2.xml.var.logId", defaultValue = "logId")
236242
private String log4j2LogId = "logId";
@@ -290,6 +296,9 @@ public Map<Integer, Integer> getBootErrorCodeMapping() {
290296
@Config(key = "naming.cli.decrypt", defaultValue = "decrypt")
291297
private String cliName_decrypt = "decrypt";
292298

299+
@Config(key = "naming.cli.psv", defaultValue = "psv")
300+
private String cliName_psv = "psv";
301+
293302
@Config(key = "naming.memo.delimiter", defaultValue = ": ")
294303
private String memoDelimiter = ": ";
295304

@@ -361,6 +370,14 @@ public String getgRPCConfigFileName() {
361370
return gRPCConfigFileName;
362371
}
363372

373+
public String getPauseLockCodeViaFile() {
374+
return pauseLockCodeViaFile;
375+
}
376+
377+
public String getPauseLockCodeViaWeb() {
378+
return pauseLockCodeViaWeb;
379+
}
380+
364381
public String getLog4J2LogId() {
365382
return log4j2LogId;
366383
}
@@ -437,6 +454,10 @@ public String getCliName_decrypt() {
437454
return cliName_decrypt;
438455
}
439456

457+
public String getCliName_psv() {
458+
return cliName_psv;
459+
}
460+
440461
public String getMemoDelimiter() {
441462
return memoDelimiter;
442463
}
Lines changed: 111 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,116 @@
1-
/*
2-
* Copyright 2005-2022 Du Law Office - The Summer Boot Framework Project
3-
*
4-
* The Summer Boot Project licenses this file to you under the Apache License, version 2.0 (the
5-
* "License"); you may not use this file except in compliance with the License and you have no
6-
* policy prohibiting employee contributions back to this file (unless the contributor to this
7-
* file is your current or retired employee). You may obtain a copy of the License at:
8-
*
9-
* https://www.apache.org/licenses/LICENSE-2.0
10-
*
11-
* Unless required by applicable law or agreed to in writing, software distributed under the License
12-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13-
* or implied. See the License for the specific language governing permissions and limitations under
14-
* the License.
15-
*/
16-
package org.summerboot.jexpress.boot;
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- version 2.4.10 -->
3+
<Configuration status="WARN" monitorInterval="30">
4+
<Properties>
5+
<Property name="logPattern" value="[${sys:logId}] %d{ISO8601} %p %c{}.%M() [%t] %m %ex%n"/>
6+
<!-- usage: %replace{pattern}{regex}{substitution} -->
7+
<Property name="logPattern2" value="[${sys:logId}] %d{ISO8601} %p %c{}.%M() [%t] %replace{%enc{%m}{CRLF}}{\\r|\\n|%0D|%0A|%0d|%0a}{|} %uEx%n"/>
8+
</Properties>
9+
<Appenders>
10+
<Console name="Console" target="SYSTEM_OUT">
11+
<!-- <PatternLayout pattern="%d{ISO8601}{Canada/Eastern} %p %c{}.%M() [%t] %enc{%m}{CRLF} %ex%n"/>-->
12+
<PatternLayout pattern="${sys:logPattern}"/>
13+
</Console>
1714
18-
import java.util.Random;
15+
<!--
16+
1. Requires JVM arg: -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
17+
2. Required total disk spece: around 200MB
18+
3. Archive logs: by DAY and split them by MINUTE
19+
4. Default log level is tuned for development
20+
-->
21+
<RollingRandomAccessFile
22+
name="StatusLogFile"
23+
fileName="${sys:logPath}/${sys:appName}_status_${sys:serverName}.log"
24+
filePattern="${sys:logPath}/$${date:yyyy-MM-dd}/${sys:appName}_status_${sys:serverName}_%d{yyyy-MM-dd HH:mm}.%i.log.gz"
25+
immediateFlush="false"
26+
ignoreExceptions="false">
27+
<PatternLayout pattern="${sys:logPattern}"/>
28+
<Policies>
29+
<SizeBasedTriggeringPolicy size="2MB"/>
30+
</Policies>
31+
<DefaultRolloverStrategy max="50"/>
32+
</RollingRandomAccessFile>
33+
<RollingRandomAccessFile
34+
name="RequestLogFile"
35+
fileName="${sys:logPath}/${sys:appName}_requests_${sys:serverName}.log"
36+
filePattern="${sys:logPath}/$${date:yyyy-MM-dd}/${sys:appName}_requests_${sys:serverName}_%d{yyyy-MM-dd HH:mm}.%i.log.gz"
37+
immediateFlush="false"
38+
ignoreExceptions="false">
39+
<PatternLayout pattern="${sys:logPattern}"/>
40+
<Policies>
41+
<SizeBasedTriggeringPolicy size="10MB"/>
42+
</Policies>
43+
<DefaultRolloverStrategy max="500"/>
44+
</RollingRandomAccessFile>
45+
<RollingRandomAccessFile
46+
name="ScheduledLogFile"
47+
fileName="${sys:logPath}/${sys:appName}_schedule_${sys:serverName}.log"
48+
filePattern="${sys:logPath}/$${date:yyyy-MM-dd}/${sys:appName}_schedule_${sys:serverName}_%d{yyyy-MM-dd HH:mm}.%i.log.gz"
49+
immediateFlush="false"
50+
ignoreExceptions="false">
51+
<PatternLayout pattern="${sys:logPattern}"/>
52+
<Policies>
53+
<SizeBasedTriggeringPolicy size="10MB"/>
54+
</Policies>
55+
<DefaultRolloverStrategy max="500"/>
56+
</RollingRandomAccessFile>
57+
</Appenders>
58+
<Loggers>
59+
<Root level="warn" includeLocation="true">
60+
<AppenderRef ref="StatusLogFile"/>
61+
<!-- -->
62+
<AppenderRef ref="Console"/>
63+
</Root>
64+
<Logger level="info" name="com.hazelcast" includeLocation="true"/>
65+
<Logger level="warn" name="io.netty" includeLocation="true"/>
66+
<!-- Note: "java.lang.UnsupportedOperationException: sun.misc.Unsafe unavailable" can be seen, also can be ignored, when -Dio.netty.noUnsafe=true and io.netty.util.internal.CleanerJava9 log level is below INFO (either TRACE or DEBUG) -->
67+
<Logger level="info" name="io.netty.util.internal.CleanerJava9" includeLocation="true"/>
68+
<Logger level="debug" name="org.summerboot.jexpress.boot" includeLocation="true"/>
69+
<Logger level="warn" org.summerboot.jexpress.boot.instrumentation.Timeout includeLocation="true"/>
70+
<Logger level="info" name="org.summerboot.jexpress.integration.httpclient.HttpClientConfig" includeLocation="true"/>
71+
<Logger level="info" name="org.summerboot.jexpress.nio.server.NioServerHttpInitializer" includeLocation="true"/>
72+
<Logger level="debug" name="org.summerboot.jexpress.nio.server.NioServer" includeLocation="true"/>
73+
<Logger level="debug" name="org.summerboot.jexpress.nio.grpc.GRPCServer" includeLocation="true"/>
1974

20-
/**
21-
* @author Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
22-
*/
23-
public interface BootConstant {
2475

25-
String APP_ID = String.format("%06d", new Random().nextInt(999999));
76+
<Logger level="warn" name="io.netty.handler" includeLocation="false" additivity="false">
77+
<AppenderRef ref="RequestLogFile"/>
78+
<!-- -->
79+
<AppenderRef ref="Console"/>
80+
</Logger>
2681

27-
//version
28-
String VERSION = "SummerBoot.jExpress 2.4.9";
29-
String JEXPRESS_PACKAGE_NAME = "org.summerboot.jexpress";
82+
<Logger level="info" name="org.summerboot.jexpress.nio.server.BootHttpRequestHandler" includeLocation="false"
83+
additivity="false">
84+
<AppenderRef ref="RequestLogFile"/>
85+
<!-- -->
86+
<AppenderRef ref="Console"/>
87+
</Logger>
88+
<Logger level="info" name="org.summerboot.jexpress.integration.quartz.BootJobListener" includeLocation="false"
89+
additivity="false">
90+
<AppenderRef ref="ScheduledLogFile"/>
91+
<!-- -->
92+
<AppenderRef ref="Console"/>
93+
</Logger>
94+
<Logger level="warn" name="org.summerboot.jexpress.integration.ldap" includeLocation="true" additivity="false">
95+
<AppenderRef ref="RequestLogFile"/>
96+
<!-- -->
97+
<AppenderRef ref="Console"/>
98+
</Logger>
99+
<Logger level="debug" name="org.hibernate.SQL" includeLocation="true" additivity="false">
100+
<AppenderRef ref="RequestLogFile"/>
101+
<!-- -->
102+
<AppenderRef ref="Console"/>
103+
</Logger>
104+
<Logger level="debug" name="org.hibernate.type" includeLocation="true" additivity="false">
105+
<AppenderRef ref="RequestLogFile"/>
106+
<!-- -->
107+
<AppenderRef ref="Console"/>
108+
</Logger>
30109

31-
String DEFAULT_ADMIN_MM = "changeit";
32-
33-
/*
34-
* Runtime info
35-
*/
36-
int CPU_CORE = Runtime.getRuntime().availableProcessors();
37-
String PID = java.lang.management.ManagementFactory.getRuntimeMXBean().getName();
38-
String BR = System.lineSeparator();
39-
40-
//logging metadata
41-
String LOG4J2_KEY = "log4j.configurationFile";
42-
String LOG4J2_JDKADAPTER_KEY = "java.util.logging.manager";
43-
String LOG4J2_JDKADAPTER_VALUE = "org.apache.logging.log4j.jul.LogManager";
44-
45-
/**
46-
* 3. jExpress Default Settings
47-
*/
48-
boolean CFG_ERROR_CODE_AS_INT = BackOffice.agent.isErrorCodeAsInt();
49-
int CFG_CHANGE_MONITOR_INTERVAL_SEC = BackOffice.agent.getCfgChangeMonitorIntervalSec();
50-
int PACKAGE_LEVEL = BackOffice.agent.getReflectionPackageLevel();
51-
long WEB_RESOURCE_TTL_MS = BackOffice.agent.getWebResourceCacheTtlSec() * 1000;
52-
String DIR_STANDALONE = BackOffice.agent.getDomainFolderPrefix();
53-
String DIR_CONFIGURATION = BackOffice.agent.getConfigFolderName();
54-
String DIR_PLUGIN = BackOffice.agent.getPluginFolderName();
55-
String DIR_LOG = BackOffice.agent.getLogFolderName();
56-
57-
String FILE_CFG_AUTH = BackOffice.agent.getAuthConfigFileName();
58-
String FILE_CFG_SMTP = BackOffice.agent.getSmtpConfigFileName();
59-
String FILE_CFG_NIO = BackOffice.agent.getNioConfigFileName();
60-
String FILE_CFG_GRPC = BackOffice.agent.getgRPCConfigFileName();
61-
62-
/*
63-
* 4. jExpress Default CLI Name
64-
*/
65-
String CLI_USAGE = BackOffice.agent.getCliName_usage();
66-
String CLI_VERSION = BackOffice.agent.getCliName_version();
67-
String CLI_CONFIG_DOMAIN = BackOffice.agent.getCliName_domain();
68-
String CLI_CONFIG_DIR = BackOffice.agent.getCliName_cfgdir();
69-
String CLI_CONFIG_MONITOR_INTERVAL = BackOffice.agent.getCliName_monitorInterval();
70-
String CLI_I8N = BackOffice.agent.getCliName_i18n();
71-
String CLI_USE_IMPL = BackOffice.agent.getCliName_use();//To specify which implementation will be used via @Component.checkImplTagUsed
72-
String CLI_CONFIG_DEMO = BackOffice.agent.getCliName_cfgdemo();
73-
String CLI_LIST_UNIQUE = BackOffice.agent.getCliName_list();
74-
String CLI_ADMIN_PWD_FILE = BackOffice.agent.getCliName_authfile();
75-
String CLI_ADMIN_PWD = BackOffice.agent.getCliName_auth();
76-
String CLI_JWT = BackOffice.agent.getCliName_jwt();
77-
String CLI_ENCRYPT = BackOffice.agent.getCliName_encrypt();
78-
String CLI_DECRYPT = BackOffice.agent.getCliName_decrypt();
79-
String MEMO_DELIMITER = BackOffice.agent.getMemoDelimiter();
80-
81-
/*
82-
* 5. Log4j2.xml variables
83-
*
84-
* Pass by System.setProperty() instead of making them public static, any better idea?
85-
* ‘java.lang.System.getProperty()’ API underlyingly uses ‘java.util.Hashtable.get()’ API.
86-
* Please be advised that ‘java.util.Hashtable.get()’ is a synchronized API.
87-
* It means only one thread can invoke the ‘java.util.Hashtable.get()’ method at any given time.
88-
*/
89-
String SYS_PROP_LOGID = BackOffice.agent.getLog4J2LogId();// "logid" // used by log4j2.xml ${sys:logid}
90-
String SYS_PROP_LOGFILEPATH = BackOffice.agent.getLog4j2LogFilePath();//"logPath"; // used by log4j2.xml ${sys:loggingPath}
91-
String SYS_PROP_LOGFILENAME = BackOffice.agent.getLog4j2LogFileName();//"appName"; // used by log4j2.xml ${sys:appappName} as log file name
92-
String SYS_PROP_SERVER_NAME = BackOffice.agent.getLog4j2ServerName();//"serverName"; // used by log4j2.xml ${hostName}
93-
String SYS_PROP_APP_PACKAGE_NAME = BackOffice.agent.getLog4j2AppPackageName();//"appPackageName"; // used by both log4j2.xml ${sys:appPackage} and JPAHibernateConfig to scan @Entity
94-
95-
}
110+
<Logger level="debug" name="${sys:appPackageName}" includeLocation="true" additivity="false">
111+
<AppenderRef ref="RequestLogFile"/>
112+
<!-- -->
113+
<AppenderRef ref="Console"/>
114+
</Logger>
115+
</Loggers>
116+
</Configuration>

0 commit comments

Comments
 (0)