You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
622 B
28 lines
622 B
package core.thrift;
|
|
|
|
import org.apache.thrift.TServiceClient;
|
|
import org.apache.thrift.transport.TSocket;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.net.Socket;
|
|
|
|
@Component
|
|
public class TSocketPool extends TTransportPool<TSocket,TServiceClient>{
|
|
|
|
|
|
public TSocketPool(SocketConfig config) {
|
|
super(config);
|
|
}
|
|
|
|
@Override
|
|
public Socket socket(TSocket o) {
|
|
return o.getSocket();
|
|
}
|
|
|
|
@Override
|
|
public TSocket create() throws Exception {
|
|
TSocket socket=new TSocket(config.ip,config.port,config.timeout);
|
|
socket.open();
|
|
return socket;
|
|
}
|
|
}
|
|
|