Gets the connection proximity

@return The connection proximity
@see com.ibm.websphere.sib.api.jms.JmsConnectionFactory#getConnectionProximity
322196
@Override
    public String getConnectionProximity() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getConnectionProximity");
        String connectionProximity = jcaConnectionFactory.getConnectionProximity();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getConnectionProximity", connectionProximity);
        return connectionProximity;
    }
996451
public static Connection getconnnection() {
		Connection con = null;
		try {
			con = DriverManager.getConnection(url, userName, password);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return con;
	}
791570
public java.util.List<WorkspaceConnectionStatus> getWorkspacesConnectionStatus() {
        if (workspacesConnectionStatus == null) {
            workspacesConnectionStatus = new com.amazonaws.internal.SdkInternalList<WorkspaceConnectionStatus>();
        }
        return workspacesConnectionStatus;
    }
178477
public NetworkConnectionType getCurrentConnectionType() {
        NetworkInfo activeNetworkInfo = getActiveNetworkInfo();

        if (activeNetworkInfo == null || !isInternetAccessAvailable()) {
            return NetworkConnectionType.NO_CONNECTION;
        }
        switch (activeNetworkInfo.getType()) {
            case ConnectivityManager.TYPE_WIFI:
                return NetworkConnectionType.WIFI;
            case ConnectivityManager.TYPE_MOBILE:
                return NetworkConnectionType.MOBILE;
            case ConnectivityManager.TYPE_WIMAX:
                return NetworkConnectionType.WIMAX;
            case ConnectivityManager.TYPE_ETHERNET:
                return NetworkConnectionType.ETHERNET;
            default:
                return NetworkConnectionType.NO_CONNECTION;
        }
    }
713133
public static synchronized GeoLocationManager getInstanceFor(XMPPConnection connection) {
        GeoLocationManager geoLocationManager = INSTANCES.get(connection);
        if (geoLocationManager == null) {
            geoLocationManager = new GeoLocationManager(connection);
            INSTANCES.put(connection, geoLocationManager);
        }
        return geoLocationManager;
    }
679796
public Map<String, Object> getInboundConnectionInfo() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "getInboundConnectionInfo");
        Map<String, Object> inboundConnectionInfo = ThreadManager.getInstance().getInboundConnectionInfo();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "getInboundConnectionInfo", inboundConnectionInfo);
        return inboundConnectionInfo;
    }
523842
@Override
    public SICoreConnection getSICoreConnection() throws IllegalStateException {

        if (connectionClosed) {
            throw new IllegalStateException(NLS.getFormattedMessage(
                                                                    ("ILLEGAL_STATE_CWSJR1086"),
                                                                    new Object[] { "getSICoreConnection" }, null));
        }
        return _coreConnection;

    }
1324154
@Override
	public Connection getConnection() {
		try {
			String jdbcUrl = props.get(PROPS_JDBC_URL);
			String jdbcUser = props.get(PROPS_JDBC_USER);
			String jdbcPassword = props.get(PROPS_JDBC_PASSWORD);

			Connection connection = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);

			String schema = getSchema();
			if (schema != null) {
				connection.setSchema(schema);
			}
			connection.setAutoCommit(getAutoCommit());
			connection.setReadOnly(getReadOnly());
			int transactionIsolation = getTransactionIsolation();
			if (transactionIsolation > 0) {
				connection.setTransactionIsolation(transactionIsolation);
			}
			return connection;
		} catch (SQLException ex) {
			ex.printStackTrace();
			return null;
		}
	}
1099774
private Connection getConnection(ConnectionRequestContext context) throws SQLException {
        concurrentConnectionRequestCountHistogram.update(concurrentConnectionRequestCount.incrementAndGet());
        long startNanos = System.nanoTime();
        try {
            Connection connection = null;
            if (!connectionAcquiringStrategies.isEmpty()) {
                for (ConnectionAcquiringStrategy strategy : connectionAcquiringStrategies) {
                    try {
                        connection = strategy.getConnection(context);
                        break;
                    } catch (AcquireTimeoutException e) {
                        LOGGER.warn("Couldn't retrieve connection from strategy {} with context {}", strategy, context);
                    }
                }
            } else {
                connection = poolAdapter.getConnection(context);
            }
            if (connection != null) {
                return connectionProxyFactory.newInstance(connection, this);
            } else {
                throw new CantAcquireConnectionException("Couldn't acquire connection for current strategies: " + connectionAcquiringStrategies);
            }
        } finally {
            long endNanos = System.nanoTime();
            long acquireDurationMillis = TimeUnit.NANOSECONDS.toMillis(endNanos - startNanos);
            connectionAcquireTotalTimer.update(acquireDurationMillis, TimeUnit.MILLISECONDS);
            concurrentConnectionRequestCountHistogram.update(concurrentConnectionRequestCount.decrementAndGet());
            if (acquireDurationMillis > connectionAcquireTimeThresholdMillis) {
                eventPublisher.publish(new ConnectionAcquireTimeThresholdExceededEvent(
                        uniqueName, connectionAcquireTimeThresholdMillis, acquireDurationMillis
                ));
                LOGGER.info("Connection acquired in {} millis, while threshold is set to {} in {} FlexyPoolDataSource",
                        acquireDurationMillis, connectionAcquireTimeThresholdMillis, uniqueName);
            }
        }
    }
659828
@Override
    public String getProducerPreferLocal() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getProducerPreferLocal");

        String producerPreferLocal = (String) properties.get(PRODUCER_PREFER_LOCAL);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getProducerPreferLocal", producerPreferLocal);
        return producerPreferLocal;
    }
321614
public java.security.Principal getUserPrincipal()
    {
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        IWebAppSecurityCollaborator webAppSec=null;
        if (getDispatchContext()!=null && getDispatchContext().getWebApp() != null) {
            webAppSec = CollaboratorHelperImpl.getCurrentSecurityCollaborator(getDispatchContext().getWebApp());
        } else {
            webAppSec = CollaboratorHelperImpl.getCurrentSecurityCollaborator();           
        } 
            
        if (webAppSec != null) {
            if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){  //306998.15
                logger.logp(Level.FINE, CLASS_NAME,"getUserPrincipal", "calling getUserPrincipal on " + webAppSec.getClass().getName());
            }
            return webAppSec.getUserPrincipal();
        } else {
            if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){  //306998.15
                logger.logp(Level.FINE, CLASS_NAME,"getUserPrincipal", "returning null");
            }
            // No IWebAppSecurityCollaborator means no security, so no Principal 
            return null;
        }
    }
495652
@Override
    public String[] getconnectionFactories() {

        final String methodName = "getconnectionFactories()";
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(tc, methodName, this);

        final Collection<JCAConnectionFactoryMBeanImpl> c = cfMBeanChildrenList.values();
        final int size = c.size();
        final String[] result = new String[size];
        int index = 0;
        for (JCAConnectionFactoryMBeanImpl mbeanItem : c)
            result[index++] = mbeanItem.getobjectName();

        if (trace && tc.isEntryEnabled())
            Tr.exit(tc, methodName, this);
        return result;
    }
198207
public Map getConnectionProperties()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            SibTr.entry(tc, "getConnectionProperties");
            SibTr.exit(tc, "getConnectionProperties", _connectionProperties);
        }
        return _connectionProperties;
    }
445
public String getLocalAddr() {
		final SIPTransaction sipTransaction = (SIPTransaction)getTransaction();
		if(sipTransaction != null) {
			return sipTransaction.getHost();
		} else {
			final String transport = JainSipUtils.findTransport(message);
			final MobicentsExtendedListeningPoint listeningPoint = sipFactoryImpl.getSipNetworkInterfaceManager().findMatchingListeningPoint(transport, false);
			return listeningPoint.getHost(true);
		}
	}
758698
protected final XMPPConnection getAuthenticatedConnectionOrThrow() throws NotLoggedInException {
        XMPPConnection connection = connection();
        if (!connection.isAuthenticated()) {
            throw new NotLoggedInException();
        }
        return connection;
    }
1054091
protected HttpURLConnection getConnection() {
        try {
            HttpURLConnection connection;
            if (proxy != null) {
                connection = (HttpURLConnection) sentryUrl.openConnection(proxy);
            } else {
                connection = (HttpURLConnection) sentryUrl.openConnection();
            }

            if (bypassSecurity && connection instanceof HttpsURLConnection) {
                ((HttpsURLConnection) connection).setHostnameVerifier(NAIVE_VERIFIER);
            }
            connection.setRequestMethod("POST");
            connection.setDoOutput(true);
            connection.setConnectTimeout(connectionTimeout);
            connection.setReadTimeout(readTimeout);
            connection.setRequestProperty(USER_AGENT, SentryEnvironment.getSentryName());
            connection.setRequestProperty(SENTRY_AUTH, getAuthHeader());

            if (marshaller.getContentType() != null) {
                connection.setRequestProperty("Content-Type", marshaller.getContentType());
            }

            if (marshaller.getContentEncoding() != null) {
                connection.setRequestProperty("Content-Encoding", marshaller.getContentEncoding());
            }

            return connection;
        } catch (IOException e) {
            throw new IllegalStateException("Couldn't set up a connection to the Sentry server.", e);
        }
    }
639925
protected MCWrapper getSharedConnection(
                                            Object affinity,
                                            Subject subject,
                                            ConnectionRequestInfo cri,
                                            boolean enforceSerialReuse,
                                            String pmiName,
                                            int commitPriority,
                                            int branchCoupling) {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "getSharedConnection");
        }

        MCWrapper mcWrapper = null;
        boolean affinityIsEqual = false;
        boolean cmConfigDataIsCompatible = false;
        boolean dumpLTCMessage = true; // We want to only dump one of 86 trace message for every getSharedConnection

        /*
         * Dirty read the size of the mcWrapperList. There are no mcWrappers in the
         * list if mcWrapperListSize is zero and it is imposible for a matching
         * mcWrapper and affinity id to be added to this list since this thread has
         * to do the adding.
         */
        if (mcWrapperListSize > 0) {

            MCWrapper mcWrapperTemp = null;
            /*
             * We have one or more mcWrapper(s). We need to synchronize.
             */
            synchronized (sharedLockObject) {
                if (mcWrapperListSize > 0) {

                    /*
                     * Look for a matching affinity id and commit priority.
                     */
                    mcWrapperTemp = mcWrapperList[0];

                    if (affinity != null && affinity.equals(mcWrapperTemp.getSharedPoolCoordinator())) {
                        affinityIsEqual = true;

                        ConnectionManager cm = ((com.ibm.ejs.j2c.MCWrapper) mcWrapperTemp).getCm();
                        ResourceRefInfo resRefInfo = cm.getResourceRefInfo();
                        if (resRefInfo.getCommitPriority() == commitPriority) {
                            int tempBranchCoupling = resRefInfo.getBranchCoupling();
                            if (branchCoupling == tempBranchCoupling) { // Check if they match first for performance
                                cmConfigDataIsCompatible = true;
                            } else {
                                cmConfigDataIsCompatible = cm.matchBranchCoupling(branchCoupling, tempBranchCoupling,
                                                                                  ((com.ibm.ejs.j2c.MCWrapper) mcWrapperTemp).get_managedConnectionFactory());
                            }
                        }

                    }

                }

            } // Lets be really optimistic and release the lock

            if (affinityIsEqual && cmConfigDataIsCompatible) {

                // When the new transaction code is drop, we will want to use
                // the following if test for comparing Coordinators
                // if (mcWrapperTemp.getSharedPoolCoordinator() == affinity) {

                /*
                 * We have a matching affinity id, now we need a matching user data
                 */
                boolean subjectMatch = false;
                Subject mcWrapperSubject = mcWrapperTemp.getSubject();

                if ((subject == null) && (mcWrapperSubject == null)) {
                    subjectMatch = true;
                } else {

                    if ((subject != null) && (mcWrapperSubject != null)) {

                        Equals e = new Equals();
                        e.setSubjects(subject, mcWrapperTemp.getSubject());

                        if (AccessController.doPrivileged(e)) {
                            subjectMatch = true;
                        }

                    }

                }

                ManagedConnection mc = mcWrapperTemp.getManagedConnection();
                ConnectionRequestInfo mcWrapperCRI = mc instanceof WSManagedConnection ? ((WSManagedConnection) mc).getConnectionRequestInfo() : mcWrapperTemp.getCRI();
                // The cri can be null, so we need to check for null.
                boolean criMatch = cri == mcWrapperCRI || cri != null && cri.equals(mcWrapperCRI);

                if (criMatch && subjectMatch) {

                    /*
                     * We have a matching affinity id and user data, but we have one more
                     * test. The following if checks the serial reuse rule.
                     */
                    if (enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)) {

                        /*
                         * We can not use this connections. We need to look for a shared
                         * connection with the handle count of zero or we need to get a new
                         * shareable connection.
                         */

                        if (isTracingEnabled && tc.isDebugEnabled()) {
                            Tr.debug(this, tc, "allocateConnection_Common:  HandleCount = " + mcWrapperTemp.getHandleCount());
                        }

                        if (_pm.logSerialReuseMessage) {
                            Tr.info(tc, "ATTEMPT_TO_SHARE_LTC_CONNECTION_J2CA0086", mcWrapperTemp, pmiName);
                            _pm.logSerialReuseMessage = false;
                        }

                        if (dumpLTCMessage) {
                            if (isTracingEnabled && tc.isDebugEnabled()) {
                                dumpLTCMessage = false; // only dump this info once for every getSharedConnection
                                                        // request.
                                Tr.debug(this, tc, "Attempt to share connection within LTC (J2CA0086)");
                                Tr.debug(this, tc, "mcWrapper = " + mcWrapperTemp);
                                Tr.debug(this, tc, "pmiName   = " + pmiName);
                                Tr.debug(this, tc, "LTC stack information = " + dumpLTCInformation(mcWrapperTemp, pmiName, affinity));
                            }
                        }

                    } // end enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)

                    else {

                        /*
                         * We have a shareable connection to use
                         */
                        if ((isTracingEnabled && tc.isDebugEnabled())) {
                            /*
                             * This is used for tracking shared pool usage data
                             */
                            ++sop_gets;
                        }

                        mcWrapper = mcWrapperTemp;

                    }

                } // end criMatch && subjectMatch

                else {

                    if ((isTracingEnabled && tc.isDebugEnabled())) {
                        /*
                         * This is used for tracking shared pool usage data
                         */
                        ++snop_gets_notfound;
                    }

                } // end else (cri, subj don't both match)

            } // end affinityIsEqual && commitPriorityIsEqual

            else {

                if ((isTracingEnabled && tc.isDebugEnabled())) {
                    /*
                     * This is used for tracking shared pool usage data
                     */
                    ++snop_gets_notfound;
                }

            }

            if (mcWrapper == null) {
                synchronized (sharedLockObject) {
                    /*
                     * If the mcWrapperListSize > 0, we may have a connection that will
                     * match. We most likely already checked one of the connections, but
                     * we released the shared lock, so we need to check all of them again,
                     * no more perf tricks.
                     */
                    for (int i = 0; i < mcWrapperListSize; ++i) {

                        mcWrapperTemp = mcWrapperList[i];

                        /*
                         * Look for a matching affinity id and user data.
                         */

                        if (affinity != null && affinity.equals(mcWrapperTemp.getSharedPoolCoordinator())) {

                            // When the new transaction code is drop, we will want to use
                            // the following if test for comparing Coordinators
                            // if (mcWrapperTemp.getSharedPoolCoordinator() == affinity) {

                            /*
                             * We have a matching affinity id, now we need a matching user
                             * data
                             */
                            boolean subjectMatch = false;
                            Subject mcWrapperSubject = mcWrapperTemp.getSubject();

                            if ((subject == null) && (mcWrapperSubject == null)) {
                                subjectMatch = true;
                            } else {

                                if ((subject != null) && (mcWrapperSubject != null)) {

                                    Equals e = new Equals();
                                    e.setSubjects(subject, mcWrapperTemp.getSubject());
                                    if ((AccessController.doPrivileged(e)).booleanValue()) {
                                        subjectMatch = true;
                                    }

                                }

                            }

                            ManagedConnection mc = mcWrapperTemp.getManagedConnection();
                            ConnectionRequestInfo mcWrapperCRI = mc instanceof WSManagedConnection ? ((WSManagedConnection) mc).getConnectionRequestInfo() : mcWrapperTemp.getCRI();
                            // The cri can be null, so we need to check for null.
                            boolean criMatch = cri == mcWrapperCRI || cri != null && cri.equals(mcWrapperCRI);

                            if (criMatch && subjectMatch) {

                                /*
                                 * We have a matching affinity id and user data, but we have one
                                 * more test. The following if checks the serial reuse rule.
                                 */
                                if (enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)) {
                                    /*
                                     * We can not use this connections. We need to look for a
                                     * shared connection with the handle count of zero or we need
                                     * to get a new shareable connection.
                                     */
                                    if (isTracingEnabled && tc.isDebugEnabled()) {
                                        Tr.debug(this, tc, "allocateConnection_Common:  HandleCount = " + mcWrapperTemp.getHandleCount());
                                    }

                                    if (_pm.logSerialReuseMessage) {
                                        Tr.info(tc, "ATTEMPT_TO_SHARE_LTC_CONNECTION_J2CA0086", mcWrapperTemp, pmiName);
                                        _pm.logSerialReuseMessage = false;
                                    }

                                    if (dumpLTCMessage) {
                                        if (isTracingEnabled && tc.isDebugEnabled()) {
                                            dumpLTCMessage = false; // only dump this info once for every getSharedConnection
                                                                    // request.
                                            Tr.debug(this, tc, "Attempt to share connection within LTC (J2CA0086)");
                                            Tr.debug(this, tc, "mcWrapper = " + mcWrapperTemp);
                                            Tr.debug(this, tc, "pmiName   = " + pmiName);
                                            Tr.debug(this, tc, "LTC stack information = " + dumpLTCInformation(mcWrapperTemp, pmiName, affinity));
                                        }
                                    }

                                } // end enforceSerialReuse && (mcWrapperTemp.getHandleCount() >= 1)

                                else {

                                    /*
                                     * Look for a matching commitPriority/branchCoupling.
                                     */
                                    ConnectionManager cm = ((com.ibm.ejs.j2c.MCWrapper) mcWrapperTemp).getCm();
                                    ResourceRefInfo resRefInfo = cm.getResourceRefInfo();
                                    if (resRefInfo.getCommitPriority() == commitPriority) {
                                        int tempBranchCoupling = resRefInfo.getBranchCoupling();
                                        if (branchCoupling == tempBranchCoupling) { // Check if they match first for performance
                                            cmConfigDataIsCompatible = true;
                                        } else {
                                            cmConfigDataIsCompatible = cm.matchBranchCoupling(branchCoupling, tempBranchCoupling,
                                                                                              ((com.ibm.ejs.j2c.MCWrapper) mcWrapperTemp).get_managedConnectionFactory());
                                        }
                                    }

                                    if (cmConfigDataIsCompatible) {

                                        /*
                                         * We have a shareable connection to use
                                         */
                                        if ((isTracingEnabled && tc.isDebugEnabled())) {
                                            /*
                                             * This is used for tracking shared pool usage data
                                             */
                                            ++snop_gets;

                                        }
                                        mcWrapper = mcWrapperTemp;
                                        break;

                                    }

                                }

                            } // end criMatch && subjectMatch

                        } // end mcWrapperTemp.getSharedPoolCoordinator().equals(affinity)

                    } // end for loop

                } // end synchronized

                if (mcWrapper == null) {

                    if ((isTracingEnabled && tc.isDebugEnabled())) {
                        /*
                         * This is used for tracking shared pool usage data
                         */
                        ++snop_gets_notfound;
                    }

                }

            } // end mcWrapper == null

        } else {

            if ((isTracingEnabled && tc.isDebugEnabled())) {
                ++sop_gets_notfound;
            }

        }

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "getSharedConnection", mcWrapper);
        }

        return mcWrapper;

    }