[SNMP4J] Counter and Config Files
Mark Gorokhov
mark.gorokhov at comtechmobile.com
Wed May 9 23:16:08 CEST 2007
You could modify TestAgent with "nice" shutdown using the following
code:
Find the code in the TestAgent.main()
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException ex1) {
break;
}
}
and replace it to
try {
BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
while (true) {
// Prompt to "err" to show it in red in Eclipse console:
System.err.print("Type 'exit' to exit> ");
String str = in.readLine();
if ("exit".equals(str)) {
System.exit(0);
}
}
} catch (IOException e) {
// ignore
}
BTW, Eclipse console allows entering "exit" to stop TestAgent.
Mark G.
More information about the SNMP4J
mailing list