Package org.objectweb.joram.client.jms

Examples of org.objectweb.joram.client.jms.ConnectionFactory


      String password = specImpl.getPassword();
      String identityClass = specImpl.getIdentityClass();

      createUser(userName, password, identityClass);

      ConnectionFactory cf = null;

      if (isHa) {
        if (collocated) {
          if (haURL != null) {
            cf = HATcpConnectionFactory.create(haURL);
          } else {
            cf = HALocalConnectionFactory.create();
          }
        } else {
          cf = HATcpConnectionFactory.create("hajoram://" + hostName + ':' + serverPort);
        }
      }  else {
        if (collocated)
          cf = LocalConnectionFactory.create();
        else
          cf = TcpConnectionFactory.create(hostName, serverPort);
      }

      cf.getParameters().connectingTimer = connectingTimer;
      cf.getParameters().cnxPendingTimer = cnxPendingTimer;
      cf.getParameters().txPendingTimer = txPendingTimer;

      if (queueMessageReadMax > 0) {
        cf.getParameters().queueMessageReadMax = queueMessageReadMax;
      }

      if (topicAckBufferMax > 0) {
        cf.getParameters().topicAckBufferMax = topicAckBufferMax;
      }

      if (topicPassivationThreshold > 0) {
        cf.getParameters().topicPassivationThreshold = topicPassivationThreshold;
      }

      if (topicActivationThreshold > 0) {
        cf.getParameters().topicActivationThreshold = topicActivationThreshold;
      }

      // set identity class for this connectionFactory.
      cf.setIdentityClassName(identityClass);

      XAConnection cnx = cf.createXAConnection(userName, password);
     
      // set Exception listener
      cnx.setExceptionListener(this);
     
      if (logger.isLoggable(BasicLevel.DEBUG))
View Full Code Here


    if (stopped)
      throw new IllegalStateException("Stopped resource adapter.");

    ActivationSpecImpl specImpl;
    String userName;
    ConnectionFactory cf = null;
    XAConnection connection;
    Vector resources = new Vector();

    if (connections == null)
      connections = new Hashtable();

    try {
      for (int i = 0; i < specs.length; i++) {
        if (! (specs[i] instanceof ActivationSpecImpl))
          throw new ResourceException("Provided ActivationSpec instance is not a JORAM activation spec.");

        specImpl = (ActivationSpecImpl) specs[i];

        if (! specImpl.getResourceAdapter().equals(this))
          throw new ResourceException("Supplied ActivationSpec instance associated to an other ResourceAdapter.");

        userName = specImpl.getUserName();

        // The connection does not already exist: creating it.
        if (! connections.containsKey(userName)) {
          String password = specImpl.getPassword();
          String identityClass = specImpl.getIdentityClass();

          if (isHa) {
            if (collocated) {
              if (logger.isLoggable(BasicLevel.DEBUG))
                logger.log(BasicLevel.DEBUG, "haURL = " + haURL);
              if (haURL != null) {
                cf = HATcpConnectionFactory.create(haURL);
              } else {
                cf = HALocalConnectionFactory.create();
              }
            } else {
              String urlHa = "hajoram://" + hostName + ":" + serverPort;
              cf = HATcpConnectionFactory.create(urlHa);
            }
          }  else {
            if (collocated)
              cf = LocalConnectionFactory.create();
            else
              cf = TcpConnectionFactory.create(hostName, serverPort);
          }

          cf.getParameters().connectingTimer = connectingTimer;
          cf.getParameters().cnxPendingTimer = cnxPendingTimer;
          cf.getParameters().txPendingTimer = txPendingTimer;

          // set identity class for this connectionFactory.
          cf.setIdentityClassName(identityClass);

          connection = cf.createXAConnection(userName, password);

          connections.put(userName, connection);

          resources.add(connection.createXASession().getXAResource());
        }
View Full Code Here

    User.create("anonymous", "anonymous", 0);
    User.create("anonymous", "anonymous", 1);
    User.create("anonymous", "anonymous", 2);

    ConnectionFactory cf0 = (ConnectionFactory) TcpConnectionFactory.create("localhost", 16010);
    ConnectionFactory cf1 = (ConnectionFactory) TcpConnectionFactory.create("localhost", 16011);
    ConnectionFactory cf2 = (ConnectionFactory) TcpConnectionFactory.create("localhost", 16012);

    ictx.bind("cf0", cf0);
    ictx.bind("cf1", cf1);
    ictx.bind("cf2", cf2);
View Full Code Here

TOP

Related Classes of org.objectweb.joram.client.jms.ConnectionFactory

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.