...
|
...
|
@@ -19,34 +19,43 @@ public class IMF_Task { |
|
|
public static boolean LOGIN_OK = false;
|
|
|
public static boolean isSuc = true;
|
|
|
public static IMFClient client = null;
|
|
|
public static String loginname;
|
|
|
public static String loginpass;
|
|
|
public static String isNeedSend = "N";
|
|
|
|
|
|
|
|
|
@Scheduled(fixedRate = 5000)
|
|
|
private static void start() throws Exception {
|
|
|
PropertyConfigurator.configure("config/log4j.properties");
|
|
|
client = IMFClientFactory.createInstance();
|
|
|
String loginname = FileTool.readProperties("loginname");
|
|
|
String loginpass = FileTool.readProperties("loginpass");
|
|
|
loginname= FileTool.readProperties("loginname");
|
|
|
loginpass= FileTool.readProperties("loginpass");
|
|
|
isNeedSend= FileTool.readProperties("isNeedSend");
|
|
|
|
|
|
|
|
|
if (client != null) {
|
|
|
IMF_Reader reader = new IMF_Reader(client);
|
|
|
if (!IMF_Reader.isrunning) {
|
|
|
reader.start();
|
|
|
logger.info("*********KAKO读取线程已开启***********");
|
|
|
} else {
|
|
|
// logger.info("*********KAKO读取线程已开启-不再启动线程*********");
|
|
|
}
|
|
|
//登录
|
|
|
if (!LOGIN_OK) {
|
|
|
loginIMF(client, loginname, loginpass, "config/imf_config.properties");
|
|
|
}
|
|
|
|
|
|
//启动读取线程
|
|
|
if (client != null) {
|
|
|
IMF_Reader reader = new IMF_Reader(client);
|
|
|
if (!IMF_Reader.isrunning) {
|
|
|
reader.start();
|
|
|
logger.info("*********读取线程已开启***********");
|
|
|
} else {
|
|
|
// logger.info("*********读取线程已开启-不再启动线程*********");
|
|
|
}
|
|
|
|
|
|
if("Y".equals(isNeedSend)){
|
|
|
IMF_Sender kako_sender = new IMF_Sender(client);
|
|
|
if(!IMF_Sender.isrunning) {
|
|
|
// kako_sender.start();
|
|
|
kako_sender.start();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!LOGIN_OK) {
|
|
|
loginIMF(client, loginname, loginpass, "config/imf_config.properties");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
@@ -54,6 +63,7 @@ public class IMF_Task { |
|
|
if (!msg.equals(null) && !msg.isEmpty()){
|
|
|
if(LOGIN_OK){
|
|
|
IMF_Sender sender = new IMF_Sender(client,msg);
|
|
|
sender.setContent(msg);
|
|
|
sender.start();
|
|
|
}
|
|
|
|
...
|
...
|
|