Create a new {@link RedisConnectionException} given {@link SocketAddress} and the {@link Throwable cause}.

@param remoteAddress remote socket address.
@param cause the nested exception.
@return the {@link RedisConnectionException}.
@since 4.4
431392
public static RedisConnectionException create(SocketAddress remoteAddress, Throwable cause) {
        return create(remoteAddress == null ? null : remoteAddress.toString(), cause);
    }
31440
private static RedissonClient buildRedissonClient(RedisBaseConfig redisBaseConfig) {
        Config config = new Config();

        if (redisBaseConfig instanceof RedisSingleServerConfig) {
            RedisSingleServerConfig redisSingleServerConfig = (RedisSingleServerConfig) redisBaseConfig;
            SingleServerConfig singleServerConfig = config.useSingleServer();
            BeanUtils.copy(singleServerConfig, redisSingleServerConfig);
            //该字段write方法和get方法类型不一致，需要手动处理
            singleServerConfig.setAddress(redisSingleServerConfig.getAddress());
        } else {
            throw new IllegalArgumentException("位置的配置类型：" + redisBaseConfig.getClass());
        }

        return Redisson.create(config);
    }
834614
@Override
    public void sendToExceptionDestination(
                                           SIDestinationAddress address,
                                           SIBusMessage message,
                                           int reason,
                                           String[] inserts,
                                           SITransaction tran,
                                           String alternateUser)
                    throws SIResourceException, SIConnectionLostException, SILimitExceededException,
                    SIErrorException,
                    SINotAuthorizedException,
                    SIIncorrectCallException,
                    SINotPossibleInCurrentConfigurationException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.entry(CoreSPIConnection.tc, "sendToExceptionDestination",
                        new Object[] { this, address, alternateUser, message, Integer.valueOf(reason), inserts, tran });

        if (message == null)
        {
            if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
                SibTr.exit(CoreSPIConnection.tc, "sendToExceptionDestination", "SIIncorrectCallException - null msg");
            throw new SIIncorrectCallException(
                            nls_cwsir.getFormattedMessage(
                                                          "SEND_EXCEPTION_DEST_CWSIR0121",
                                                          null,
                                                          null));
        }

        // Get an exception destination instance
        ExceptionDestinationHandlerImpl exDestHandler =
                        new ExceptionDestinationHandlerImpl(address, _messageProcessor);

        exDestHandler.sendToExceptionDestination(message,
                                                 alternateUser,
                                                 (TransactionCommon) tran,
                                                 reason,
                                                 this,
                                                 inserts);

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConnection.tc, "sendToExceptionDestination");
    }
228492
@Override
    public void connectAsynch(Object address) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "connectAsynch, vc=" + getVCHash());
        }
        // Determine if this is a redundant connect.
        if (connected) {
            handleRedundantConnect();
        }
        this.targetAddress = (TCPConnectRequestContext) address;
        // Nothing specific to SSL on connect. Pass through.
        ((OutboundConnectionLink) getDeviceLink()).connectAsynch(address);
        // The SSL handshake will happen in the ready method path.
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "connectAsynch");
        }
    }
1197618
public static CommandLatencyId create(SocketAddress localAddress, SocketAddress remoteAddress, ProtocolKeyword commandType) {
        return new CommandLatencyId(localAddress, remoteAddress, commandType);
    }
1354577
private Throwable mapException(EJSDeployedSupport s, RemoteException ex) //d135584
    {
        try
        {
            if (ex instanceof CSIException) {
                CSIException csiex = (CSIException) ex;
                return mapCSIException(s, csiex);
            }
            else if (ex.detail instanceof CSIException)
            {
                CSIException csiex = (CSIException) ex.detail; //d177787
                return mapCSIException(s, csiex);
            }
            else if (ex instanceof CreateFailureException)
            {
                // For consistency, just map/return the CreateFailureException
                // even if it contains an EJBException, as in most cases the
                // EJBException would just be wrapped in a plain RemoteException,
                // which CreateFailureException already is.                 d187050
                // Since this is already a RemoteException, it only needs to be
                // "mapped" if the method request is throught the ORB.       d228774
                if (!s.ivWrapper.ivInterface.ivORB)
                {
                    return ex;
                }

                return getOrbUtils().mapException(ex);
            }
            else if (ex instanceof BeanNotReentrantException &&
                     (s.ivWrapper.ivInterface == BUSINESS_RMI_REMOTE ||
                     s.ivWrapper.ivInterface == SERVICE_ENDPOINT)) // d350987
            {
                // EJB 3.0 has defined an exception for this purpose.      d366807.6
                // This mapping is only done for business interfaces to insure
                // compatibility with EJB 2.1 clients.                        396839
                BeanNotReentrantException bnre = (BeanNotReentrantException) ex;
                EJBException caex = bnre.isTimeout() ? new ConcurrentAccessTimeoutException(ex.getMessage()) // d653777.1
                : new ConcurrentAccessException(ex.getMessage());
                caex.setStackTrace(ex.getStackTrace());
                s.rootEx = caex;
                return mapEJBException(s, caex);
            }
            else if (ex.detail instanceof EJBException)
            {
                EJBException ejbex = (EJBException) ex.detail;
                return mapEJBException(s, ejbex);
            }
            else
            {
                // Since this is already a RemoteException, it only needs to be
                // "mapped" if the method request is throught the ORB.       d228774
                if (!s.ivWrapper.ivInterface.ivORB)
                {
                    return ex;
                }

                return getOrbUtils().mapException(ex);
            }
        } catch (CSIException e)
        {
            FFDCFilter.processException(e, CLASS_NAME + ".mapException", "119", this);
            Tr.warning(tc, "UNABLE_TO_MAP_EXCEPTION_CNTR0013W"
                       , new Object[] { ex, e }); //p111002.5
            return ex;
        }
    }
1113180
public static ClientInterface create(
            HostMessenger messenger,
            CatalogContext context,
            ReplicationRole replicationRole,
            Cartographer cartographer,
            InetAddress clientIntf,
            int clientPort,
            InetAddress adminIntf,
            int adminPort,
            SslContext SslContext) throws Exception {

        /*
         * Construct the runnables so they have access to the list of connections
         */
        final ClientInterface ci = new ClientInterface(
                clientIntf, clientPort, adminIntf, adminPort, context, messenger, replicationRole, cartographer,
                SslContext);

        return ci;
    }
1089838
public static boolean isUnsupported(SocketAddress remoteAddress, SessionProtocol protocol) {
        final String key = key(remoteAddress);
        final CacheEntry e;
        final long stamp = lock.readLock();
        try {
            e = cache.get(key);
        } finally {
            lock.unlockRead(stamp);
        }

        if (e == null) {
            // Can't tell if it's unsupported
            return false;
        }

        return e.isUnsupported(protocol);
    }
893621
@Override
    void connectionError(SibRaMessagingEngineConnection connection, SIException exception)
    {
        String methodName = "connectionError";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, new Object[] { connection, exception });
        }

        /*
         * We have lost our remote connection, output a warning to the
         * admin console, close the connection and schedule an attempt
         * to create a new one
         */

        SibTr.warning(TRACE, "CONNECTION_ERROR_CWSIV0776",
                      new Object[] { connection.getConnection().getMeName(),
                                    _endpointConfiguration.getBusName(), this,
                                    exception });

        dropConnection(connection, false, true, true);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(this, TRACE, methodName);
        }
    }
804015
async def _connect(self, remote_addresses):
        '''
        '''
        assert remote_addresses

        exceptions = []
        for remote_address in remote_addresses:
            sock = await self._connect_one(remote_address)
            if isinstance(sock, socket.socket):
                return sock, remote_address
            exceptions.append(sock)

        strings = set(f'{exc!r}' for exc in exceptions)
        raise (exceptions[0] if len(strings) == 1 else
               OSError(f'multiple exceptions: {", ".join(strings)}'))
1211501
public static Http2Exception getEmbeddedHttp2Exception(Throwable cause) {
        while (cause != null) {
            if (cause instanceof Http2Exception) {
                return (Http2Exception) cause;
            }
            cause = cause.getCause();
        }
        return null;
    }
1299928
@VisibleForTesting
  static String makeTargetStringForDirectAddress(SocketAddress address) {
    try {
      return new URI(DIRECT_ADDRESS_SCHEME, "", "/" + address, null).toString();
    } catch (URISyntaxException e) {
      // It should not happen.
      throw new RuntimeException(e);
    }
  }
987757
public static RedisConnectionFactory newRedisConnectionFactory(final BaseRedisProperties redis) {
        val redisConfiguration = redis.getSentinel() == null
            ? (RedisConfiguration) getStandaloneConfig(redis)
            : getSentinelConfig(redis);

        val factory = new LettuceConnectionFactory(redisConfiguration, getRedisPoolConfig(redis));

        return factory;
    }
727732
private <K, V, T extends RedisChannelHandler<K, V>, S> ConnectionFuture<S> connectStatefulAsync(T connection,
            RedisCodec<K, V> codec,
            DefaultEndpoint endpoint, RedisURI connectionSettings, Mono<SocketAddress> socketAddressSupplier,
            Supplier<CommandHandler> commandHandlerSupplier) {

        ConnectionBuilder connectionBuilder = createConnectionBuilder(connection, endpoint, connectionSettings,
                socketAddressSupplier, commandHandlerSupplier);

        if (clientOptions.isPingBeforeActivateConnection()) {
            if (hasPassword(connectionSettings)) {
                connectionBuilder.enableAuthPingBeforeConnect();
            } else {
                connectionBuilder.enablePingBeforeConnect();
            }
        }

        ConnectionFuture<RedisChannelHandler<K, V>> future = initializeChannelAsync(connectionBuilder);
        ConnectionFuture<?> sync = future;

        if (!clientOptions.isPingBeforeActivateConnection() && hasPassword(connectionSettings)) {

            sync = sync.thenCompose(channelHandler -> {

                CommandArgs<K, V> args = new CommandArgs<>(codec).add(connectionSettings.getPassword());
                AsyncCommand<K, V, String> command = new AsyncCommand<>(new Command<>(CommandType.AUTH, new StatusOutput<>(
                        codec), args));

                if (connection instanceof StatefulRedisClusterConnectionImpl) {
                    ((StatefulRedisClusterConnectionImpl) connection).dispatch(command);
                }

                if (connection instanceof StatefulRedisConnectionImpl) {
                    ((StatefulRedisConnectionImpl) connection).dispatch(command);
                }

                return command;
            });

        }

        if (LettuceStrings.isNotEmpty(connectionSettings.getClientName())) {
            sync = sync.thenApply(channelHandler -> {

                if (connection instanceof StatefulRedisClusterConnectionImpl) {
                    ((StatefulRedisClusterConnectionImpl) connection).setClientName(connectionSettings.getClientName());
                }

                if (connection instanceof StatefulRedisConnectionImpl) {
                    ((StatefulRedisConnectionImpl) connection).setClientName(connectionSettings.getClientName());
                }
                return channelHandler;
            });
        }

        return sync.thenApply(channelHandler -> (S) connection);
    }
860144
public static WebsocketClientTransport create(String bindAddress, int port) {
    Objects.requireNonNull(bindAddress, "bindAddress must not be null");

    TcpClient client = TcpClient.create().host(bindAddress).port(port);
    return create(client);
  }
911239
@Override
    public void connect(Object address) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "connect, vc=" + getVCHash());
        }
        // Determine if this is a redundant connect.
        if (connected) {
            handleRedundantConnect();
        }
        this.targetAddress = (TCPConnectRequestContext) address;
        // Nothing specific to SSL on connect. Pass through.
        ((OutboundConnectionLink) getDeviceLink()).connect(address);
        // PK13349 - mark that we are now connected
        this.connected = true;

        // First check if the sslContext and sslEngine have already been set (discrimination case)
        if (sslContext == null || getSSLEngine() == null) {
            // Create a new SSL context based on the current properties in the ssl config.
            this.sslContext = getChannel().getSSLContextForOutboundLink(this, getVirtualConnection(), address);
            // Discrimination has not happened yet. Create new SSL engine.
            // PK46069 - use engine that allows session id re-use
            this.sslEngine = SSLUtils.getOutboundSSLEngine(sslContext, getLinkConfig(),
                                                           targetAddress.getRemoteAddress().getHostName(),
                                                           targetAddress.getRemoteAddress().getPort(),
                                                           this);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "SSL engine hc=" + getSSLEngine().hashCode() + " associated with vc=" + getVCHash());
        }

        // Now do the SSL handshake.
        readyOutbound(getVirtualConnection(), false);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "connect");
        }
    }
1103227
public ChannelFuture connect(SocketAddress remoteAddress) {
        if (remoteAddress == null) {
            throw new NullPointerException("remoteAddress");
        }

        validate();
        return doResolveAndConnect(remoteAddress, config.localAddress());
    }