/[projects]/miscJava/thn_mqutils/src/main/java/com/traiana/utils/mq/MQDepth.java
ViewVC logotype

Diff of /miscJava/thn_mqutils/src/main/java/com/traiana/utils/mq/MQDepth.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2739 by torben, Fri Oct 2 10:14:15 2015 UTC revision 2740 by torben, Fri Oct 2 14:24:36 2015 UTC
# Line 8  public class MQDepth Line 8  public class MQDepth
8          public static void main(String[] args)          public static void main(String[] args)
9          {          {
10                  int depth = 0;                  int depth = 0;
11                    boolean debug = false;
12    
13                  int warning = 2147483647;                  int warning = 2147483647;
14                  int critical = 2147483647;                                        int critical = 2147483647;                      
# Line 16  public class MQDepth Line 17  public class MQDepth
17                          System.out.println("usage: java com.traiana.utils.mq.MQDepth [qmgr] [port] [mqServerName] [channelName] [queueName] {-w [warning threshold]} {-c [critical threshold]} {-debug}");                          System.out.println("usage: java com.traiana.utils.mq.MQDepth [qmgr] [port] [mqServerName] [channelName] [queueName] {-w [warning threshold]} {-c [critical threshold]} {-debug}");
18                          System.exit(3);                          System.exit(3);
19                  }                  }
                 MQ sender = null;  
                 try {  
20    
21                          boolean debug = false;                  for (int i = 4; i < args.length; i++) {
22                          for (int i = 4; i < args.length; i++) {                          String arg = args[i];
23                                  String arg = args[i];                          if (arg.equals("-w"))
24                                  if (arg.equals("-w"))                                  warning = Integer.parseInt(args[(i + 1)]);
25                                          warning = Integer.parseInt(args[(i + 1)]);                          else if (arg.equals("-c"))
26                                  else if (arg.equals("-c"))                                  critical = Integer.parseInt(args[(i + 1)]);
27                                          critical = Integer.parseInt(args[(i + 1)]);                          else if (arg.equals("-debug"))
28                                  else if (arg.equals("-debug"))                                  debug = true;
29                                          debug = true;                  }
30                          }  
31                          sender = new MQ(args[0], Integer.parseInt(args[1]), args[2], args[3], 0, debug);                  String qmgr = args[0];
32                          sender.InitQueue(args[4], true);                  int port = Integer.parseInt(args[1]);
33                    String mqServerName = args[2];
34                    String channelName = args[3];
35                    String queueName = args[4];
36                    
37                    
38                    try (MQ sender = new MQ(qmgr, port, mqServerName, channelName, 0, debug) ) {
39    
40                            sender.InitQueue(queueName, true);
41                          depth = sender.getDepth();                          depth = sender.getDepth();
42    
43    
# Line 38  public class MQDepth Line 45  public class MQDepth
45                          //e.printStackTrace();                          //e.printStackTrace();
46                          System.out.println( e.getClass().getName() + ": " + e.getMessage() );                          System.out.println( e.getClass().getName() + ": " + e.getMessage() );
47                          System.exit(3);                          System.exit(3);
                 } finally {  
                         if (sender != null)  
                                 try {  
                                         sender.close();  
                                 } catch (MQException e) {  
                                         e.printStackTrace();  
                                 }  
48                  }                  }
49    
50                  if (depth < warning) {                  if (depth < warning) {

Legend:
Removed from v.2739  
changed lines
  Added in v.2740

  ViewVC Help
Powered by ViewVC 1.1.20