From 1869070040acb676a1ac06b1462884c3cc2234e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9C=B0=E5=B9=B3=E7=BA=BF?= <22250530@qq.com> Date: Fri, 4 Sep 2015 09:52:09 +0800 Subject: [PATCH] --- src/com/wentch/redkale/net/sncp/SncpClient.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/com/wentch/redkale/net/sncp/SncpClient.java b/src/com/wentch/redkale/net/sncp/SncpClient.java index 9ded9f096..88d3a3068 100644 --- a/src/com/wentch/redkale/net/sncp/SncpClient.java +++ b/src/com/wentch/redkale/net/sncp/SncpClient.java @@ -96,7 +96,7 @@ public final class SncpClient { protected final BlockingQueue queue = new ArrayBlockingQueue(1024 * 64); public SncpClient(final String serviceName, final long serviceid0, boolean remote, final Class serviceClass, - boolean onlySncpDyn, final InetSocketAddress clientAddress, final HashSet groups) { + boolean onlySncpDyn, final InetSocketAddress clientAddress, final HashSet groups) { if (serviceName.length() > 10) throw new RuntimeException(serviceClass + " @Resource name(" + serviceName + ") too long , must less 11"); this.remote = remote; this.serviceClass = serviceClass; @@ -152,8 +152,8 @@ public final class SncpClient { String service = serviceClass.getName(); if (remote) service = service.replace(Sncp.LOCALPREFIX, Sncp.REMOTEPREFIX); return this.getClass().getSimpleName() + "(service = " + service + ", serviceid = " + serviceid - + ", name = " + name + ", nameid = " + nameid + ", address = " + (address == null ? "" : (address.getHostString() + ":" + address.getPort())) - + ", groups = " + groups + ", actions.size = " + actions.length + ")"; + + ", name = " + name + ", nameid = " + nameid + ", address = " + (address == null ? "" : (address.getHostString() + ":" + address.getPort())) + + ", groups = " + groups + ", actions.size = " + actions.length + ")"; } public static List parseMethod(final Class serviceClass, boolean onlySncpDyn) { @@ -174,7 +174,8 @@ public final class SncpClient { DLong actionid = Sncp.hash(method); Method old = actionids.get(actionid); if (old != null) { - if (old.getDeclaringClass().equals(method.getDeclaringClass())) throw new RuntimeException(serviceClass.getName() + " have one more same action(Method=" + method + ", actionid=" + actionid + ")"); + if (old.getDeclaringClass().equals(method.getDeclaringClass())) + throw new RuntimeException(serviceClass.getName() + " have one more same action(Method=" + method + ", actionid=" + actionid + ")"); continue; } actionids.put(actionid, method); @@ -325,10 +326,14 @@ public final class SncpClient { if (rnameid != nameid) throw new RuntimeException("sncp send nameid = " + nameid + ", but receive next.nameid =" + rnameid); ractionid1 = buffer.getLong(); ractionid2 = buffer.getLong(); - if (!actionid.compare(ractionid1, ractionid2)) throw new RuntimeException("sncp send actionid = " + actionid + ", but receive next.actionid =(" + ractionid1 + "_" + ractionid2 + ")"); + if (!actionid.compare(ractionid1, ractionid2)) + throw new RuntimeException("sncp send actionid = " + actionid + ", but receive next.actionid =(" + ractionid1 + "_" + ractionid2 + ")"); + buffer.getInt(); + buffer.getInt(); if (buffer.get() < 1) throw new RuntimeException("sncp send nameid = " + nameid + ", but next.frame.count != " + frameCount); frameIndex = buffer.get(); - if (frameIndex < 0 || frameIndex >= frameCount) throw new RuntimeException("sncp receive nameid = " + nameid + ", but frame.count =" + frameCount + " & next.frame.index =" + frameIndex); + if (frameIndex < 0 || frameIndex >= frameCount) + throw new RuntimeException("sncp receive nameid = " + nameid + ", but frame.count =" + frameCount + " & next.frame.index =" + frameIndex); int rretcode = buffer.getInt(); if (rretcode != 0) throw new RuntimeException("remote service deal error (receive retcode =" + rretcode + ")"); int rbodylen = buffer.getInt();