@@ -112,19 +112,22 @@ private void updateMetricsWithWildcards(PCFMessage[] pcfResponse) {
112
112
/**
113
113
* Retrieves info about all objects from input array via direct pcf commands.
114
114
*
115
- * @param objectNames - input array with objects.
115
+ * @param objectNames - input list with objects.
116
116
*/
117
- private void updateWithDirectPCFCommand (ArrayList <String > objectNames ) {
117
+ private void updateWithDirectPCFCommand (List <String > objectNames ) {
118
118
for (String objectName : objectNames ) {
119
119
MQObject directObject = new MQObject (objectName , object .getType ());
120
120
try {
121
121
PCFMessage [] directPCFResponse = agent .send (directObject .getPcfCmd ());
122
122
updateMetricWithoutWildcards (directPCFResponse [0 ], objectName );
123
123
} catch (PCFException e ) {
124
124
//This error means, that channel has status "inactive".
125
- if (e .reasonCode == MQConstants .MQRCCF_CHL_STATUS_NOT_FOUND ) {
125
+ if (object . getType () == MQObject . MQType . CHANNEL && e .reasonCode == MQConstants .MQRCCF_CHL_STATUS_NOT_FOUND ) {
126
126
logger .warn ("Channel {} is possibly inactive." , objectName );
127
127
MetricsManager .updateMetric (MetricsReference .getMetricName (object .getType ()), MetricsReference .getMetricValue (object .getType (), MQConstants .MQCHS_INACTIVE ), queueManagerName , objectName );
128
+ } else if (object .getType () == MQObject .MQType .LISTENER && e .reasonCode == MQConstants .MQRC_UNKNOWN_OBJECT_NAME ) {
129
+ MetricsManager .updateMetric (MetricsReference .getMetricName (object .getType ()), MetricsReference .getMetricValue (object .getType (), MQConstants .MQSVC_STATUS_STOPPED ), queueManagerName , objectName );
130
+ logger .warn ("Listener {} is possibly stopped." , objectName );
128
131
} else {
129
132
logger .error ("Error occurred during sending PCF command: " , e );
130
133
}
@@ -139,7 +142,7 @@ public void run() {
139
142
try {
140
143
logger .debug ("Sending PCF command for object type {} with name {}..." , object .getType (), object .getName ());
141
144
PCFMessage [] pcfResponse = agent .send (object .getPcfCmd ());
142
- if (!objects .isEmpty ()) {
145
+ if (objects != null && !objects .isEmpty ()) {
143
146
updateMetricsWithWildcards (pcfResponse );
144
147
} else {
145
148
for (PCFMessage response : pcfResponse ) {
@@ -148,13 +151,14 @@ public void run() {
148
151
}
149
152
logger .debug ("PCF response for object type {} with name {} was processed successfully." , object .getType (), object .getName ());
150
153
} catch (PCFException e ) {
151
- if (e .reasonCode == MQConstants .MQRCCF_CHL_STATUS_NOT_FOUND ) {
154
+ if (object . getType () == MQObject . MQType . CHANNEL && e .reasonCode == MQConstants .MQRCCF_CHL_STATUS_NOT_FOUND ) {
152
155
logger .warn ("Channel {} is possibly inactive." , object .getName ());
153
156
MetricsManager .updateMetric (MetricsReference .getMetricName (object .getType ()), MetricsReference .getMetricValue (object .getType (), MQConstants .MQCHS_INACTIVE ), queueManagerName , object .getName ());
154
- }
155
- if (object .getType () == MQObject .MQType .LISTENER && e .reasonCode == MQConstants .MQRC_UNKNOWN_OBJECT_NAME ) {
157
+ } else if (object .getType () == MQObject .MQType .LISTENER && e .reasonCode == MQConstants .MQRC_UNKNOWN_OBJECT_NAME ) {
156
158
MetricsManager .updateMetric (MetricsReference .getMetricName (object .getType ()), MetricsReference .getMetricValue (object .getType (), MQConstants .MQSVC_STATUS_STOPPED ), queueManagerName , object .getName ());
157
159
logger .warn ("Listener {} is possibly stopped." , object .getName ());
160
+ } else {
161
+ logger .error ("Error occurred during sending PCF command: " , e );
158
162
}
159
163
} catch (MQException | IOException e ) {
160
164
logger .error ("Error occurred during sending PCF command: " , e );
0 commit comments