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