generated from root/miduo_server
rpc
parent
afaf52cb59
commit
ac4036d979
|
@ -17,6 +17,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import ch.qos.logback.classic.spi.ThrowableProxy;
|
||||
|
||||
@SpringBootApplication(exclude = {MongoAutoConfiguration.class,MongoDataAutoConfiguration.class})
|
||||
public class Application {
|
||||
|
@ -25,7 +26,8 @@ public class Application {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(Application.class, args);
|
||||
|
||||
String name = ThrowableProxy.class.getName();
|
||||
LOGGER.info("ThrowableProxy is name ={}",name);
|
||||
//初使化连接池util类
|
||||
ThriftPoolUtils.getInstance().initContext(configurableApplicationContext);
|
||||
ServerConfiguration serverConfiguration = configurableApplicationContext.getBean(ServerConfiguration.class);
|
||||
|
|
|
@ -86,20 +86,26 @@ public class RechargeController {
|
|||
cPayOrder.setCreditId(creditId);
|
||||
Result result = null;
|
||||
String userAddress = cuserDao.findUserInfo(Integer.parseInt(serverCode), Integer.parseInt(creditId));
|
||||
LOGGER.info("callback==>userAddress={} ",userAddress);
|
||||
if (userAddress != null) {
|
||||
LOGGER.info("callback==>userAddress={} ",userAddress);
|
||||
String[] split = userAddress.split(":");
|
||||
String ip = split[0];
|
||||
String port = split[1];
|
||||
LOGGER.info("RPC address --> IP : " + ip + "; PORT : " + port);
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient;
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||
String serviceKey = JsonUtil.getServiceKey(ServiceKey.RPCCore, ip, port);
|
||||
LOGGER.info("serviceKey : " + serviceKey);
|
||||
try {
|
||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||
result = rPCClient.getClient().deliveryRecharge(Integer.parseInt(creditId),stone,productId, amount,activityExtra,isOfficial,plat,payType,pOrderId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.info("callback=>",e);
|
||||
}finally {
|
||||
if (rPCClient != null){
|
||||
rPCClient.returnObject(serviceKey);
|
||||
}else{
|
||||
LOGGER.info("callback=> rPCClient is null ");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result != null && result.getResultCode() == 0) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SendMailController {
|
|||
String ip = split[0];
|
||||
String port = split[1];
|
||||
LOGGER.info("efun_reward ==>RPC address --> IP : "+ ip + "; PORT : "+ port);
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient;
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||
String serviceKey = JsonUtil.getServiceKey(ServiceKey.RPCCore,ip,port);
|
||||
LOGGER.info("serviceKey : "+ serviceKey);
|
||||
try {
|
||||
|
@ -78,6 +78,12 @@ public class SendMailController {
|
|||
cuserDao.addMailSeriaNo(serialNo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if (rPCClient != null){
|
||||
rPCClient.returnObject(serviceKey);
|
||||
}else{
|
||||
LOGGER.info("callback=> rPCClient is null ");
|
||||
}
|
||||
}
|
||||
}
|
||||
ResultVo resultVo;
|
||||
|
|
Loading…
Reference in New Issue