正在显示
1 个修改的文件
包含
6 行增加
和
17 行删除
| @@ -6,17 +6,13 @@ import com.caac.imf.api.IMFClient; | @@ -6,17 +6,13 @@ import com.caac.imf.api.IMFClient; | ||
| 6 | 6 | ||
| 7 | import redis.clients.jedis.Jedis; | 7 | import redis.clients.jedis.Jedis; |
| 8 | 8 | ||
| 9 | -import java.util.Properties; | ||
| 10 | 9 | ||
| 11 | public class AgentSender extends Thread{ | 10 | public class AgentSender extends Thread{ |
| 12 | 11 | ||
| 13 | private static final Logger logger = Logger.getLogger(AgentSender.class); | 12 | private static final Logger logger = Logger.getLogger(AgentSender.class); |
| 14 | - private static final String stype = "/MSG/META/STYP"; | ||
| 15 | 13 | ||
| 16 | public volatile boolean bool = false; | 14 | public volatile boolean bool = false; |
| 17 | Jedis jedis = new Jedis("10.50.3.73", 6379); | 15 | Jedis jedis = new Jedis("10.50.3.73", 6379); |
| 18 | - // Jedis jedis = new Jedis("192.168.0.253", 6379); | ||
| 19 | - public String str ; | ||
| 20 | 16 | ||
| 21 | private IMFClient client; | 17 | private IMFClient client; |
| 22 | 18 | ||
| @@ -24,8 +20,6 @@ public class AgentSender extends Thread{ | @@ -24,8 +20,6 @@ public class AgentSender extends Thread{ | ||
| 24 | this.client = client; | 20 | this.client = client; |
| 25 | } | 21 | } |
| 26 | 22 | ||
| 27 | - public AgentSender(){ | ||
| 28 | - } | ||
| 29 | 23 | ||
| 30 | public void run(){ | 24 | public void run(){ |
| 31 | logger.info(jedis); | 25 | logger.info(jedis); |
| @@ -34,15 +28,15 @@ public class AgentSender extends Thread{ | @@ -34,15 +28,15 @@ public class AgentSender extends Thread{ | ||
| 34 | if(Main.isSuc){ | 28 | if(Main.isSuc){ |
| 35 | if(Main.LOGIN_OK){ | 29 | if(Main.LOGIN_OK){ |
| 36 | String SendMsg = jedis.rpoplpush("task-queue", "tmp-queue"); //取队列消息 | 30 | String SendMsg = jedis.rpoplpush("task-queue", "tmp-queue"); //取队列消息 |
| 37 | - logger.info("队列消息为:》》》"+SendMsg); | ||
| 38 | - | ||
| 39 | - //9是发送成功 | ||
| 40 | - if(SendMsg !=null){ | ||
| 41 | 31 | ||
| 32 | + //队列消息不为NULL开始发送 | ||
| 33 | + if(SendMsg !=null && SendMsg.length() != 0){ | ||
| 34 | + logger.info("《《《已读取队列消息,请关注下方发送信息LOG回显》》》"); | ||
| 42 | try{ | 35 | try{ |
| 43 | String returnMsg = client.sendMSG(SendMsg); | 36 | String returnMsg = client.sendMSG(SendMsg); |
| 44 | logger.debug("<<发送返回的信息:"+returnMsg+">>"); | 37 | logger.debug("<<发送返回的信息:"+returnMsg+">>"); |
| 45 | 38 | ||
| 39 | + //9是发送成功 | ||
| 46 | if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ | 40 | if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ |
| 47 | jedis.rpop("tmp-queue"); | 41 | jedis.rpop("tmp-queue"); |
| 48 | logger.debug("<<移除队列>>"); | 42 | logger.debug("<<移除队列>>"); |
| @@ -56,6 +50,8 @@ public class AgentSender extends Thread{ | @@ -56,6 +50,8 @@ public class AgentSender extends Thread{ | ||
| 56 | logger.info("!!<<请注意!发送异常====>>!!"); | 50 | logger.info("!!<<请注意!发送异常====>>!!"); |
| 57 | } | 51 | } |
| 58 | 52 | ||
| 53 | + }else { | ||
| 54 | + logger.info("*********当前队列为空*********"); | ||
| 59 | } | 55 | } |
| 60 | 56 | ||
| 61 | }else{ | 57 | }else{ |
| @@ -71,11 +67,4 @@ public class AgentSender extends Thread{ | @@ -71,11 +67,4 @@ public class AgentSender extends Thread{ | ||
| 71 | } | 67 | } |
| 72 | } | 68 | } |
| 73 | 69 | ||
| 74 | - public String getStr() { | ||
| 75 | - return str; | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - public void setStr(String str) { | ||
| 79 | - this.str = str; | ||
| 80 | - } | ||
| 81 | } | 70 | } |
-
请 注册 或 登录 后发表评论