...
|
...
|
@@ -3,6 +3,9 @@ |
|
|
*/
|
|
|
package com.yoho.unions.server.restapi;
|
|
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
...
|
...
|
@@ -29,6 +32,8 @@ public class ActivateUnionRest { |
|
|
|
|
|
static Logger log = LoggerFactory.getLogger(ActivateUnionRest.class);
|
|
|
|
|
|
static ExecutorService exe = Executors.newFixedThreadPool(50);
|
|
|
|
|
|
/**
|
|
|
* 激活联盟
|
|
|
* @param request
|
...
|
...
|
@@ -39,27 +44,37 @@ public class ActivateUnionRest { |
|
|
log.info("addUnion with param is {}", vo);
|
|
|
ActivateUnionRequestBO bo = new ActivateUnionRequestBO();
|
|
|
BeanUtils.copyProperties(vo, bo);
|
|
|
MainUnionService service = null;
|
|
|
//处理安卓的服务
|
|
|
for (String str : UnionConstant.andriodServiceList) {
|
|
|
//捕获异常,不影响后面的联盟
|
|
|
try {
|
|
|
service = SpringContextUtil.getBean(str, MainUnionService.class);
|
|
|
service.activeUnion(bo);
|
|
|
} catch (Exception e) {
|
|
|
log.warn("addUnion error with param is {}", vo);
|
|
|
}
|
|
|
}
|
|
|
//处理iOS的服务
|
|
|
for (String str : UnionConstant.iOSServiceList) {
|
|
|
//捕获异常,不影响后面的联盟
|
|
|
try {
|
|
|
service = SpringContextUtil.getBean(str, MainUnionService.class);
|
|
|
service.activeUnion(bo);
|
|
|
} catch (Exception e) {
|
|
|
log.warn("addUnion error with param is {}", vo);
|
|
|
|
|
|
//多线程处理
|
|
|
exe.execute(new Runnable() {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
MainUnionService service = null;
|
|
|
//处理安卓的服务
|
|
|
for (String str : UnionConstant.andriodServiceList) {
|
|
|
//捕获异常,不影响后面的联盟
|
|
|
try {
|
|
|
service = SpringContextUtil.getBean(str, MainUnionService.class);
|
|
|
service.activeUnion(bo);
|
|
|
} catch (Exception e) {
|
|
|
log.warn("addUnion error with param is {}", vo);
|
|
|
}
|
|
|
}
|
|
|
//处理iOS的服务
|
|
|
for (String str : UnionConstant.iOSServiceList) {
|
|
|
//捕获异常,不影响后面的联盟
|
|
|
try {
|
|
|
service = SpringContextUtil.getBean(str, MainUnionService.class);
|
|
|
service.activeUnion(bo);
|
|
|
} catch (Exception e) {
|
|
|
log.warn("addUnion error with param is {}", vo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
return new ActiveUnionResponseBO(200, "success");
|
|
|
}
|
|
|
} |
...
|
...
|
|