Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
venwyhk committed Oct 25, 2016
1 parent 5aff289 commit 56f2c0c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ikasoa-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ikasoa</groupId>
<artifactId>ikasoa-core</artifactId>
<version>0.4.5</version>
<version>0.4.6</version>
<packaging>jar</packaging>
<name>Ikasoa Core</name>
<description>ikasoa is a java distributed service framework.</description>
Expand Down Expand Up @@ -121,7 +121,7 @@
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.2</version>
<version>0.9.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ikamobile.ikasoa.core.thrift.client.pool.impl;

import java.io.IOException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
Expand Down Expand Up @@ -116,8 +117,16 @@ public synchronized ThriftSocketChannel buildThriftSocketChannel(String host, in
byte i = 0;
for (; i < size; i++) {
if (!self.socketStatusArray[i]) {
ThriftSocketChannel thriftSocketChannel = getThriftSocketChannel(self, i, host, port);
if (!thriftSocketChannel.isOpen()) {
try {
thriftSocketChannel = new ThriftSocketChannel(host, port, time);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
self.socketStatusArray[i] = true;
return getThriftSocketChannel(self, i, host, port);
return thriftSocketChannel;
}
}
// 如果连接不够用,就初始化连接池.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ public synchronized ThriftSocket buildThriftSocket(String host, int port) {
byte i = 0;
for (; i < size; i++) {
if (!self.socketStatusArray[i]) {
ThriftSocket thriftSocket = getThriftSocket(self, i, host, port);
if (!thriftSocket.isOpen()) {
thriftSocket = new ThriftSocket(host, port, time);
}
self.socketStatusArray[i] = true;
return getThriftSocket(self, i, host, port);
return thriftSocket;
}
}
// 如果连接不够用,就初始化连接池.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public void stop() {
Thread.currentThread().interrupt();
}
}
server = null;
serverSocket = null;
executorService = null;
LOG.info("Stop thrift server ...... (name: " + serverName + ")");
afterStop(getThriftServerConfiguration().getServerAspect());
} else {
Expand Down

0 comments on commit 56f2c0c

Please sign in to comment.