Commit e8a25b29 by s_guodong

代码整理

parent 1689dc97
...@@ -56,7 +56,6 @@ public class ShortSocketHandle implements Runnable { ...@@ -56,7 +56,6 @@ public class ShortSocketHandle implements Runnable {
} }
public void handleWithHead() { public void handleWithHead() {
byte[] headLenBytes = new byte[head_len]; byte[] headLenBytes = new byte[head_len];
int headLen = 0; int headLen = 0;
...@@ -80,7 +79,6 @@ public class ShortSocketHandle implements Runnable { ...@@ -80,7 +79,6 @@ public class ShortSocketHandle implements Runnable {
headLen = headLen + body_offset; headLen = headLen + body_offset;
byte[] databuffer = new byte[headLen]; byte[] databuffer = new byte[headLen];
IOUtils.readFully(socket.getInputStream(), databuffer); IOUtils.readFully(socket.getInputStream(), databuffer);
// logger.debug("socket接收");
Context context = new Context(); Context context = new Context();
context.addVariable("transaction", "__val", databuffer); context.addVariable("transaction", "__val", databuffer);
ResultMsg resultMsg = new Client().call(context, interfaceName, transName, args); ResultMsg resultMsg = new Client().call(context, interfaceName, transName, args);
...@@ -108,10 +106,10 @@ public class ShortSocketHandle implements Runnable { ...@@ -108,10 +106,10 @@ public class ShortSocketHandle implements Runnable {
IOUtils.write(header, socket.getOutputStream()); IOUtils.write(header, socket.getOutputStream());
IOUtils.write(returnBytes, socket.getOutputStream()); IOUtils.write(returnBytes, socket.getOutputStream());
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
logger.error(e.getMessage(), e);
IOUtils.closeQuietly(socket); IOUtils.closeQuietly(socket);
} finally { } finally {
IOUtils.closeQuietly(socket); IOUtils.closeQuietly(socket);
......
...@@ -21,7 +21,7 @@ import java.util.concurrent.ExecutorService; ...@@ -21,7 +21,7 @@ import java.util.concurrent.ExecutorService;
/** /**
* @author hujun * @author hujun
* * <p>
* socket原生模式 ------------modified by weicong on 2016/4/01 ----------- * socket原生模式 ------------modified by weicong on 2016/4/01 -----------
* 兼容sslsocketserver * 兼容sslsocketserver
*/ */
...@@ -99,47 +99,6 @@ public class SocketServerMode implements IServerMode { ...@@ -99,47 +99,6 @@ public class SocketServerMode implements IServerMode {
this.logger = logger; this.logger = logger;
} }
/*
* public static class Builder { private Logger logger;
*
* private String trustips; // 信任的IP列表 private int port; private int
* queueLen; private int size; private String delayTime; private String
* interfaceName; private String transName; private int timeout; private
* String expression; private Object[] args; private String serverId;
*
* public Builder(int port, int queueLen, int size) { this.port = port;
* this.queueLen = queueLen; this.size = size; }
*
* public Builder setTrustips(String trustips) { this.trustips = trustips;
* return this; }
*
* public Builder setDelayTime(String delayTime) { this.delayTime =
* delayTime; return this; }
*
* public Builder setInterfaceName(String interfaceName) {
* this.interfaceName = interfaceName; return this; }
*
* public Builder setExpression(String expression) { this.expression =
* expression; return this; }
*
* public Builder setTimeout(int timeout) { this.timeout = timeout; return
* this; }
*
* public Builder setTransName(String transName) { this.transName =
* transName; return this; }
*
* public Builder setArgs(Object[] args) { this.args = args; return this; }
*
* public Builder setServerId(String serverId) { this.serverId = serverId;
* return this; }
*
* public Builder setLogger(Logger logger) { this.logger = logger; return
* this; }
*
* public SocketServerMode build() { return new SocketServerMode(this); }
*
* }
*/
@Override @Override
public void startup() { public void startup() {
...@@ -164,11 +123,6 @@ public class SocketServerMode implements IServerMode { ...@@ -164,11 +123,6 @@ public class SocketServerMode implements IServerMode {
if (mode.equals(SocketProxyFactry.ORG_SOCKET_TYPE)) { if (mode.equals(SocketProxyFactry.ORG_SOCKET_TYPE)) {
if (DateUtil.isDateValid(expression)) { if (DateUtil.isDateValid(expression)) {
executorService.submit(new SocketClient(interfaceName, transName, socket, args)); executorService.submit(new SocketClient(interfaceName, transName, socket, args));
// counter.incConnectionCount();
// logger.info("Connection count: " +
// counter.getConnCount());
// logger.debug("result:" +
// future.get().getContent());
} else { } else {
logger.debug("time is invalid."); logger.debug("time is invalid.");
IOUtils.closeQuietly(socket); IOUtils.closeQuietly(socket);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment