forked from scouter-project/scouter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scouter-project#226 from scouter-project/master
Merge for release
- Loading branch information
Showing
93 changed files
with
4,271 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package scouter.agent.batch; | ||
|
||
import java.io.File; | ||
|
||
import scouter.Version; | ||
import scouter.agent.batch.netio.data.net.UdpAgent; | ||
import scouter.agent.batch.netio.data.net.UdpLocalServer; | ||
import scouter.agent.batch.netio.request.ReqestHandlingProxy; | ||
import scouter.agent.batch.netio.service.net.TcpRequestMgr; | ||
import scouter.lang.pack.ObjectPack; | ||
import scouter.util.SysJMX; | ||
import scouter.util.ThreadUtil; | ||
import scouter.util.logo.Logo; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
Logo.print(true); | ||
System.out.println("Scouter Batch Agent Version " + Version.getServerFullVersion()); | ||
Logger.println("A01", "Scouter Batch Agent Version " + Version.getServerFullVersion()); | ||
|
||
ReqestHandlingProxy.load(ReqestHandlingProxy.class); | ||
UdpLocalServer.getInstance(); | ||
TcpRequestMgr.getInstance(); | ||
|
||
File exit = new File(SysJMX.getProcessPID() + ".scouter"); | ||
try { | ||
exit.createNewFile(); | ||
} catch (Exception e) { | ||
String tmp = System.getProperty("user.home", "/tmp"); | ||
exit = new File(tmp, SysJMX.getProcessPID() + ".scouter.run"); | ||
try { | ||
exit.createNewFile(); | ||
} catch (Exception k) { | ||
System.exit(1); | ||
} | ||
} | ||
exit.deleteOnExit(); | ||
System.out.println("System JRE version : " + System.getProperty("java.version")); | ||
long startTime = System.currentTimeMillis(); | ||
long currentTime; | ||
while (true) { | ||
currentTime = System.currentTimeMillis(); | ||
if((currentTime - startTime) >= 10000){ | ||
UdpAgent.sendUdpPack(getObjectPack()); | ||
startTime = currentTime; | ||
} | ||
if (exit.exists() == false) { | ||
System.exit(0); | ||
} | ||
ThreadUtil.sleep(1000); | ||
|
||
} | ||
|
||
} | ||
|
||
static public ObjectPack getObjectPack(){ | ||
Configure conf = Configure.getInstance(); | ||
ObjectPack pack = new ObjectPack(); | ||
pack.alive = true; | ||
pack.objHash = conf.getObjHash(); | ||
pack.objName = conf.getObjName(); | ||
pack.objType = conf.obj_type; | ||
pack.version = Version.getAgentFullVersion(); | ||
return pack; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.