Package com.sun.messaging.jmq.jmsclient

Examples of com.sun.messaging.jmq.jmsclient.GenericPortMapperClient


     *
     * @return The relevant JMXServiceURL that is advertised by the
     * portmapper.
     */
    public JMXServiceURL getJMXServiceURL() throws JMException {
  GenericPortMapperClient pmc;
  JMXMQAddress mqAddr;
  JMXServiceURL url;
  String addr = null, urlString, host, connectorName;
  int port;

  try  {
      addr = getCurrentConfiguration().getProperty(
      AdminConnectionConfiguration.imqAddress);

      mqAddr = JMXMQAddress.createAddress(addr);
      host = mqAddr.getHostName();
      port = mqAddr.getPort();
      connectorName = mqAddr.getServiceName();

      /*
      System.out.println("ACF: address used: " + addr);
      System.out.println("\thost: " + host);
      System.out.println("\tport: " + port);
      System.out.println("\tconnector: " + connectorName);
      */

  } catch (Exception e)  {
      JMException jme
    = new JMException("Caught exception when parsing address: "
          + addr);
      jme.initCause(e);

      throw (jme);
  }

  /*
  System.out.println("host: " + host);
  System.out.println("port: " + port);
  System.out.println("connectorName: " + connectorName);
  */

  try  {
      pmc = new GenericPortMapperClient(host, port);

      /*
       * Should add code to check/compare version of client runtime and
       * broker here.
       */

  } catch (Exception e)  {
      JMException jme
    = new JMException("Caught exception when contacing portmapper.");
      jme.initCause(e);

      throw (jme);
  }

  urlString = pmc.getProperty("url", null, "JMX", connectorName);

  if (urlString == null)  {
      JMException jme = new JMException("No JMXServiceURL was found for connector "
      + connectorName + ".\n"
      + "Address used: "
View Full Code Here


     * Returns true if a wait was performed.
     * Returns false if no waiting was done - return immediately.
     */
    private boolean waitForShutdown(BrokerAdmin broker, String waitSessionID,
        BrokerCmdProperties brokerCmdProps)  {
  GenericPortMapperClient pmc = null;
  String hostName = broker.getBrokerHost(),
    portString = broker.getBrokerPort(),
    sessionID = null;
  int port, shutdownDelaySecs;
  long sleepTime;

  /*
   * Don't wait if don't have broker props
   */
  if (brokerCmdProps == null)  {
      return (false);
  }

  sleepTime = brokerCmdProps.getShutdownWaitInterval();
  shutdownDelaySecs = brokerCmdProps.getTime();

  /*
   * Don't wait if delayed shutdown (ie 'imqcmd shutdown bkr' used with -time <non-zero time>)
   */
  if (shutdownDelaySecs > 0)  {
      return (false);
  }

  /*
   * Don't wait if cannot identify the specific broker to wait for.
   */
  if (waitSessionID == null)  {
      return (false);
  }

  try  {
      port = Integer.parseInt(portString);
  } catch(Exception e)  {
      port = 7676;
  }

  boolean brokerDown = false;
  int count = 0;

  Globals.stdOutPrintln(ar.getString(ar.I_JMQCMD_WAITING_FOR_SHUTDOWN,
        hostName + ":" + portString));
  while (!brokerDown)  {
      try  {
    Thread.sleep(sleepTime);
      } catch (Exception e)  {
      }

      try  {
          pmc = new GenericPortMapperClient(hostName, port);
      } catch(Exception e)  {
          brokerDown = true;
      }

      if (pmc != null)  {
          sessionID = pmc.getProperty("sessionid", null, "PORTMAPPER", "portmapper");

    if (sessionID == null)  {
        brokerDown = true;
    } else if (!sessionID.equals(waitSessionID))  {
        brokerDown = true;
View Full Code Here

 
  return (true);
    }

    private String getPortMapperSessionID(BrokerCmdProperties brokerCmdProps, BrokerAdmin broker)  {
  GenericPortMapperClient pmc;
  String hostName = broker.getBrokerHost(),
    portString = broker.getBrokerPort(),
    sessionID = null;
  int port;


  try  {
      port = Integer.parseInt(portString);
  } catch(Exception e)  {
      port = 7676;
  }

  try  {
      pmc = new GenericPortMapperClient(hostName, port);
      sessionID = pmc.getProperty("sessionid", null, "PORTMAPPER", "portmapper");
  } catch(Exception e)  {
  }

  return (sessionID);
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsclient.GenericPortMapperClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.