@@ -63,6 +63,20 @@ public class LoadDetectFilter implements ContainerRequestFilter {
6363 @ Context
6464 private jakarta .inject .Provider <WorkLoad > loadProvider ;
6565
66+ public static boolean isWhiteAPI (ContainerRequestContext context ) {
67+ List <PathSegment > segments = context .getUriInfo ().getPathSegments ();
68+ E .checkArgument (!segments .isEmpty (), "Invalid request uri '%s'" ,
69+ context .getUriInfo ().getPath ());
70+ String rootPath = segments .get (0 ).getPath ();
71+ return WHITE_API_LIST .contains (rootPath );
72+ }
73+
74+ private static void gcIfNeeded () {
75+ if (GC_RATE_LIMITER .tryAcquire (1 )) {
76+ System .gc ();
77+ }
78+ }
79+
6680 @ Override
6781 public void filter (ContainerRequestContext context ) {
6882 if (LoadDetectFilter .isWhiteAPI (context )) {
@@ -105,18 +119,4 @@ public void filter(ContainerRequestContext context) {
105119 ServerOptions .MIN_FREE_MEMORY .name ()));
106120 }
107121 }
108-
109- public static boolean isWhiteAPI (ContainerRequestContext context ) {
110- List <PathSegment > segments = context .getUriInfo ().getPathSegments ();
111- E .checkArgument (!segments .isEmpty (), "Invalid request uri '%s'" ,
112- context .getUriInfo ().getPath ());
113- String rootPath = segments .get (0 ).getPath ();
114- return WHITE_API_LIST .contains (rootPath );
115- }
116-
117- private static void gcIfNeeded () {
118- if (GC_RATE_LIMITER .tryAcquire (1 )) {
119- System .gc ();
120- }
121- }
122122}
0 commit comments