Skip to content

Commit 4c65e81

Browse files
Feature2.4.8 (#278)
* init 2.4.8 * added ServiceContext.report() and ServiceContext.report(StringBuilder) BootCache.debounced() supports TimeUnit * fix typo * release2.4.8
1 parent ac2da77 commit 4c65e81

File tree

10 files changed

+44
-17
lines changed

10 files changed

+44
-17
lines changed

pom.xml

Lines changed: 5 additions & 5 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.7</version>
7+
<version>2.4.8</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,
@@ -196,12 +196,12 @@
196196
<jwt.version>0.11.5</jwt.version>
197197

198198
<!-- NIO Netty -->
199-
<netty.version>4.1.110.Final</netty.version>
199+
<netty.version>4.1.111.Final</netty.version>
200200
<netty-tcnative.version>2.0.65.Final</netty-tcnative.version>
201201
<!-- gRPC and protobuf -->
202202
<grpc.version>1.64.0</grpc.version>
203-
<guava.version>33.2.0-jre</guava.version>
204-
<protobuf.version>4.27.0</protobuf.version>
203+
<guava.version>33.2.1-jre</guava.version>
204+
<protobuf.version>4.27.1</protobuf.version>
205205
<!-- Web JAX-RS -->
206206
<swagger.core.version>2.2.22</swagger.core.version>
207207
<!--<elastic-apm.version>1.36.0</elastic-apm.version>-->
@@ -234,7 +234,7 @@
234234
<mqtt.version>1.2.5</mqtt.version>
235235

236236
<!-- Template Engine -->
237-
<freemarker.version>2.3.32</freemarker.version>
237+
<freemarker.version>2.3.33</freemarker.version>
238238
<!-- Barcode -->
239239
<zxing.version>3.5.3</zxing.version>
240240
<!-- PDF - PDFBox

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public interface BootConstant {
2525
String APP_ID = String.format("%06d", new Random().nextInt(999999));
2626

2727
//version
28-
String VERSION = "SummerBoot.jExpress 2.4.7";
28+
String VERSION = "SummerBoot.jExpress 2.4.8";
2929
String JEXPRESS_PACKAGE_NAME = "org.summerboot.jexpress";
3030

3131
String DEFAULT_ADMIN_MM = "changeit";

src/main/java/org/summerboot/jexpress/boot/event/HttpLifecycleHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void afterSendPingResponse(ChannelHandlerContext ctx, String uri, long hi
4242
}
4343

4444
@Override
45-
public boolean beofreProcess(RequestProcessor processor, HttpHeaders httpRequestHeaders, String httpRequestPath, ServiceContext context) throws Exception {
45+
public boolean beforeProcess(RequestProcessor processor, HttpHeaders httpRequestHeaders, String httpRequestPath, ServiceContext context) throws Exception {
4646
return true;
4747
}
4848

src/main/java/org/summerboot/jexpress/boot/event/HttpLifecycleListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public interface HttpLifecycleListener {
4444
* @return true if good to process request, otherwise false
4545
* @throws Exception
4646
*/
47-
boolean beofreProcess(RequestProcessor processor, HttpHeaders httpRequestHeaders, String httpRequestPath, ServiceContext context) throws Exception;
47+
boolean beforeProcess(RequestProcessor processor, HttpHeaders httpRequestHeaders, String httpRequestPath, ServiceContext context) throws Exception;
4848

4949
/**
5050
* step1 - after process is done, before sending response to client

src/main/java/org/summerboot/jexpress/integration/cache/BootCache.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.summerboot.jexpress.integration.cache.domain.FlashSale;
2020

2121
import java.util.UUID;
22+
import java.util.concurrent.TimeUnit;
2223

2324
/**
2425
* @author Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
@@ -57,12 +58,23 @@ default String generateUnlockPassword() {
5758
* @param key
5859
* @param unlockPassword
5960
* @param ttlMinute
60-
* @return true when debounced
61+
* @return true is debounced (failed to acquire lock), false is not debounced (acquired lock successfully
6162
*/
62-
default boolean debounced(String key, String unlockPassword, int ttlMinute) {
63+
default boolean debounced(String key, String unlockPassword, long ttlMinute) {
6364
return !tryLock(key, unlockPassword, ttlMinute * 60000);
6465
}
6566

67+
/**
68+
* @param key
69+
* @param unlockPassword
70+
* @param ttl
71+
* @param timeUnit
72+
* @return true is debounced (failed to acquire lock), false is not debounced (acquired lock successfully
73+
*/
74+
default boolean debounced(String key, String unlockPassword, long ttl, TimeUnit timeUnit) {
75+
return !tryLock(key, unlockPassword, timeUnit.toMillis(ttl));
76+
}
77+
6678
/**
6779
* flash sale - enable
6880
*

src/main/java/org/summerboot/jexpress/integration/httpclient/RPCError.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public boolean isSingleError() {
3333
}
3434

3535
@Override
36-
public Err toSerivceError(HttpResponseStatus status) {
36+
public Err toServiceError(HttpResponseStatus status) {
3737
return new Err(BootErrorCode.ACCESS_ERROR_RPC, null, null, null, "Default RPC error");
3838
}
3939

4040
@Override
41-
public List<Err> toSerivceErrors(HttpResponseStatus status) {
41+
public List<Err> toServiceErrors(HttpResponseStatus status) {
4242
return null;
4343
}
4444

src/main/java/org/summerboot/jexpress/integration/httpclient/RPCResult.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ public RPCResult<T, E> update(ObjectMapper jacksonMapper, JavaType successRespon
145145
errorResponse = fromJson(jacksonMapper, null, errorResponseClass, context);
146146
if (errorResponse != null & context != null) {
147147
if (errorResponse.isSingleError()) {
148-
Err e = errorResponse.toSerivceError(httpStatus);
148+
Err e = errorResponse.toServiceError(httpStatus);
149149
context.error(e);
150150
} else {
151-
List<Err> errors = errorResponse.toSerivceErrors(httpStatus);
151+
List<Err> errors = errorResponse.toServiceErrors(httpStatus);
152152
context.errors(errors);
153153
}
154154
}

src/main/java/org/summerboot/jexpress/nio/server/BootHttpRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected ProcessorSettings service(final ChannelHandlerContext ctx, final HttpH
105105
if (authenticator != null && !authenticator.customizedAuthorizationCheck(processor, httpRequestHeaders, httpRequestPath, context)) {
106106
return processorSettings;
107107
}
108-
if (!httpLifecycleListener.beofreProcess(processor, httpRequestHeaders, httpRequestPath, context)) {
108+
if (!httpLifecycleListener.beforeProcess(processor, httpRequestHeaders, httpRequestPath, context)) {
109109
return processorSettings;
110110
}
111111
processor.process(ctx, httpRequestHeaders, httpRequestPath, queryParams, httpPostRequestBody, context);

src/main/java/org/summerboot/jexpress/nio/server/domain/ServiceContext.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,21 @@ public Memo(String id, String desc) {
886886

887887
}
888888

889+
public StringBuilder report() {
890+
StringBuilder sb = new StringBuilder();
891+
reportPOI(sb);
892+
reportMemo(sb);
893+
reportError(sb);
894+
return sb;
895+
}
896+
897+
public ServiceContext report(StringBuilder sb) {
898+
reportPOI(sb);
899+
reportMemo(sb);
900+
reportError(sb);
901+
return this;
902+
}
903+
889904
public ServiceContext reportError(StringBuilder sb) {
890905
if (serviceError == null /*|| file == null*/) {// log error only for file request
891906
return this;

src/main/java/org/summerboot/jexpress/nio/server/domain/ServiceErrorConvertible.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public interface ServiceErrorConvertible {
2626

2727
boolean isSingleError();
2828

29-
Err toSerivceError(HttpResponseStatus status);
29+
Err toServiceError(HttpResponseStatus status);
3030

31-
List<Err> toSerivceErrors(HttpResponseStatus status);
31+
List<Err> toServiceErrors(HttpResponseStatus status);
3232
}

0 commit comments

Comments
 (0)