ClassFilter.toPattern优化
This commit is contained in:
@@ -15,7 +15,7 @@ import java.lang.annotation.*;
|
||||
* @since Common Annotations 1.0
|
||||
* @since 2.8.0
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
|
||||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Resource {
|
||||
|
||||
|
||||
@@ -414,6 +414,7 @@ public final class ClassFilter<T> {
|
||||
* 一个*表示包的一个层级, 两个*表示包的多层级
|
||||
* 例如:
|
||||
* *.platf.** 转成 ^(\w+)\.platf\.(.*)$
|
||||
* .platf. 转成 ^(.*)\.platf\.(.*)$
|
||||
*
|
||||
* @param regex 正则表达式
|
||||
* @return Pattern
|
||||
@@ -422,6 +423,9 @@ public final class ClassFilter<T> {
|
||||
if (regex.indexOf('^') >= 0 || regex.indexOf('$') >= 0 || regex.indexOf('\\') >= 0) { // 已经是标准正则表达式
|
||||
return regex;
|
||||
}
|
||||
if (regex.startsWith(".") && regex.endsWith(".")) { // .platf.
|
||||
regex = "**" + regex + "**";
|
||||
}
|
||||
String str = regex.replace("**", sxing).replace("*", dxing);
|
||||
str = str.replace("\\.", dian).replace(".", dian);
|
||||
return "^" + str.replace(dian, "\\.").replace(dxing, "(\\w+)").replace(sxing, "(.*)") + "$";
|
||||
|
||||
@@ -157,7 +157,7 @@ public class CacheClusterAgent extends ClusterAgent implements Resourcable {
|
||||
checkApplicationHealth();
|
||||
checkHttpAddressHealth();
|
||||
loadSncpAddressHealth();
|
||||
long e = System.currentTimeMillis() - s;
|
||||
long e = (System.currentTimeMillis() - s) / 1000;
|
||||
if (e >= ttls * 9 / 10) {
|
||||
logger.log(Level.WARNING, getClass().getSimpleName() + ".schedule check-slower cost " + e + " ms");
|
||||
} else if (e >= ttls / 2) {
|
||||
|
||||
Reference in New Issue
Block a user