template;
+
+ /**
+ * 构建临时任务队列,固定任务队列锁
+ *
+ * 区分锁,避免高并发下锁释放的错误
+ */
+ public static RedisLock Fix_Lock;
+
+ public static RedisLock Tmp_Lock;
+
+ /**
+ * 针对数据获取的时候添加锁
+ */
+ private static final String LOCK_TMP_NAME = "TMP_lock";
+
+ private static final String LOCK_FIXATION_NAME = "FIXATION_lock";
+
+ /**
+ * 等待获取锁的时间5 S
+ */
+ private static final Long WAIT_LOCK_TIME = 5000L;
+
+ /**
+ * 固定任务
+ */
+ private static final String FIXATION_WORK = "FIXATION_WORK";
+
+ /**
+ * 临时任务
+ */
+ private static final String TMP_WORK = "TMP_WORK";
+
+ /**
+ * 回执消息任务
+ */
+ @Deprecated
+ private static final String ACK_WORK = "ACK_WORK";
+
+ public SycnQueue(RedisTemplate template) {
+ this.template = template;
+ Fix_Lock = new RedisLock(template);
+ Tmp_Lock = new RedisLock(template);
+ }
+
+ /**
+ * @Description:固定任务 {@link ModelType#GET}
+ *
+ * 固定任务执行效率跟任务链表的长度有关系
+ *
@param model
+ * @return
+ * 创建人:maliang
+ * 创建时间:2017年3月13日
+ * 修改人:
+ * 修改时间:
+ */
+ private Boolean pushFixationWork(ChannelData data) {
+ Long tag = template.opsForList().leftPush(FIXATION_WORK, data);
+ return tag >= 1;
+ }
+
+ private ChannelData pullFixationData() {
+ // 添加锁
+ try {
+ if (Fix_Lock.acquireLock(LOCK_FIXATION_NAME, WAIT_LOCK_TIME)) {
+ ChannelData obj = (ChannelData) template.opsForList().rightPopAndLeftPush(FIXATION_WORK, FIXATION_WORK);
+ return obj;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (Fix_Lock != null) {
+ Fix_Lock.releaseLock();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * @Description:临时任务
+ *
+ * {@link ModelType#ADD ModelType#UPDATE ModelType#DEL}
+ *
@param model
+ * @return
+ * 创建人:maliang
+ * 创建时间:2017年3月13日
+ * 修改人:
+ * 修改时间:
+ */
+ private boolean pushTempWork(ChannelData data) {
+ Long tag = template.opsForList().leftPush(TMP_WORK, data);
+ return tag >= 1;
+ }
+
+ /**
+ * @Description:临时队列数据弹出
+ * @return
+ * 创建人:maliang
+ * 创建时间:2017年3月13日
+ * 修改人:
+ * 修改时间:
+ */
+ private ChannelData pullTempData() {
+
+ try {
+ if (Tmp_Lock.acquireLock(LOCK_TMP_NAME, WAIT_LOCK_TIME)) {
+ Serializable object = template.opsForList().rightPop(TMP_WORK);
+ return object != null ? (ChannelData) object : null;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (Tmp_Lock != null) {
+ try {
+ Tmp_Lock.releaseLock();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @Description:将任务信息添加到队列中,任务分为固定任务,临时任务,目前拉取数据的任务为固定任务
+ * {@link ModelType#GET}
+ * @param model
+ * @return
+ * 创建人:maliang
+ * 创建时间:2017年3月13日
+ * 修改人:
+ * 修改时间:
+ */
+ public Boolean push(ChannelData data) {
+ if (template == null || data == null)
+ return Boolean.FALSE;
+ // 设置任务添加时间
+ /*
+ * model.setTs(System.currentTimeMillis()); String modelType =
+ * model.getType(); if (ModelType.isGet(modelType)) { return
+ * this.pushFixationWork(model); } else { return
+ * this.pushTempWork(model); }
+ */
+ boolean loop = data.getLoop();
+ return loop ? this.pushFixationWork(data) : this.pushTempWork(data);
+ }
+
+ /**
+ * @Description:获取队列中的数据
+ *
+ *
@param type
+ * @return
+ * 创建人:maliang
+ * 创建时间:2017年3月13日
+ * 修改人:
+ * 修改时间:
+ */
+ public ChannelData pull(boolean loop) {
+ // boolean loop = data != null && data.getLoop();
+ return loop ? this.pullFixationData() : this.pullTempData();
+ /*
+ * if (ModelType.isGet(type)) { return this.pullFixationModel(); } else
+ * { return this.pullTempModel(); }
+ */
+ }
+
+ public RedisTemplate getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(RedisTemplate template) {
+ this.template = template;
+ }
+
+}
diff --git a/core.sdk/src/main/java/com/lyms/sycn/queue/package-info.java b/core.sdk/src/main/java/com/lyms/sycn/queue/package-info.java
new file mode 100644
index 0000000..4e71164
--- /dev/null
+++ b/core.sdk/src/main/java/com/lyms/sycn/queue/package-info.java
@@ -0,0 +1,15 @@
+/**
+ * @Title: package-info.java
+ * @Package com.lyms.sycn.queue
+ * @Description: TODO(文件描述)
+ * @author maliang
+ * @date 2017年3月16日
+ */
+/**
+ * @ClassName: package-info
+ * @Description: TODO(类描述)
+ * @author maliang
+ * @date 2017年3月16日
+ *
+ */
+package com.lyms.sycn.queue;
\ No newline at end of file
diff --git a/core.sdk/src/main/java/com/lyms/synch/ParamsHandler.java b/core.sdk/src/main/java/com/lyms/synch/ParamsHandler.java
deleted file mode 100644
index 2ca0804..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/ParamsHandler.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.lyms.synch;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-
-import com.lyms.util.JsonUtils;
-
-/**
- * @ClassName: ParamsHandler
- * @Description: 参数处理
- * @author maliang
- * @date 2017年3月15日
- *
- */
-public class ParamsHandler implements Serializable {
-
- /**
- */
- private static final long serialVersionUID = 7048461500310029490L;
- private List params = new LinkedList<>();
-
- public ParamsHandler() {
- }
-
- public static ParamsHandler builder() {
- return new ParamsHandler();
- }
-
- public String toJsonString() {
- return JsonUtils.beanToJson(this);
- }
-
- public ParamsHandler push(Object obj) {
- if (obj == null) {
- params.add(new Param(Object.class.getName(), "null"));
- } else {
- params.add(new Param(obj.getClass().getName(), obj));
- }
- return this;
- }
-
- public static class Param implements Serializable {
- /**
- */
- private static final long serialVersionUID = -1634342674830431814L;
- private String className;
- private Object obj;
-
- public Param() {
- };
-
- public Param(String className, Object obj) {
- this.className = className;
- this.obj = obj;
- }
-
- public String getClassName() {
- return className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public Object getObj() {
- return obj;
- }
-
- public void setObj(Object obj) {
- this.obj = obj;
- }
- }
-
- public List getParams() {
- return params;
- }
-
- public void setParams(List params) {
- this.params = params;
- }
-
-}
diff --git a/core.sdk/src/main/java/com/lyms/synch/SycnHandler.java b/core.sdk/src/main/java/com/lyms/synch/SycnHandler.java
deleted file mode 100644
index a6165d9..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/SycnHandler.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.lyms.synch;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.lyms.spring.SpringContextHolder;
-import com.lyms.synch.ParamsHandler.Param;
-import com.lyms.synch.entity.ChannelData;
-import com.lyms.util.JsonUtils;
-
-/**
- *
- * @ClassName: SyncHandler
- * @Description: 处理器
- * @author maliang
- * @date 2017年3月15日
- *
- */
-public class SycnHandler {
-
- private static Logger LOG = LoggerFactory.getLogger(SycnHandler.class);
-
- public static Object handler(ChannelData data) {
- try {
- return invoke(data);
- } catch (Exception e) {
- LOG.error("执行方法错误: {}", e);
- return false;
- }
- }
-
- private static Object invoke(ChannelData data)
- throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- if (data == null)
- return null;
-
- Class> clazz = getClazz(data.getRemoteClazz());
- if (clazz == null)
- return null;
- Object tagetObject = getObject(clazz);
- Method method = getMethod(clazz, data.getRemoteMethod());
-
- return excute(tagetObject, method, data.getData());
- }
-
- private static Object excute(Object object, Method method, String params)
- throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException {
- if (method == null || object == null)
- return null;
- Object[] objs = null;
- if (StringUtils.isNotBlank(params)) {
- ParamsHandler handler = JsonUtils.jsonToBean(params, ParamsHandler.class);
- if (handler != null) {
- List ps = handler.getParams();
- objs = new Object[ps.size()];
- if (ps != null && !ps.isEmpty()) {
- int i = 0;
- for (Param p : ps) {
- String clazz = p.getClassName();
- String value = p.getObj().toString();
- if (value.equalsIgnoreCase("null")) {
- objs[i] = null;
- } else {
- // 做数据类型匹配,尽量多的排除基本类型
- // 针对业务出现的数据类型做处理 TODO
- if (clazz.equals(String.class.getName()) || clazz.equals(Integer.class.getName())
- || clazz.equals(Long.class.getName()) || clazz.equals(Boolean.class.getName())) {
- objs[i] = value;
- } else {
- Object tmp = JsonUtils.jsonToBean(value, getClazz(clazz));
- objs[i] = tmp;
- }
-
- }
- i++;
- }
- }
-
- }
- }
- // System.out.println(ToStringBuilder.reflectionToString(objs));
- return method.invoke(object, objs);
-
- }
-
- private static Class> getClazz(String clazz) throws ClassNotFoundException {
- if (StringUtils.isNotBlank(clazz)) {
- return Class.forName(clazz);
- }
- return null;
- }
-
- private static Object getObject(Class> clazz) {
- return SpringContextHolder.getBean(clazz);
- }
-
- private static Method getMethod(Class> clazz, String methodName) {
- for (Method method : clazz.getDeclaredMethods()) {
- if (method.getName().equalsIgnoreCase(methodName)) {
- return method;
- }
- }
- return null;
- }
-
-}
diff --git a/core.sdk/src/main/java/com/lyms/synch/SyncCallback.java b/core.sdk/src/main/java/com/lyms/synch/SyncCallback.java
deleted file mode 100644
index 0a9c660..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/SyncCallback.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.lyms.synch;
-
-/**
- * @ClassName: CenterCallback
- * @Description: 数据回调
- * @author maliang
- * @date 2017年3月14日
- *
- */
-public interface SyncCallback {
- public void callBack(Object object);
-}
diff --git a/core.sdk/src/main/java/com/lyms/synch/SyncUtils.java b/core.sdk/src/main/java/com/lyms/synch/SyncUtils.java
deleted file mode 100644
index 69f0a55..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/SyncUtils.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.lyms.synch;
-
-import java.io.ObjectInputStream;
-
-import javax.servlet.http.HttpServletRequest;
-
-import com.lyms.synch.entity.ChannelData;
-
-/**
- * @ClassName: SyncUtils
- * @Description: 同步辅助处理类
- * @author maliang
- * @date 2017年3月14日
- *
- */
-public class SyncUtils {
-
- public static ChannelData conver(HttpServletRequest request) {
- ChannelData model = ChannelData.emtpy();
- try {
- request.setCharacterEncoding("utf-8");
- ObjectInputStream dis = new ObjectInputStream(request.getInputStream());
- model = (ChannelData) dis.readObject();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return model;
- }
-
-}
diff --git a/core.sdk/src/main/java/com/lyms/synch/SyncnCenter.java b/core.sdk/src/main/java/com/lyms/synch/SyncnCenter.java
deleted file mode 100644
index c722b7e..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/SyncnCenter.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package com.lyms.synch;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
-import com.lyms.synch.entity.ChannelData;
-import com.lyms.synch.queue.SyncnQueue;
-import com.lyms.util.HttpUtils;
-
-/**
- * @ClassName: SyncnCenter
- * @Description: 数据同步中心,使用单例模式创建一个中心,中心依赖redis队列
- * @author maliang
- * @date 2017年3月13日
- *
- */
-public class SyncnCenter {
-
- public static ScheduledExecutorService scheduledPool = Executors.newScheduledThreadPool(5);
-
- public SyncnCenter() {
- }
-
- private static class inner {
- private static final SyncnCenter center = new SyncnCenter();
- }
-
- /**
- * 数据缓冲队列
- */
- private SyncnQueue queue;
-
- /**
- * @Description:创建一个中心
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- public static final SyncnCenter install() {
- return SyncnCenter.inner.center;
- }
-
- /**
- * @Description:构建一个工作器
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- public Work buildWork() {
- return new Work();
- }
-
- public class Work {
-
- public ChannelData data;
-
- // public CenterCallback callBack;
-
- public Work push(ChannelData data, SyncCallback callBack) {
- // this.model = model;
- Boolean tag = queue.push(data);
- callBack.callBack(tag);
- return this;
- }
-
- /**
- * @Description:固定任务队列
- *
- * 该方法不需要业务自行反压数据
- *
@param callBack
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- public Work pullFix(SyncCallback callBack) {
- // SyncnModel model = queue.pull(ModelType.GET);
- ChannelData data = queue.pull(true);
- this.data = data;
- callBack.callBack(data);
- return this;
- }
-
- /**
- * @Description:获取临时任务信息
- *
- * 该方法需要业务自行判断做数据反压
- *
@param callBack
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- public Work pullTmp(SyncCallback callBack) {
- ChannelData data = queue.pull(false);
- this.data = data;
- callBack.callBack(data);
- return this;
- }
-
- /**
- * @Description:数据反压
- *
- * 针对临时任务队列,如果业务逻辑处理失败,手动反压该数据,下次重新执行
- *
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- public void backPressure() {
- if (data == null)
- return;
- this.push(data, new SyncCallback() {
- boolean tag = false;
-
- @Override
- public void callBack(Object object) {
- tag = (Boolean) object;
-
- if (!tag) {
- backPressure();
- }
- }
- });
- }
-
- /**
- * @Description:回调方法,调用远端接口
- *
- * 该方法只有跟 {@link #pullFix(SyncCallback)} {@link #pullTmp(SyncCallback)}
- * 才有意义
- *
@return
- * 创建人:maliang
- * 创建时间:2017年3月14日
- * 修改人:
- * 修改时间:
- */
- public String ack(ChannelData ackData) {
- if (ackData != null) {
- HttpUtils.REMOTE.post(ackData);
- }
- return null;
- }
-
- }
-
- public SyncnQueue getQueue() {
- return queue;
- }
-
- public void setQueue(SyncnQueue queue) {
- this.queue = queue;
- }
-
-}
diff --git a/core.sdk/src/main/java/com/lyms/synch/entity/ChannelData.java b/core.sdk/src/main/java/com/lyms/synch/entity/ChannelData.java
deleted file mode 100644
index f9b2197..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/entity/ChannelData.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.lyms.synch.entity;
-
-import java.io.Serializable;
-
-import com.lyms.util.JsonUtils;
-import com.lyms.util.StrUtils;
-
-/**
- * @ClassName: ChannelData
- * @Description: 通道实体
- * @author maliang
- * @date 2017年3月15日
- *
- */
-public class ChannelData implements Serializable {
-
- /**
- */
- private static final long serialVersionUID = -4448732709523865922L;
-
- public ChannelData() {
- };
-
- public static ChannelData emtpy() {
- return new ChannelData();
- }
-
- /**
- * 数据传输ID
- */
- private String id;
-
- /**
- * remote address
- */
- private String remote;
-
- /**
- * remote class name
- */
- private String remoteClazz;
-
- /**
- * remote method name
- */
- private String remoteMethod;
-
- /**
- * remote body json
- */
- private String data;
-
- private Boolean loop = Boolean.FALSE;
-
- /**
- * 是否回执信息
- */
- private Boolean ack = Boolean.FALSE;
-
- /**
- * 创建时间
- */
- private Long ts;
-
- public ChannelData(String remote, String remoteClazz, String remoteMethod, String data, boolean loop) {
- this.id = StrUtils.uuid();
- this.remote = remote;
- this.remoteClazz = remoteClazz;
- this.remoteMethod = remoteMethod;
- this.data = data;
- this.ts = System.currentTimeMillis();
- this.loop = loop;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getRemote() {
- return remote;
- }
-
- public void setRemote(String remote) {
- this.remote = remote;
- }
-
- public String getRemoteClazz() {
- return remoteClazz;
- }
-
- public void setRemoteClazz(String remoteClazz) {
- this.remoteClazz = remoteClazz;
- }
-
- public String getRemoteMethod() {
- return remoteMethod;
- }
-
- public void setRemoteMethod(String remoteMethod) {
- this.remoteMethod = remoteMethod;
- }
-
- public String getData() {
- return data;
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
- public Long getTs() {
- return ts;
- }
-
- public void setTs(Long ts) {
- this.ts = ts;
- }
-
- public Boolean getLoop() {
- return loop;
- }
-
- public void setLoop(Boolean loop) {
- this.loop = loop;
- }
-
- public Boolean getAck() {
- return ack;
- }
-
- public void setAck(Boolean ack) {
- this.ack = ack;
- }
-
- public String toJsonString() {
- return JsonUtils.beanToJson(this);
- }
-
-}
diff --git a/core.sdk/src/main/java/com/lyms/synch/entity/package-info.java b/core.sdk/src/main/java/com/lyms/synch/entity/package-info.java
deleted file mode 100644
index 20d6694..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/entity/package-info.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * @ClassName: package-info
- * @Description: 数据模型
- * @author maliang
- * @date 2017年3月13日
- *
- */
-package com.lyms.synch.entity;
\ No newline at end of file
diff --git a/core.sdk/src/main/java/com/lyms/synch/package-info.java b/core.sdk/src/main/java/com/lyms/synch/package-info.java
deleted file mode 100644
index adae6bc..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/package-info.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @ClassName: package-info
- * @Description: 数据同步中心
- * @author maliang
- * @date 2017年3月13日
- *
- */
-package com.lyms.synch;
-
-// SyncnCenter.push(object);
-// SyncnCenter.pull(object).ack();
-// SyncnCenter.ack(object);
\ No newline at end of file
diff --git a/core.sdk/src/main/java/com/lyms/synch/queue/SyncnQueue.java b/core.sdk/src/main/java/com/lyms/synch/queue/SyncnQueue.java
deleted file mode 100644
index 77ed320..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/queue/SyncnQueue.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package com.lyms.synch.queue;
-
-import java.io.Serializable;
-
-import org.springframework.data.redis.core.RedisTemplate;
-
-import com.lyms.spring.redis.operation.RedisLock;
-import com.lyms.synch.entity.ChannelData;
-
-/**
- * @ClassName: SyncnQueue
- * @Description: 数据队列
- * @author maliang
- * @date 2017年3月13日
- *
- */
-public class SyncnQueue {
-
- public RedisTemplate template;
-
- /**
- * 构建临时任务队列,固定任务队列锁
- *
- * 区分锁,避免高并发下锁释放的错误
- */
- public static RedisLock Fix_Lock;
-
- public static RedisLock Tmp_Lock;
-
- /**
- * 针对数据获取的时候添加锁
- */
- private static final String LOCK_TMP_NAME = "TMP_lock";
-
- private static final String LOCK_FIXATION_NAME = "FIXATION_lock";
-
- /**
- * 等待获取锁的时间5 S
- */
- private static final Long WAIT_LOCK_TIME = 5000L;
-
- /**
- * 固定任务
- */
- private static final String FIXATION_WORK = "FIXATION_WORK";
-
- /**
- * 临时任务
- */
- private static final String TMP_WORK = "TMP_WORK";
-
- /**
- * 回执消息任务
- */
- @Deprecated
- private static final String ACK_WORK = "ACK_WORK";
-
- public SyncnQueue(RedisTemplate template) {
- this.template = template;
- Fix_Lock = new RedisLock(template);
- Tmp_Lock = new RedisLock(template);
- }
-
- /**
- * @Description:固定任务 {@link ModelType#GET}
- *
- * 固定任务执行效率跟任务链表的长度有关系
- *
@param model
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- private Boolean pushFixationWork(ChannelData data) {
- Long tag = template.opsForList().leftPush(FIXATION_WORK, data);
- return tag >= 1;
- }
-
- private ChannelData pullFixationData() {
- // 添加锁
- try {
- if (Fix_Lock.acquireLock(LOCK_FIXATION_NAME, WAIT_LOCK_TIME)) {
- ChannelData obj = (ChannelData) template.opsForList().rightPopAndLeftPush(FIXATION_WORK, FIXATION_WORK);
- return obj;
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- if (Fix_Lock != null) {
- Fix_Lock.releaseLock();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return null;
-
- }
-
- /**
- * @Description:临时任务
- *
- * {@link ModelType#ADD ModelType#UPDATE ModelType#DEL}
- *
@param model
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- private boolean pushTempWork(ChannelData data) {
- Long tag = template.opsForList().leftPush(TMP_WORK, data);
- return tag >= 1;
- }
-
- /**
- * @Description:临时队列数据弹出
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- private ChannelData pullTempData() {
-
- try {
- if (Tmp_Lock.acquireLock(LOCK_TMP_NAME, WAIT_LOCK_TIME)) {
- Serializable object = template.opsForList().rightPop(TMP_WORK);
- return object != null ? (ChannelData) object : null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (Tmp_Lock != null) {
- try {
- Tmp_Lock.releaseLock();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- return null;
- }
-
- /**
- * @Description:将任务信息添加到队列中,任务分为固定任务,临时任务,目前拉取数据的任务为固定任务
- * {@link ModelType#GET}
- * @param model
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- public Boolean push(ChannelData data) {
- if (template == null || data == null)
- return Boolean.FALSE;
- // 设置任务添加时间
- /*
- * model.setTs(System.currentTimeMillis()); String modelType =
- * model.getType(); if (ModelType.isGet(modelType)) { return
- * this.pushFixationWork(model); } else { return
- * this.pushTempWork(model); }
- */
- boolean loop = data.getLoop();
- return loop ? this.pushFixationWork(data) : this.pushTempWork(data);
- }
-
- /**
- * @Description:获取队列中的数据
- *
- *
@param type
- * @return
- * 创建人:maliang
- * 创建时间:2017年3月13日
- * 修改人:
- * 修改时间:
- */
- public ChannelData pull(boolean loop) {
- // boolean loop = data != null && data.getLoop();
- return loop ? this.pullFixationData() : this.pullTempData();
- /*
- * if (ModelType.isGet(type)) { return this.pullFixationModel(); } else
- * { return this.pullTempModel(); }
- */
- }
-
- public RedisTemplate getTemplate() {
- return template;
- }
-
- public void setTemplate(RedisTemplate template) {
- this.template = template;
- }
-
-}
diff --git a/core.sdk/src/main/java/com/lyms/synch/queue/package-info.java b/core.sdk/src/main/java/com/lyms/synch/queue/package-info.java
deleted file mode 100644
index 6277a44..0000000
--- a/core.sdk/src/main/java/com/lyms/synch/queue/package-info.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * @ClassName: package-info
- * @Description: 数据中心缓冲队列
- * @author maliang
- * @date 2017年3月13日
- *
- */
-package com.lyms.synch.queue;
\ No newline at end of file
diff --git a/core.sdk/src/main/java/com/lyms/util/remote/HttpRemote.java b/core.sdk/src/main/java/com/lyms/util/remote/HttpRemote.java
index 00e9571..c26a626 100644
--- a/core.sdk/src/main/java/com/lyms/util/remote/HttpRemote.java
+++ b/core.sdk/src/main/java/com/lyms/util/remote/HttpRemote.java
@@ -11,7 +11,7 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.SerializableEntity;
-import com.lyms.synch.entity.ChannelData;
+import com.lyms.sycn.channel.ChannelData;
/**
* http,https 远程调用