forked from RunningJon/outsourcer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAgentD.java
executable file
·105 lines (80 loc) · 1.8 KB
/
AgentD.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import java.sql.*;
import java.net.*;
import java.io.*;
public class AgentD
{
private static String myclass = "AgentD";
public static boolean debug = false;
public static void main(String[] args) throws Exception
{
String method = "main";
int location = 1000;
String configFile = args[0];
Connection conn = null;
location = 2000;
try
{
location = 3000;
conn = CommonDB.connectGP(configFile);
location = 3100;
Statement stmt = conn.createStatement();
location = 3200;
String strSQL = "VACUUM os.job";
location = 3300;
stmt.executeUpdate(strSQL);
location = 3400;
strSQL = "SELECT os.fn_start_schedule()";
location = 3500;
stmt.executeQuery(strSQL);
location = 3600;
conn.close();
if (debug)
Logger.printMsg("Start to loop....");
loadLoop(configFile);
}
catch (SQLException ex)
{
throw new SQLException("(" + myclass + ":" + method + ":" + location + ":" + ex.getMessage() + ")");
}
finally
{
if (conn != null)
conn.close();
}
}
private static void loadLoop(String configFile) throws Exception
{
String method = "loadLoop";
int location = 1000;
boolean loop = true;
Connection conn = null;
while (loop)
{
try
{
location = 2000;
conn = CommonDB.connectGP(configFile);
location = 2100;
Statement stmt = conn.createStatement();
location = 2200;
String strSQL = "SELECT os.fn_schedule()";
location = 2300;
stmt.executeQuery(strSQL);
location = 2400;
conn.close();
location = 3000;
Thread.sleep(10000);
}
catch (SQLException ex)
{
Logger.printMsg("(" + method + ":" + location + ":" + ex.getMessage() + ")");
Thread.sleep(10000);
}
finally
{
if (conn != null)
conn.close();
}
}
}
}