title: closing MQ connection
body: <p>Good afternoon, I wrote a project to Get Park Queue Info from the IBM MQ, it has producing an error when attempting to close the connection though. It is written in java.
  Under application in Event Viewer on the MQ machine it displays two errors. They are:</p>
  
  <p>“Channel program ended abnormally.
  Channel program ‘system.def.surconn’ ended abnormally. Look at previous error messages for channel program ‘system.def.surconn’ in the error files to determine the cause of the failure.</p>
  
  <p>The other message states:
  “Error on receive from host rnanaj (10.10.12.34)
  An error occurred receiving data from rnanaj (10.10.12.34) over tcp/ip. This may be due to a communications failure. The return code from tcp/ip recv() call was 10054 (X’2746’). Record these values.”</p>
  
  <p>This must be something how I try to connect or close the connection, below I have my code to connect and close, any ideas??</p>
  
  <p>Connect:</p>
  
  <pre><code>_logger.info("Start");
  
          File outputFile = new File(System.getProperty("PROJECT_HOME"), "run/" + this.getClass().getSimpleName() + "." + System.getProperty("qmgr") + ".txt");
          FileUtils.mkdirs(outputFile.getParentFile());
  
          Connection jmsConn = null;
          Session jmsSession = null;
          QueueBrowser queueBrowser = null;
          BufferedWriter commandsBw = null;
          try {
              // get queue connection
              MQConnectionFactory MQConn = new MQConnectionFactory();
              MQConn.setHostName(System.getProperty("host"));
              MQConn.setPort(Integer.valueOf(System.getProperty("port")));
              MQConn.setQueueManager(System.getProperty("qmgr"));
              MQConn.setChannel("SYSTEM.DEF.SVRCONN");
              MQConn.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
  
              jmsConn = (Connection) MQConn.createConnection();
              jmsSession = jmsConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
              Queue jmsQueue = jmsSession.createQueue("PARK");
  
              // browse thru messages
              queueBrowser = jmsSession.createBrowser(jmsQueue);
              Enumeration msgEnum = queueBrowser.getEnumeration();
  
              commandsBw = new BufferedWriter(new FileWriter(outputFile));
              //
              String line = "DateTime\tMsgID\tOrigMsgID\tCorrelationID\tComputerName\tSubsystem\tDispatcherName\tProcessor\tJobID\tErrorMsg";
              commandsBw.write(line);
              commandsBw.newLine();
  
              while (msgEnum.hasMoreElements()) {
                  Message message = (Message) msgEnum.nextElement();
                  line = dateFormatter.format(new Date(message.getJMSTimestamp()))
                          + "\t" + message.getJMSMessageID()
                          + "\t" + message.getStringProperty("pkd_orig_jms_msg_id")
                          + "\t" + message.getJMSCorrelationID()
                          + "\t" + message.getStringProperty("pkd_computer_name")
                          + "\t" + message.getStringProperty("pkd_subsystem")
                          + "\t" + message.getStringProperty("pkd_dispatcher_name")
                          + "\t" + message.getStringProperty("pkd_processor")
                          + "\t" + message.getStringProperty("pkd_job_id")
                          + "\t" + message.getStringProperty("pkd_sysex_msg");
                  _logger.info(line);
                  commandsBw.write(line);
                  commandsBw.newLine();
              }
  
          }
  </code></pre>
  
  <p>Close:</p>
  
  <pre><code>finally {
              IO.close(commandsBw);
              if (queueBrowser != null) { try { queueBrowser.close();} catch (Exception ignore) {}}
              if (jmsSession != null) { try { jmsSession.close();} catch (Exception ignore) {}}
              if (jmsConn != null) { try { jmsConn.stop();} catch (Exception ignore) {}}
          }
  </code></pre>