diff --git a/src/com/wentch/redkale/net/sncp/Sncp.java b/src/com/wentch/redkale/net/sncp/Sncp.java index 2a3ec1965..c1ac9ef0f 100644 --- a/src/com/wentch/redkale/net/sncp/Sncp.java +++ b/src/com/wentch/redkale/net/sncp/Sncp.java @@ -83,7 +83,14 @@ public abstract class Sncp { public static DLong hash(final java.lang.reflect.Method method) { if (method == null) return new DLong(-1L, -1L); String n = method.getName(); - if (n.length() > 11) n = n.substring(0, 8) + n.substring(n.length() - 3); + if (n.length() > 11) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < n.length(); i += 2) { + sb.append(n.charAt(i)); + } + sb.append(n.length()); + n = sb.toString(); + } long rs1 = hash(n); if (rs1 < Integer.MAX_VALUE) rs1 |= (method.getParameterCount() + 0L) << 32; rs1 = (rs1 < Integer.MAX_VALUE) ? rs1 | 0xF00000000L : rs1; @@ -102,7 +109,16 @@ public abstract class Sncp { String s = clzz.getSimpleName(); sb.append(s.substring(0, s.length() > 1 ? 2 : 1)).append(s.substring(s.length() - 1)); } - return method.getName() + sb + Integer.toString(params.length, 36); + String n = method.getName(); + if (n.length() > 11) { + StringBuilder zsb = new StringBuilder(); + for (int i = 0; i < n.length(); i += 2) { + zsb.append(n.charAt(i)); + } + zsb.append(n.length()); + n = zsb.toString(); + } + return n + sb + Integer.toString(params.length, 36); } public static long hash(final String name) {