Create new JMS connection.
@return connection
@throws JMSException
775673
protected void createConnection() throws JMSException {
        if (connection == null) {
            if (!endpointConfiguration.isPubSubDomain() && endpointConfiguration.getConnectionFactory() instanceof QueueConnectionFactory) {
                connection = ((QueueConnectionFactory) endpointConfiguration.getConnectionFactory()).createQueueConnection();
            } else if (endpointConfiguration.isPubSubDomain() && endpointConfiguration.getConnectionFactory() instanceof TopicConnectionFactory) {
                connection = ((TopicConnectionFactory) endpointConfiguration.getConnectionFactory()).createTopicConnection();
                connection.setClientID(getName());
            } else {
                log.warn("Not able to create a connection with connection factory '" + endpointConfiguration.getConnectionFactory() + "'" +
                        " when using setting 'publish-subscribe-domain' (=" + endpointConfiguration.isPubSubDomain() + ")");

                connection = endpointConfiguration.getConnectionFactory().createConnection();
            }

            connection.start();
        }
    }
276802
JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map _passThruProps) throws JMSException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection);
    JmsQueueConnectionImpl jmsQueueConnection = new JmsQueueConnectionImpl(jcaConnection, isManaged(), _passThruProps);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection",  jmsQueueConnection);
    return jmsQueueConnection;
  }
56530
public function connect()
    {
        if (!$this->connection) {
            $errNum = $errStr = null;
            $this->connection = @fsockopen($this->host, $this->port, $errNum, $errStr, $this->options['timeout']);

            if (!$this->connection or $errNum > 0) {
                $message = sprintf(
                    'Could not connect to beanstalkd "%s:%d": %s (%d)',
                    $this->host,
                    $this->port,
                    $errStr,
                    $errNum
                );
                throw new Exception\SocketException($message);
            }

            // remove timeout on the stream, allows blocking reserve
            stream_set_timeout($this->connection, -1, 0);
        }

        return $this;
    }
492875
protected Connection createConnection(Socket socket, InputStream inputStream,
			OutputStream outputStream) throws IOException {
		return new Connection(socket, inputStream, outputStream);
	}
1017467
public function connect()
    {

          //if port is not set, try and determine based on transport
        if(!is_numeric($this->port)){
            if(substr($this->host, 0, 3) == 'ssl'){
                $this->port = 5223;
                $this->log("Connecting with SSL");

            } else {
                $this->port = 5222;
            }
        }

        parent::__construct($this->host.':'.$this->port, $this->timeout);

        $this->open();

        //begin stream
        $this->write("<stream:stream to='$this->host' xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en' version='1.0'>");

        $this->read();
        $this->read();

        $this->connected = true;

    }
179487
protected void createSession(Connection connection) throws JMSException {
        if (session == null) {
            if (!endpointConfiguration.isPubSubDomain() && connection instanceof QueueConnection) {
                session = ((QueueConnection) connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            } else if (endpointConfiguration.isPubSubDomain() && endpointConfiguration.getConnectionFactory() instanceof TopicConnectionFactory) {
                session = ((TopicConnection) connection).createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            } else {
                log.warn("Not able to create a session with connection factory '" + endpointConfiguration.getConnectionFactory() + "'" +
                        " when using setting 'publish-subscribe-domain' (=" + endpointConfiguration.isPubSubDomain() + ")");

                session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            }
        }
    }
22489
@Override
    public Session createSession() throws JMSException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createSession");

        Session session = null;
        try {
            session = createSession(false, Session.AUTO_ACKNOWLEDGE);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createSession");
        }

        return session;
    }
1347871
@Override
	public QueueConnection createQueueConnection() throws JMSException
    {
    	String username = getStringProperty(Context.SECURITY_PRINCIPAL,null); 
    	String password = getStringProperty(Context.SECURITY_CREDENTIALS,null);
    	
        return createQueueConnection(username,password);
    }
369520
@Override
	public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
    {
    	throw new IllegalStateException("Method not available on this domain.");
    }
497295
public function connect()
    {
        $this->_service = new SplMemcached();
        $this->_service->addServer($this->_host, $this->_port);
        $stats = $this->_service->getStats();
        if (isset($stats[$this->_host.":".$this->_port])) {
            $this->_connected = true;
        } else {
            throw new ServiceException(
                "Unable to connect to Memcached service"
            );
        }

        return $this;
    }
598537
private MBeanServerConnection createServerConnection(String host, int port) throws IOException {
            jmxServiceURL = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi");
            JMXConnector jmxc = JMXConnectorFactory.connect(jmxServiceURL, null);
            return jmxc.getMBeanServerConnection();            
    }
1309889
@Override
    public JmsQueueConnectionFactory createQueueConnectionFactory() throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createQueueConnectionFactory");
        JmsQueueConnectionFactory jmsqcf = null;

        // get a jca managed queue connection factory, which is used to construct
        // the jms queue connection factory.
        JmsJcaManagedQueueConnectionFactory jcamqcf = JmsJcaFactory.getInstance().createManagedQueueConnectionFactory();

        // invoke the construction of a jms queue connection factory - the jca
        // managed queue connection factory will call back into the jms api code
        // by getting a JmsRAFactoryFactory, and calling a create jms queue
        // connection factory method on it with jca connection factory and jca
        // managed queue connection factory objects as parameters (the jms qcf
        // will keep references to the jca cf and jca mqcf).
        try {
            jmsqcf = (JmsQueueConnectionFactory) jcamqcf.createConnectionFactory();
        } catch (ResourceException re) {
            // No FFDC code needed
            // d222942 review - no documentation for when a RE will be thrown, so
            // default exception ok. (A quick look at the RA suggests the exception isn't
            // ever thrown).
            // d238447 FFDC review. Comment above suggests an FFDC ok for this case.
            throw (JMSException) JmsErrorUtils.newThrowable(
                                                            JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0007",
                                                            new Object[] { re, "JmsFactoryFactoryImpl.createQueueConnectionFactory (#1)" },
                                                            re,
                                                            "JmsFactoryFactoryImpl.createQueueConnectionFactory#1",
                                                            this,
                                                            tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createQueueConnectionFactory", jmsqcf);
        return jmsqcf;
    }
1245454
static protected function create_connection($name)
    {
        # If the connection is already created, return.
        if (isset(self::$_connections[$name]))
            return;
        elseif (self::connectionExists($name))
            self::$_connections[$name] = new Connection(self::$_connection_data[$name], $name);
        else
            throw new Exception\RuntimeException(
                sprintf("Connection '%s' does not exist", $name)
            );
    }
201615
@Override
    public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException {
        connectionLock.readLock().lock();
        try {
            ManagedSession managedSession = new ManagedSession(
                    getConnection().createSession(transacted, acknowledgeMode),
                    transacted,
                    acknowledgeMode,
                    connectionDefinition.isJeeMode(),
                    this);
            sessions.add(managedSession);
            return managedSession;
        } finally {
            connectionLock.readLock().unlock();
        }
    }
223125
public synchronized PacketTransportEndpoint createEndpoint() throws JMSException
    {
        if (closed || transport.isClosed())
            throw new FFMQException("Transport is closed", "TRANSPORT_CLOSED");
        
        PacketTransportEndpoint endpoint = new PacketTransportEndpoint(nextEndpointId++, this);
        registeredEndpoints.put(Integer.valueOf(endpoint.getId()), endpoint);
        return endpoint;
    }
1241353
@Override
    public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool,
            int maxMessages) throws JMSException {
        throw new JMSException(SQSMessagingClientConstants.UNSUPPORTED_METHOD);
    }
1272770
@Override
    public ConnectionFactory createConnectionFactory(JmsJcaConnectionFactory jcaConnectionFactory) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createConnectionFactory", jcaConnectionFactory);
        ConnectionFactory cf = new JmsManagedConnectionFactoryImpl(jcaConnectionFactory);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createConnectionFactory", cf);
        return cf;
    }