If initializationFailFast is configured, check that we have DB connectivity.

@throws PoolInitializationException if fails to create or validate connection
@see HikariConfig#setInitializationFailTimeout(long)
547233
private void checkFailFast()
   {
      final long initializationTimeout = config.getInitializationFailTimeout();
      if (initializationTimeout < 0) {
         return;
      }

      final long startTime = currentTime();
      do {
         final PoolEntry poolEntry = createPoolEntry();
         if (poolEntry != null) {
            if (config.getMinimumIdle() > 0) {
               connectionBag.add(poolEntry);
               logger.debug("{} - Added connection {}", poolName, poolEntry.connection);
            }
            else {
               quietlyCloseConnection(poolEntry.close(), "(initialization check complete and minimumIdle is zero)");
            }

            return;
         }

         if (getLastConnectionFailure() instanceof ConnectionSetupException) {
            throwPoolInitializationException(getLastConnectionFailure().getCause());
         }

         quietlySleep(SECONDS.toMillis(1));
      } while (elapsedMillis(startTime) < initializationTimeout);

      if (initializationTimeout > 0) {
         throwPoolInitializationException(getLastConnectionFailure());
      }
   }
993624
public void setConnectTimeout(long connectTimeout, TimeUnit unit) {
        this.connectTimeout = Duration.ofMillis(unit.toMillis(connectTimeout));
    }
138450
private void checkTimeoutSession() {
        if(appLastSeen <= 0) return;
        long now = System.currentTimeMillis();
        if ((now - appLastSeen) > Constants.SESSION_LENGTH_MINS * 60 * 1000) {
            getConfigLogger().verbose(getAccountId(), "Session Timed Out");
            destroySession();
            setCurrentActivity(null);
        }
    }
241935
public SdkClientBuilder connectionCheckoutTimeout(long timeout, TimeUnit unit)
    {
        this.connectionCheckoutTimeoutMs = (int) TimeUnit.MILLISECONDS.convert(timeout, unit);
        return this;
    }
1022668
private void init()
	{
		
		faultErrorMap = new HashMap<String,FaultError>();
		
		faultErrorMap.put(SetupException.class.getName(), new FaultError(SetupException.DEFAULT_ERROR_CODE,SetupException.DEFAULT_ERROR_CATEGORY));
		faultErrorMap.put(ConnectionException.class.getName(), new FaultError(SetupException.DEFAULT_ERROR_CODE,SetupException.DEFAULT_ERROR_CATEGORY));
		faultErrorMap.put(ConfigException.class.getName(), new FaultError(SetupException.DEFAULT_ERROR_CODE,SetupException.DEFAULT_ERROR_CATEGORY));
		
	}
671462
public void init(final Connection connection, final DbDevImportInfo info) throws DevFailed {
		connection.url = new TangoUrl(info.name);
		connection.setDevice_is_dbase(false);
		connection.devname = connection.url.devname;

		// Check if connection is possible
		if (connection.url.protocol == TANGO && connection.url.use_db) {
	    	connection.ior = info.ior;
		}
		connection.classname = info.classname;
		
		try {
			initCtrlAccess(connection);
		}
		catch(DevFailed e) {
			System.err.println(e.errors[0].desc);
		}
    }
828542
private void init()
    {
        this.container = InfinispanCache.findCacheContainer();
        if (this.container == null) {
            try {
                this.container = new DefaultCacheManager(this.getClass().getResourceAsStream(
                                "/org/efaps/util/cache/infinispan-config.xml"));
                if (this.container instanceof EmbeddedCacheManager) {
                    this.container.addListener(new CacheLogListener(InfinispanCache.LOG));
                }
                InfinispanCache.bindCacheContainer(this.container);
                final Cache<String, Integer> cache = this.container
                                .<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
                cache.put(InfinispanCache.COUNTERCACHE, 1);
            } catch (final FactoryConfigurationError e) {
                InfinispanCache.LOG.error("FactoryConfigurationError", e);
            } catch (final IOException e) {
                InfinispanCache.LOG.error("IOException", e);
            }
        } else {
            final Cache<String, Integer> cache = this.container
                            .<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
            Integer count = cache.get(InfinispanCache.COUNTERCACHE);
            if (count == null) {
                count = 1;
            } else {
                count = count + 1;
            }
            cache.put(InfinispanCache.COUNTERCACHE, count);
        }
    }
489536
private static int initializeTimeout() {
//        Integer tmp = java.security.AccessController.doPrivileged(
//          new GetIntegerAction("com.sun.security.crl.timeout"));
        Integer tmp = Integer.getInteger("com.sun.security.crl.timeout");
        if (tmp == null || tmp < 0) {
            return DEFAULT_CRL_CONNECT_TIMEOUT;
        }
        // Convert to milliseconds, as the system property will be
        // specified in seconds
        return tmp * 1000;
    }
445174
public void initConnection()
    {
        try   {
            boolean bAutoCommit = true;
            if (DBConstants.FALSE.equalsIgnoreCase(this.getProperty(SQLParams.AUTO_COMMIT_PARAM)))
                bAutoCommit = false;
            m_JDBCConnection.setAutoCommit(bAutoCommit);
            DatabaseMetaData dma = m_JDBCConnection.getMetaData();
            String strDatabaseProductName = dma.getDatabaseProductName();
            Utility.getLogger().info("DB Name: " + strDatabaseProductName);
            this.setProperty(SQLParams.INTERNAL_DB_NAME, strDatabaseProductName);
            this.setupDatabaseProperties(); // If I haven't read the db properties, read them now!
            String strDateQuote = this.getProperty(SQLParams.SQL_DATE_QUOTE);
            if ((strDateQuote != null) && (strDateQuote.length() > 0))
                DateTimeField.setSQLQuote(strDateQuote.charAt(0));
            Converter.initGlobals();
            String strFormat = this.getProperty(SQLParams.SQL_DATE_FORMAT);
            if (strFormat != null)
                Converter.gDateSqlFormat = new java.text.SimpleDateFormat(strFormat);
            strFormat = this.getProperty(SQLParams.SQL_TIME_FORMAT);
            if (strFormat != null)
                Converter.gTimeSqlFormat = new java.text.SimpleDateFormat(strFormat);
            strFormat = this.getProperty(SQLParams.SQL_DATETIME_FORMAT);
            if (strFormat != null)
                Converter.gDateTimeSqlFormat = new java.text.SimpleDateFormat(strFormat);
            if (DBConstants.TRUE.equals(this.getProperty(SQLParams.SHARE_JDBC_CONNECTION)))
                m_sharedConnection = m_JDBCConnection;  // HACK - Only one DB open at a time (pointbase)!
            Utility.getLogger().info("Connected to db: " + this.getDatabaseName(true));
        }
        catch (SQLException ex)
        {
            // Ignore errors to these non-essential calls;  // Probably "DB Not found"
        }
    }
567812
private void initialize()
    {
        SqlStageExecution rootStage = stages.get(rootStageId);
        rootStage.addStateChangeListener(state -> {
            if (state == FINISHED) {
                queryStateMachine.transitionToFinishing();
            }
            else if (state == CANCELED) {
                // output stage was canceled
                queryStateMachine.transitionToCanceled();
            }
        });

        for (SqlStageExecution stage : stages.values()) {
            stage.addStateChangeListener(state -> {
                if (queryStateMachine.isDone()) {
                    return;
                }
                if (state == FAILED) {
                    queryStateMachine.transitionToFailed(stage.getStageInfo().getFailureCause().toException());
                }
                else if (state == ABORTED) {
                    // this should never happen, since abort can only be triggered in query clean up after the query is finished
                    queryStateMachine.transitionToFailed(new PrestoException(GENERIC_INTERNAL_ERROR, "Query stage was aborted"));
                }
                else if (state == FINISHED) {
                    List<SqlStageExecution> nextStagesToSchedule = getStagesReadyForExecution();
                    if (!nextStagesToSchedule.isEmpty()) {
                        startScheduling(nextStagesToSchedule);
                    }
                }
                else if (queryStateMachine.getQueryState() == QueryState.STARTING) {
                    // if the stage has at least one task, we are running
                    if (stage.hasTasks()) {
                        queryStateMachine.transitionToRunning();
                    }
                }
            });
        }

        // when query is done or any time a stage completes, attempt to transition query to "final query info ready"
        queryStateMachine.addStateChangeListener(newState -> {
            if (newState.isDone()) {
                queryStateMachine.updateQueryInfo(Optional.ofNullable(getStageInfo()));
            }
        });
        for (SqlStageExecution stage : stages.values()) {
            stage.addFinalStageInfoListener(status -> queryStateMachine.updateQueryInfo(Optional.ofNullable(getStageInfo())));
        }
    }
1317853
@Override
    public CompletableFuture<Void> initialize(Duration timeout) {
        Preconditions.checkState(!this.initialized.get(), "TableMetadataStore is already initialized.");

        // Invoke submitAssignment(), which will ensure that the Metadata Segment is mapped in memory and pinned.
        // If this is the first time we initialize the TableMetadataStore for this SegmentContainer, a new id will be
        // assigned to it.
        val attributes = TableAttributes.DEFAULT_VALUES
                .entrySet().stream()
                .map(e -> new AttributeUpdate(e.getKey(), AttributeUpdateType.None, e.getValue()))
                .collect(Collectors.toList());
        return submitAssignment(SegmentInfo.newSegment(this.metadataSegmentName, attributes), true, timeout)
                .thenAccept(segmentId -> {
                    this.initialized.set(true);
                    log.info("{}: Metadata Segment pinned. Name = '{}', Id = '{}'", this.metadataSegmentName, segmentId);
                });
    }
35446
@Override
    protected void initializeImpl()
    {
        //get logger
        Logger logger=this.getLogger();

        //get use persistent connection value
        this.usePersistentConnection=Boolean.parseBoolean(this.getConfigurationValue(FaxClientSpiConfigurationConstants.USE_PERSISTENT_CONNECTION_PROPERTY_KEY));
        logger.logDebug(new Object[]{"Using persistent connection: ",String.valueOf(this.usePersistentConnection)},null);
        
        //setup connection factory
        String className=this.getConfigurationValue(FaxClientSpiConfigurationConstants.CONNECTION_FACTORY_CLASS_NAME_PROPERTY_KEY);
        this.connectionFactory=this.createMailConnectionFactoryImpl(className);
        if(this.connectionFactory==null)
        {
            throw new FaxException("Mail connection factory is not available.");
        }
    }
1366813
public static void initialize()
    {
        if (AppConfigHandler.get().isQueryCacheDeactivated()) {
            QueryCache.NOOP = new NoOpQueryCache();
        } else {
            if (InfinispanCache.get().exists(QueryCache.INDEXCACHE)) {
                InfinispanCache.get().<String, QueryKey>getCache(QueryCache.INDEXCACHE).clear();
            } else {
                final Cache<String, QueryKey> cache = InfinispanCache.get().<String, QueryKey>getCache(
                                QueryCache.INDEXCACHE);
                cache.addListener(new CacheLogListener(QueryCache.LOG));
            }
            if (InfinispanCache.get().exists(QueryCache.SQLCACHE)) {
                InfinispanCache.get().<QueryKey, Object>getCache(QueryCache.SQLCACHE).clear();
            } else {
                final Cache<QueryKey, Object> cache = InfinispanCache.get().<QueryKey, Object>getCache(
                                QueryCache.SQLCACHE);
                cache.addListener(new CacheLogListener(QueryCache.LOG));
                cache.addListener(new SqlCacheListener());
            }
        }
    }
387171
private void serverInventoryInitialized()
  {
    long start = System.currentTimeMillis();
    long serverSyncWaitTimeout = config.getServerTimeout() + 2 * ChangeRequestHttpSyncer.HTTP_TIMEOUT_EXTRA_MS;

    List<DruidServerHolder> uninitializedServers = new ArrayList<>();
    for (DruidServerHolder server : servers.values()) {
      if (!server.isSyncedSuccessfullyAtleastOnce()) {
        uninitializedServers.add(server);
      }
    }

    while (!uninitializedServers.isEmpty() && ((System.currentTimeMillis() - start) < serverSyncWaitTimeout)) {
      try {
        Thread.sleep(5000);
      }
      catch (InterruptedException ex) {
        throw new RE(ex, "Interrupted while waiting for queryable server initial successful sync.");
      }

      log.info("Checking whether all servers have been synced at least once yet....");
      Iterator<DruidServerHolder> iter = uninitializedServers.iterator();
      while (iter.hasNext()) {
        if (iter.next().isSyncedSuccessfullyAtleastOnce()) {
          iter.remove();
        }
      }
    }

    if (uninitializedServers.isEmpty()) {
      log.info("All servers have been synced successfully at least once.");
    } else {
      for (DruidServerHolder server : uninitializedServers) {
        log.warn(
            "Server[%s] might not yet be synced successfully. We will continue to retry that in the background.",
            server.druidServer.getName()
        );
      }
    }

    log.info("Calling SegmentCallback.segmentViewInitialized() for all callbacks.");

    runSegmentCallbacks(
        new Function<SegmentCallback, CallbackAction>()
        {
          @Override
          public CallbackAction apply(SegmentCallback input)
          {
            return input.segmentViewInitialized();
          }
        }
    );
  }
257080
public static void initialize()
    {
        if (InfinispanCache.get().exists(DBProperties.CACHENAME)) {
            InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME).clear();
        } else {
            InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME)
                            .addListener(new CacheLogListener(DBProperties.LOG));
        }
        DBProperties.cacheOnStart();
    }
965067
@FFDCIgnore(CacheException.class)
    private void cacheInit() {
        final boolean trace = TraceComponent.isAnyTracingEnabled();

        // Attempt lazy initialization if necessary
        try{
            if (cacheStoreService.cacheManager == null)
                cacheStoreService.activateLazily();

            // Build a unique per-application cache name by starting with the application context root and percent encoding
            // the / and : characters (JCache spec does not allow these in cache names)
            // and also the % character (which is necessary because of percent encoding)
            String a = PERCENT.matcher(_iStore.getId()).replaceAll("%25"); // must be done first to avoid replacing % that is added when replacing the others
            a = SLASH.matcher(a).replaceAll(".");
            a = COLON.matcher(a).replaceAll(".");

            // Session Meta Information Cache

            String metaCacheName = new StringBuilder(24 + a.length()).append("com.ibm.ws.session.meta.").append(a).toString();

            if (trace && tc.isDebugEnabled())
                tcInvoke(cacheStoreService.tcCacheManager, "getCache", metaCacheName, "String", "ArrayList");

            sessionMetaCache = cacheStoreService.cacheManager.getCache(metaCacheName, String.class, ArrayList.class);
            boolean create;
            if (create = sessionMetaCache == null) {
                if (trace && tc.isDebugEnabled())
                    tcReturn(cacheStoreService.tcCacheManager, "getCache", "null");

                @SuppressWarnings("rawtypes")
                MutableConfiguration<String, ArrayList> config = new MutableConfiguration<String, ArrayList>()
                .setTypes(String.class, ArrayList.class)
                .setExpiryPolicyFactory(EternalExpiryPolicy.factoryOf());
                if (cacheStoreService.supportsStoreByReference)
                    config = config.setStoreByValue(false);
                try {
                    if (trace && tc.isDebugEnabled())
                        tcInvoke(cacheStoreService.tcCacheManager, "createCache", metaCacheName, config);

                    sessionMetaCache = cacheStoreService.cacheManager.createCache(metaCacheName, config);
                } catch (CacheException x) {
                    create = false;
                    if (trace && tc.isDebugEnabled()) {
                        tcReturn(cacheStoreService.tcCacheManager, "createCache", x);
                        tcInvoke(cacheStoreService.tcCacheManager, "getCache", metaCacheName, "String", "ArrayList");
                    }
                    sessionMetaCache = cacheStoreService.cacheManager.getCache(metaCacheName, String.class, ArrayList.class);
                    if (sessionMetaCache == null)
                        throw x;
                }
            }

            tcSessionMetaCache = "MetaCache" + Integer.toHexString(System.identityHashCode(sessionMetaCache));
            if (trace && tc.isDebugEnabled())
                tcReturn(cacheStoreService.tcCacheManager, create ? "createCache" : "getCache", tcSessionMetaCache, sessionMetaCache);

            cacheStoreService.configureMonitoring(metaCacheName);

            // Session Attributes Cache

            String attrCacheName = new StringBuilder(24 + a.length()).append("com.ibm.ws.session.attr.").append(a).toString();

            if (trace && tc.isDebugEnabled())
                tcInvoke(cacheStoreService.tcCacheManager, "getCache", attrCacheName, "String", "byte[]");

            sessionAttributeCache = cacheStoreService.cacheManager.getCache(attrCacheName, String.class, byte[].class);

            if (create = sessionAttributeCache == null) {
                if (trace && tc.isDebugEnabled())
                    tcReturn(cacheStoreService.tcCacheManager, "getCache", "null");

                MutableConfiguration<String, byte[]> config = new MutableConfiguration<String, byte[]>()
                                .setTypes(String.class, byte[].class)
                                .setExpiryPolicyFactory(EternalExpiryPolicy.factoryOf());
                if (cacheStoreService.supportsStoreByReference)
                    config = config.setStoreByValue(false);
                try {
                    if (trace && tc.isDebugEnabled())
                        tcInvoke(cacheStoreService.tcCacheManager, "createCache", attrCacheName, config);

                    sessionAttributeCache = cacheStoreService.cacheManager.createCache(attrCacheName, config);
                } catch (CacheException x) {
                    create = false;
                    if (trace && tc.isDebugEnabled()) {
                        tcReturn(cacheStoreService.tcCacheManager, "createCache", x);
                        tcInvoke(cacheStoreService.tcCacheManager, "getCache", attrCacheName, "String", "byte[]");
                    }
                    sessionAttributeCache = cacheStoreService.cacheManager.getCache(attrCacheName, String.class, byte[].class);
                    if (sessionAttributeCache == null)
                        throw x;
                }
            }

            tcSessionAttrCache = "AttrCache" + Integer.toHexString(System.identityHashCode(sessionAttributeCache));
            if (trace && tc.isDebugEnabled())
                tcReturn(cacheStoreService.tcCacheManager, create ? "createCache" : "getCache", tcSessionAttrCache, sessionAttributeCache);

            cacheStoreService.configureMonitoring(attrCacheName);
        } catch(Exception ex) {
            //auto ffdc
            Tr.error(tc, "ERROR_SESSION_INIT", ex);
            throw new RuntimeException(Tr.formatMessage(tc, "INTERNAL_SERVER_ERROR"));
        }
    }
425866
private void assertInitialized() {

		if (!services.isShuttingDown() && !services.isShutdownDone()) {

			// wait for service layer to be initialized
			while (!services.isInitialized()) {

				try { Thread.sleep(1000); } catch (Throwable t) {}
			}
		}
	}