Gets the current connection.
182788
private void getConnection(State state) {
        state.con = query.context().connectionProvider().get();
        debug("getting connection");
        debug("cp={}", query.context().connectionProvider());
    }
655383
public function getConnection()
    {
        if (null === $this->connection) {
            $this->setConnection(\Doctrine_Manager::getInstance()->getCurrentConnection());
        }

        return $this->connection;
    }
186808
def connected(self):
        
        return self.websocket is not None and \
               self.websocket.sock is not None and \
               self.websocket.sock.connected
205695
def _GetConnection(self):
		
		#Attempt to get a connection. If all connections are in use and we have reached the max number of connections,
		#we wait 1 second and try again.
		#The Connection is returned locked to be thread safe
		while self.conn is None:
			self.conn = Pool().GetConnection(self.connInfo)
			if self.conn is not None:
				break
			else:
				time.sleep(1)
947226
def get_connection(self):
        """"""
        if self.host is None:
            connector = SpamCUnixConnector
            conn = connector(self.socket_file, self.backend_mod)
        else:
            connector = SpamCTcpConnector
            conn = connector(
                self.host,
                self.port,
                self.backend_mod,
                is_ssl=self.is_ssl,
                **self.ssl_args)
        return conn
524211
private Connection getConnection() {
        final JdbcTransaction jdbcTransaction = TX.get();
        if (null != jdbcTransaction && jdbcTransaction.isActive()) {
            return jdbcTransaction.getConnection();
        }

        Connection ret = CONN.get();
        try {
            if (null != ret && !ret.isClosed()) {
                return ret;
            }

            ret = Connections.getConnection();
        } catch (final SQLException e) {
            LOGGER.log(Level.ERROR, "Gets a connection failed", e);
        }

        CONN.set(ret);

        return ret;
    }
911012
public Moment getLastConnectionTime() {

        final ConnectionResult cr = this.result;
        return ((cr == null) ? null : cr.lastMoment);

    }
757758
async function getConnection(){
    // already connected ?
    if (_nodeMcuConnector.isConnected()){
        return;
    }

    // create new connector
    try{
        const msg = await _nodeMcuConnector.connect(_options.device, _options.baudrate, true, _options.connectionDelay);

        // status message
        _logger.log('Connected');
        _mculogger.log(msg);

    }catch(e){
        _logger.error('Unable to establish connection');
        throw e;
    }
}
135032
public Connection getConnection()
    {
        Connection connection;

        try
        {
            if (getLogger().isDebugEnabled())
            {
                getLogger().debug("before: active : " + connectionPool.getNumActive() + " idle: " + connectionPool.getNumIdle());
            }
            connection = dataSource.getConnection();
            if (getLogger().isDebugEnabled())
            {
                getLogger().debug("after: active : " + connectionPool.getNumActive() + " idle: " + connectionPool.getNumIdle() + " giving " + connection);
            }
        }
        catch (Exception e)
        {
            getLogger().error("Unable to get connection " + this, e);
            throw new MithraDatabaseException("could not get connection", e);
        }
        if (connection == null)
        {
            throw new MithraDatabaseException("could not get connection"+this);
        }
        return connection;
    }
766939
public static function current()
    {
        if (defined('PHPUNIT_RUNNING')) {
            return 'http://localhost';
        }

        $protocol = (!empty($_SERVER['HTTPS'])
            && $_SERVER['HTTPS'] !== 'off'
            || (int) $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://';

        return $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }
979750
public function getConnection()
    {
        if ($this->_oConn === null) {
            $this->_oConn = $this->openDatabase(null);
        }

        return $this->_oConn;
    }
521659
def current(cls):
        
        name = socket.getfqdn()
        ip = socket.gethostbyname(name)

        return cls(name, ip)
767936
public static Connection getConnection() {
        Connection connection = tl_conn.get();
        try {
            // 若tl.get()返回不是null说明当前线程有事务连接，直接返回事务连接
            if (connection != null) {
                return connection;
            }
            // 若为null则从连接池里返回一个连接
            connection = dataSource.getConnection();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return connection;
    }
776683
def get_current(self, layout=None, network=None, verbose=False):
        
        PARAMS={}
        response=api(url=self.__url+"/get_current", PARAMS=PARAMS, method="POST", verbose=verbose)
        return response
390752
public function getCurrentConnectIp()
    {
        try {
            $this->Ip->setHaProxy(TRUE);

            return $this->Ip->getIpAddress();
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->logger->error(__FUNCTION__, $message);

            return '0.0.0.0';
        }
    }
16482
public function getCurrent()
    {
        if ($this->current === null) {
            $this->current = false;

            $item = $this->getFromSession();
            if (!$item) {
                $item = $this->getFromCookie();
            }

            if ($item && $this->checkAccessCurrent($item)) {
                $this->beforeSetCurrent($item);
                $this->setAndSaveCurrent($item);
            } else {
                $this->setCurrent($this->getCurrentDefault());
            }
        }

        return $this->current;
    }
1318920
public Connection getConnection() throws FetchException {
        try {
            if (mOpenConnections == null) {
                throw new FetchException("Repository is closed");
            }

            JDBCTransaction txn = localTransactionScope().getTxn();
            if (txn != null) {
                // Return the connection used by the current transaction.
                return txn.getConnection();
            }

            // Get connection outside lock section since it may block.
            Connection con = mDataSource.getConnection();
            con.setAutoCommit(true);

            mOpenConnectionsLock.lock();
            try {
                if (mOpenConnections == null) {
                    con.close();
                    throw new FetchException("Repository is closed");
                }
                mOpenConnections.put(con, null);
            } finally {
                mOpenConnectionsLock.unlock();
            }

            return con;
        } catch (Exception e) {
            throw toFetchException(e);
        }
    }