no message

main
이범준 5 months ago
parent 02a996ff1d
commit 83c5da5899

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,134 +1,130 @@
/* */ import java.io.BufferedInputStream;
/* */ import java.io.BufferedOutputStream;
/* */ import java.io.BufferedReader;
/* */ import java.io.FileInputStream;
/* */ import java.io.InputStream;
/* */ import java.io.InputStreamReader;
/* */ import java.net.HttpURLConnection;
/* */ import java.net.URL;
/* */ import java.util.Properties;
/* */ import org.apache.log4j.Logger;
/* */ import org.apache.log4j.PropertyConfigurator;
/* */ import org.json.simple.JSONObject;
/* */
/* */
/* */ public class CallServerStatusInfo
/* */ {
/* 17 */ private String[] g_strFTP = new String[6];
/* 18 */ private final Logger logger = Logger.getLogger(CallServerStatusInfo.class);
/* */
/* */
/* */ public CallServerStatusInfo() {
/* 22 */ PropertyConfigurator.configure("./log4j.properties");
/* */
/* */
/* */ try {
/* 26 */ String propFile = "./config.properties";
/* */
/* */
/* 29 */ Properties props = new Properties();
/* */
/* */
/* 32 */ FileInputStream fis = new FileInputStream(propFile);
/* */
/* */
/* 35 */ props.load(new BufferedInputStream(fis));
/* */
/* */
/* 38 */ this.g_strFTP[0] = props.getProperty("server_type_code");
/* 39 */ this.g_strFTP[4] = props.getProperty("api_url_server_stat");
/* */
/* 41 */ props.clear();
/* 42 */ props = null;
/* */
/* 44 */ JSONObject jsonParam = new JSONObject();
/* 45 */ jsonParam.put("sysTyCode", this.g_strFTP[0]);
/* 46 */ jsonParam.put("sysSttuscode", "2");
/* 47 */ callApi(jsonParam.toJSONString());
/* */ }
/* 49 */ catch (Exception e) {
/* 50 */ this.logger.info("Exception : " + e);
/* */ }
/* */ }
/* */
/* */
/* */ private void callApi(String strJson) {
/* 56 */ HttpURLConnection connection = null;
/* 57 */ InputStream is = null;
/* 58 */ InputStreamReader isr = null;
/* 59 */ BufferedReader br = null;
/* */
/* */ try {
/* 62 */ URL url = new URL(this.g_strFTP[4]);
/* 63 */ this.logger.info("==== 수집서버 주소 : " + this.g_strFTP[4]);
/* */
/* 65 */ connection = (HttpURLConnection)url.openConnection();
/* */
/* 67 */ connection.setDoInput(true);
/* 68 */ connection.setDoOutput(true);
/* 69 */ connection.setUseCaches(false);
/* 70 */ connection.setRequestMethod("POST");
/* */
/* 72 */ connection.setConnectTimeout(30000);
/* */
/* 74 */ connection.setReadTimeout(30000);
/* */
/* */
/* */
/* 78 */ connection.setRequestProperty("Accept", "application/json");
/* 79 */ connection.setRequestProperty("Content-Type", "application/json");
/* */
/* */
/* 82 */ BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
/* 83 */ bos.write(strJson.getBytes("UTF-8"));
/* 84 */ bos.flush();
/* 85 */ bos.close();
/* */
/* 87 */ int resCode = connection.getResponseCode();
/* 88 */ StringBuffer sb = new StringBuffer();
/* 89 */ String inputLine = null;
/* */
/* 91 */ this.logger.info("==== : " + resCode);
/* 92 */ if (resCode == 200) {
/* 93 */ is = connection.getInputStream();
/* 94 */ isr = new InputStreamReader(is, "UTF-8");
/* 95 */ br = new BufferedReader(isr);
/* */
/* 97 */ while ((inputLine = br.readLine()) != null) {
/* 98 */ sb.append(inputLine);
/* */ }
/* */
/* 101 */ this.logger.info("==== " + sb.toString());
/* */ }
/* 103 */ else if (connection.getErrorStream() != null) {
/* 104 */ br = new BufferedReader(new InputStreamReader(connection.getErrorStream(), "UTF-8"));
/* */
/* 106 */ while ((inputLine = br.readLine()) != null) {
/* 107 */ sb.append(inputLine);
/* */ }
/* 109 */ this.logger.info("==== Http Error Resopnse : " + sb.toString());
/* */ } else {
/* 111 */ this.logger.info("==== Http Error Resopnse : " + sb.toString());
/* */ }
/* */
/* 114 */ } catch (Exception e) {
/* 115 */ this.logger.info("Exception : " + e);
/* 116 */ this.logger.info("==== Http Error Resopnse : ");
/* */ } finally {
/* */ try {
/* 119 */ if (is != null)
/* 120 */ is.close();
/* 121 */ if (isr != null)
/* 122 */ isr.close();
/* 123 */ if (br != null)
/* 124 */ br.close();
/* 125 */ } catch (Exception exception) {}
/* */ }
/* */ }
/* */ }
/* Location: C:\Users\XIT_LBJ\Desktop\ \ \3 \car\\ServerStatusSend.jar!\CallServerStatusInfo.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.json.simple.JSONObject;
public class CallServerStatusInfo
{
private String[] g_strFTP = new String[6];
private final Logger logger = Logger.getLogger(CallServerStatusInfo.class);
public CallServerStatusInfo() {
PropertyConfigurator.configure("./log4j.properties");
try {
String propFile = "./config.properties";
Properties props = new Properties();
FileInputStream fis = new FileInputStream(propFile);
props.load(new BufferedInputStream(fis));
this.g_strFTP[0] = props.getProperty("server_type_code");
this.g_strFTP[4] = props.getProperty("api_url_server_stat");
props.clear();
props = null;
JSONObject jsonParam = new JSONObject();
jsonParam.put("sysTyCode", this.g_strFTP[0]);
jsonParam.put("sysSttuscode", "2");
callApi(jsonParam.toJSONString());
}
catch (Exception e) {
this.logger.info("Exception : " + e);
}
}
private void callApi(String strJson) {
HttpURLConnection connection = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader br = null;
try {
URL url = new URL(this.g_strFTP[4]);
this.logger.info("==== 수집서버 주소 : " + this.g_strFTP[4]);
connection = (HttpURLConnection)url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setRequestMethod("POST");
connection.setConnectTimeout(30000);
connection.setReadTimeout(30000);
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
bos.write(strJson.getBytes("UTF-8"));
bos.flush();
bos.close();
int resCode = connection.getResponseCode();
StringBuffer sb = new StringBuffer();
String inputLine = null;
this.logger.info("==== : " + resCode);
if (resCode == 200) {
is = connection.getInputStream();
isr = new InputStreamReader(is, "UTF-8");
br = new BufferedReader(isr);
while ((inputLine = br.readLine()) != null) {
sb.append(inputLine);
}
this.logger.info("==== " + sb.toString());
}
else if (connection.getErrorStream() != null) {
br = new BufferedReader(new InputStreamReader(connection.getErrorStream(), "UTF-8"));
while ((inputLine = br.readLine()) != null) {
sb.append(inputLine);
}
this.logger.info("==== Http Error Resopnse : " + sb.toString());
} else {
this.logger.info("==== Http Error Resopnse : " + sb.toString());
}
} catch (Exception e) {
this.logger.info("Exception : " + e);
this.logger.info("==== Http Error Resopnse : ");
} finally {
try {
if (is != null)
is.close();
if (isr != null)
isr.close();
if (br != null)
br.close();
} catch (Exception exception) {}
}
}
}

@ -1,80 +1,77 @@
/* */ import java.io.BufferedInputStream;
/* */ import java.io.FileInputStream;
/* */ import java.util.ArrayList;
/* */ import java.util.Date;
/* */ import java.util.Properties;
/* */ import org.apache.log4j.Logger;
/* */ import org.apache.log4j.PropertyConfigurator;
/* */ import org.quartz.Job;
/* */ import org.quartz.JobExecutionContext;
/* */ import org.quartz.JobExecutionException;
/* */ import org.quartz.JobKey;
/* */
/* */ public class DumbJob
/* */ implements Job
/* */ {
/* */ private String jobSays;
/* */ private float myFloatValue;
/* */ private ArrayList<Date> state;
/* 19 */ private final Logger logger = Logger.getLogger(DumbJob.class);
/* */
/* */ public DumbJob() {
/* 22 */ PropertyConfigurator.configure("./log4j.properties");
/* */
/* */
/* */ try {
/* 26 */ String propFile = "./config.properties";
/* */
/* */
/* 29 */ Properties props = new Properties();
/* */
/* */
/* 32 */ FileInputStream fis = new FileInputStream(propFile);
/* */
/* */
/* 35 */ props.load(new BufferedInputStream(fis));
/* */
/* 37 */ props.clear();
/* 38 */ props = null;
/* 39 */ } catch (Exception e) {
/* 40 */ this.logger.debug("Exception : " + e);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void execute(JobExecutionContext context) throws JobExecutionException {
/* 51 */ JobKey key = context.getJobDetail().getKey();
/* 52 */ this.state.add(new Date());
/* */
/* 54 */ this.logger.info("Instance " + key + " of DmbJob says: " + this.jobSays + ", and val is: " + this.myFloatValue +
/* 55 */ ", state size:" + this.state.size() + "," + this.state.get(this.state.size() - 1));
/* */
/* 57 */ this.logger.info("서버 상태정보 전송 시작");
/* 58 */ CallServerStatusInfo obj = new CallServerStatusInfo();
/* 59 */ this.logger.info("서버 상태정보 전송 완료");
/* */ }
/* */
/* */
/* */ public void setJobSays(String jobSays) {
/* 64 */ this.jobSays = jobSays;
/* */ }
/* */
/* */ public void setMyFloatValue(float myFloatValue) {
/* 68 */ this.myFloatValue = myFloatValue;
/* */ }
/* */
/* */ public void setState(ArrayList<Date> state) {
/* 72 */ this.state = state;
/* */ }
/* */ }
/* Location: C:\Users\XIT_LBJ\Desktop\ \ \3 \car\\ServerStatusSend.jar!\DumbJob.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;
public class DumbJob
implements Job
{
private String jobSays;
private float myFloatValue;
private ArrayList<Date> state;
private final Logger logger = Logger.getLogger(DumbJob.class);
public DumbJob() {
PropertyConfigurator.configure("./log4j.properties");
try {
String propFile = "./config.properties";
Properties props = new Properties();
FileInputStream fis = new FileInputStream(propFile);
props.load(new BufferedInputStream(fis));
props.clear();
props = null;
} catch (Exception e) {
this.logger.debug("Exception : " + e);
}
}
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobKey key = context.getJobDetail().getKey();
this.state.add(new Date());
this.logger.info("Instance " + key + " of DmbJob says: " + this.jobSays + ", and val is: " + this.myFloatValue +
", state size:" + this.state.size() + "," + this.state.get(this.state.size() - 1));
this.logger.info("서버 상태정보 전송 시작");
CallServerStatusInfo obj = new CallServerStatusInfo();
this.logger.info("서버 상태정보 전송 완료");
}
public void setJobSays(String jobSays) {
this.jobSays = jobSays;
}
public void setMyFloatValue(float myFloatValue) {
this.myFloatValue = myFloatValue;
}
public void setState(ArrayList<Date> state) {
this.state = state;
}
}

@ -1,75 +1,60 @@
/* */ import java.util.ArrayList;
/* */ import org.quartz.CronScheduleBuilder;
/* */ import org.quartz.CronTrigger;
/* */ import org.quartz.JobBuilder;
/* */ import org.quartz.JobDetail;
/* */ import org.quartz.ScheduleBuilder;
/* */ import org.quartz.Scheduler;
/* */ import org.quartz.SchedulerException;
/* */ import org.quartz.Trigger;
/* */ import org.quartz.TriggerBuilder;
/* */ import org.quartz.impl.StdSchedulerFactory;
/* */
/* */ public class ServerStatusSend
/* */ {
/* */ public static void main(String[] args) {
/* 16 */ String str = "*/1 * * * * ?";
/* 17 */ if (args.length > 0) {
/* 18 */ str = String.format("*/%s * * * * ?", new Object[] { args[0] });
/* */ }
/* */
/* 21 */ ServerStatusSend svr = new ServerStatusSend();
/* 22 */ svr.runServerStatus(str);
/* */ }
/* */
/* */ public void runServerStatus(String str) {
/* */ try {
/* 27 */ ArrayList<String> state = new ArrayList<>();
/* */
/* */
/* */
/* */
/* */
/* 33 */ JobDetail job = JobBuilder.newJob(DumbJob.class)
/* 34 */ .withIdentity("testJob")
/* 35 */ .usingJobData("jobSays", "ant.xml")
/* 36 */ .usingJobData("myFloatValue", Float.valueOf(3.141F)).build();
/* */
/* 38 */ job.getJobDataMap().put("state", state);
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 48 */ CronTrigger cronTrigger =
/* 49 */ (CronTrigger)TriggerBuilder.newTrigger()
/* 50 */ .withIdentity("crontrigger", "crontriggergroup1")
/* 51 */ .withSchedule(
/* */
/* 53 */ (ScheduleBuilder)CronScheduleBuilder.cronSchedule("0 */4 * * * ?"))
/* 54 */ .build();
/* */
/* */
/* 57 */ StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory();
/* 58 */ Scheduler sch = stdSchedulerFactory.getScheduler();
/* */
/* */
/* 61 */ sch.start();
/* 62 */ sch.scheduleJob(job, (Trigger)cronTrigger);
/* */
/* */ }
/* 65 */ catch (SchedulerException e) {
/* 66 */ e.printStackTrace();
/* */ }
/* */ }
/* */ }
/* Location: C:\Users\XIT_LBJ\Desktop\ \ \3 \car\\ServerStatusSend.jar!\ServerStatusSend.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
import java.util.ArrayList;
import org.quartz.CronScheduleBuilder;
import org.quartz.CronTrigger;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.ScheduleBuilder;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;
public class ServerStatusSend
{
public static void main(String[] args) {
ServerStatusSend svr = new ServerStatusSend();
svr.runServerStatus("");
}
public void runServerStatus(String str) {
try {
ArrayList<String> state = new ArrayList<>();
JobDetail job = JobBuilder.newJob(DumbJob.class)
.withIdentity("testJob")
.usingJobData("jobSays", "ant.xml")
.usingJobData("myFloatValue", Float.valueOf(3.141F)).build();
job.getJobDataMap().put("state", state);
CronTrigger cronTrigger =
(CronTrigger)TriggerBuilder.newTrigger()
.withIdentity("crontrigger", "crontriggergroup1")
.withSchedule(
(ScheduleBuilder)CronScheduleBuilder.cronSchedule("0 */4 * * * ?"))
.build();
StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory();
Scheduler sch = stdSchedulerFactory.getScheduler();
sch.start();
sch.scheduleJob(job, cronTrigger);
}
catch (SchedulerException e) {
e.printStackTrace();
}
}
}

Loading…
Cancel
Save