Submits an asynchronous task to load the LTPA keys based on the current configuration state.
This method might also be called by the file monitor when there is an update to the LTPA keys file or
when the file is recreated after it is deleted.
160754
@Override
    public void performFileBasedAction(Collection<File> files) {
        Tr.audit(tc, "LTPA_KEYS_TO_LOAD", keyImportFile);
        submitTaskToCreateLTPAKeys();
    }
699789
public void submitTask(final String evaluatorConfiguration, final String taskConfiguration) {
    final Configuration contextConfiguration = ContextConfiguration.CONF
        .set(ContextConfiguration.IDENTIFIER, "RootContext_" + this.getId())
        .build();
    final String contextConfigurationString = this.configurationSerializer.toString(contextConfiguration);
    this.launchWithConfigurationString(
        evaluatorConfiguration, contextConfigurationString,  Optional.<String>empty(), Optional.of(taskConfiguration));
  }
772669
def apply_async(self, args=None, kwargs=None, **options):
        
        key = self._get_cache_key(args, kwargs)
        counter, penalty = cache.get(key, (0, 0))
        if not counter:
            return super(PenalizedBackgroundTask, self).apply_async(args=args, kwargs=kwargs, **options)

        cache.set(key, (counter - 1, penalty), self.CACHE_LIFETIME)
        logger.info('The task %s will not be executed due to the penalty.' % self.name)
        return self.AsyncResult(options.get('task_id') or str(uuid4()))
118112
def load_rsa_key(rsa_keypath)
      File.open(rsa_keypath, 'r') do |file|
        rsa_key = nil
        rsa_key = [file.read]
        if !rsa_key.nil?
          FastlaneCore::UI.success('Successfully loaded RSA key...')
        else
          FastlaneCore::UI.user_error!('Failed to load RSA key...')
        end
        rsa_key
      end
    end
664638
final WsResource getLTPAKeyFileResource(WsLocationAdmin locService, String ltpaKeyFile) {
        WsResource ltpaFile = locService.resolveResource(ltpaKeyFile);
        if (ltpaFile != null && ltpaFile.exists()) {
            return ltpaFile;
        } else {
            // The file does not exist so return null
            return null;
        }
    }
81408
public synchronized void submitTask(final ActiveContext context) {
    final TaskEntity task = taskQueue.poll();
    final Integer taskId = task.getId();
    final String command = task.getCommand();

    final Configuration taskConf = TaskConfiguration.CONF
        .set(TaskConfiguration.TASK, ShellTask.class)
        .set(TaskConfiguration.IDENTIFIER, taskId.toString())
        .build();
    final Configuration commandConf = Tang.Factory.getTang().newConfigurationBuilder()
        .bindNamedParameter(Command.class, command)
        .build();

    final Configuration merged = Configurations.merge(taskConf, commandConf);
    context.submitTask(merged);
    runningTasks.add(task);
  }
774232
public void performUpdate() {

        // Wrap everything in try-catch because we don't want to leak an exception out of a scheduled task
        try {
            ArrayList<Object> work = new ArrayList<>();
            m_workQueue.drainTo(work);
            Set<CmsUUID> copiedIds = new HashSet<CmsUUID>();
            List<CmsWaitHandle> waitHandles = new ArrayList<>();
            for (Object o : work) {
                if (o instanceof CmsUUID) {
                    copiedIds.add((CmsUUID)o);
                } else if (o instanceof CmsWaitHandle) {
                    waitHandles.add((CmsWaitHandle)o);
                }
            }
            if (copiedIds.contains(RELOAD_MARKER)) {
                // clear cache event, reload all formatter configurations
                reload();
            } else {
                // normal case: incremental update
                Map<CmsUUID, I_CmsFormatterBean> formattersToUpdate = Maps.newHashMap();
                for (CmsUUID structureId : copiedIds) {
                    I_CmsFormatterBean formatterBean = readFormatter(structureId);
                    // formatterBean may be null here
                    formattersToUpdate.put(structureId, formatterBean);
                }
                m_state = m_state.createUpdatedCopy(formattersToUpdate);
            }
            for (CmsWaitHandle handle : waitHandles) {
                handle.release();
            }
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
    }
927414
private static void ensureCacheIndexLoaded() {
		if (cacheIndex == null) {
			cacheIndex = new HashMap<String, Boolean>();
			if (GlobalConfiguration.cleanCache) {
				deleteCacheFiles();
				anyNecessaryCacheCleanupDone = true;
			}
			else {
				File cacheDir = new File(GlobalConfiguration.cacheDir, ".slcache");
				cacheDir.mkdir();
				File cacheIndexFile = new File(cacheDir, ".index");
				if (cacheIndexFile.exists()) {
					try {
						boolean clearCache = false;
						int cacheVersion = CACHE_VERSION_1_1_0; // if no version tag, assume 1.1.0
						try {
							FileReader fr = new FileReader(cacheIndexFile);
							BufferedReader br = new BufferedReader(fr);
							String line;
							boolean handledVersionString = false;
							while ((line = br.readLine()) != null) {
								if (!handledVersionString) {
									if (line.startsWith("Version")) {
										int colon = line.indexOf(":");
										if (colon != -1) {
											cacheVersion = Integer.parseInt(line.substring(colon + 1));
										}

										handledVersionString = true;
										continue;
									}
								}
								StringTokenizer st = new StringTokenizer(line, ":");
								boolean changed = st.nextToken().equals("y");
								String len = st.nextToken();
								String classname = st.nextToken();
								String key = new StringBuilder(classname).append("_").append(len).toString();
								// System.out.println("Populating cache index:" + key + "=" + changed);
								cacheIndex.put(key, changed);
							}
							fr.close();
						}
						catch (IOException ioe) {
							ioe.printStackTrace();
						}
						if (cacheVersion != CURRENT_CACHE_VERSION) {
							clearCache = true;
							versionInIndex = false;
						}
						else {
							versionInIndex = true;
						}
						if (clearCache) {
							if (DEBUG_CACHING) {
								System.out.println("SpringLoaded: cache looks old (version " + cacheVersion
										+ ") - clearing it");
							}
							deleteCacheFiles();
							anyNecessaryCacheCleanupDone = true;
						}
					}
					catch (NoSuchElementException nsme) {
						// rogue entry in the cache
						if (DEBUG_CACHING) {
							System.out.println("SpringLoaded: cache corrupt, clearing it");
						}
						deleteCacheFiles();
						anyNecessaryCacheCleanupDone = true;
					}
				}
			}
		}
	}
945534
private void executeTaskAsync() {
        final String taskId = currentTask.getId();

        ListenableFuture<?> future = taskExecutorService.submit(currentTask);
        pendingTasks.put(taskId, future);

        future.addListener(new Runnable() {
            @Override
            public void run() {
                pendingTasks.remove(taskId);
            }
        }, MoreExecutors.sameThreadExecutor());

        hasCurrentTask = false;
    }
181472
public void submitSynchronous(Runnable task) {
        lock.writeLock().lock();
        try {
            awaitInner();
            task.run();
        } catch (InterruptedException e) {
            Log.error(e, "Task queue isolated submission interrupted");
            throw new RuntimeException(e);
        } catch (Exception e) {
            Log.error(e, "Task queue isolated submission failed");
            throw new RuntimeException(e);
        } finally {
            lock.writeLock().unlock();
        }
    }
815534
protected void loadInternal(Set<K> keys, Iterable<Data> dataKeys, boolean replaceExistingValues) {
        if (dataKeys == null) {
            dataKeys = convertToData(keys);
        }
        Map<Integer, List<Data>> partitionIdToKeys = getPartitionIdToKeysMap(dataKeys);
        Iterable<Entry<Integer, List<Data>>> entries = partitionIdToKeys.entrySet();
        for (Entry<Integer, List<Data>> entry : entries) {
            Integer partitionId = entry.getKey();
            List<Data> correspondingKeys = entry.getValue();
            Operation operation = createLoadAllOperation(correspondingKeys, replaceExistingValues);
            operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
        }
        waitUntilLoaded();
    }
158332
private Future triggerLoading() {
        if (keyLoadFinished.isDone()) {
            keyLoadFinished = new LoadFinishedFuture();

            // side effect -> just trigger load on SENDER_BACKUP ID SENDER died
            execService.execute(MAP_LOAD_ALL_KEYS_EXECUTOR, () -> {
                // checks if loading has finished and triggers loading in case SENDER died and SENDER_BACKUP took over.
                Operation op = new TriggerLoadIfNeededOperation(mapName);
                opService.<Boolean>invokeOnPartition(SERVICE_NAME, op, mapNamePartition)
                        // required since loading may be triggered after migration
                        // and in this case the callback is the only way to get to know if the key load finished or not.
                        .andThen(loadingFinishedCallback());
            });
        }
        return keyLoadFinished;
    }
513457
def _load(self, key):
        '''
        
        '''
        # if the key doesn't have a '.' then it isn't valid for this mod dict
        if not isinstance(key, six.string_types):
            raise KeyError('The key must be a string.')
        if '.' not in key:
            raise KeyError('The key \'{0}\' should contain a \'.\''.format(key))
        mod_name, _ = key.split('.', 1)
        with self._lock:
            # It is possible that the key is in the dictionary after
            # acquiring the lock due to another thread loading it.
            if mod_name in self.missing_modules or key in self._dict:
                return True
            # if the modulename isn't in the whitelist, don't bother
            if self.whitelist and mod_name not in self.whitelist:
                log.error(
                    'Failed to load function %s because its module (%s) is '
                    'not in the whitelist: %s', key, mod_name, self.whitelist
                )
                raise KeyError(key)

            def _inner_load(mod_name):
                for name in self._iter_files(mod_name):
                    if name in self.loaded_files:
                        continue
                    # if we got what we wanted, we are done
                    if self._load_module(name) and key in self._dict:
                        return True
                return False

            # try to load the module
            ret = None
            reloaded = False
            # re-scan up to once, IOErrors or a failed load cause re-scans of the
            # filesystem
            while True:
                try:
                    ret = _inner_load(mod_name)
                    if not reloaded and ret is not True:
                        self._refresh_file_mapping()
                        reloaded = True
                        continue
                    break
                except IOError:
                    if not reloaded:
                        self._refresh_file_mapping()
                        reloaded = True
                    continue

        return ret
425206
private TimerTask getASGUpdateTask() {
        return new TimerTask() {

            @Override
            public void run() {
                try {
                    if (!serverConfig.shouldUseAwsAsgApi()) {
                        // Disabled via the config, no-op.
                        return;
                    }

                    // First get the active ASG names
                    Set<CacheKey> cacheKeys = getCacheKeys();
                    if (logger.isDebugEnabled()) {
                        logger.debug("Trying to  refresh the keys for {}", Arrays.toString(cacheKeys.toArray()));
                    }
                    for (CacheKey key : cacheKeys) {
                        try {
                            asgCache.refresh(key);
                        } catch (Throwable e) {
                            logger.error("Error updating the ASG cache for {}", key, e);
                        }

                    }

                } catch (Throwable e) {
                    logger.error("Error updating the ASG cache", e);
                }

            }

        };
    }
1322962
private void load() throws IOException
    {
        if ( !knownHosts.exists() )
        {
            return;
        }

        assertKnownHostFileReadable();

        try ( BufferedReader reader = new BufferedReader( new FileReader( knownHosts ) ) )
        {
            String line;
            while ( (line = reader.readLine()) != null )
            {
                if ( (!line.trim().startsWith( "#" )) )
                {
                    String[] strings = line.split( " " );
                    if ( strings[0].trim().equals( serverId ) )
                    {
                        // load the certificate
                        fingerprint = strings[1].trim();
                        return;
                    }
                }
            }
        }
    }
243181
protected void loadAndReplace(K key) {
    Entry e;
    for (;;) {
      e = lookupOrNewEntry(key);
      synchronized (e) {
        e.waitForProcessing();
        if (e.isGone()) {
          metrics.goneSpin();
          continue;
        }
        e.startProcessing(Entry.ProcessingState.LOAD);
        break;
      }
    }
    boolean _finished = false;
    try {
      load(e);
      _finished = true;
    } finally {
      e.ensureAbort(_finished);
    }
  }
287334
def run(self, files, working_area):
        

        # Ensure that dictionary is ordered by check declaration order (via self.check_names)
        # NOTE: Requires CPython 3.6. If we need to support older versions of Python, replace with OrderedDict.
        results = {name: None for name in self.check_names}
        checks_root = working_area.parent
        with futures.ProcessPoolExecutor() as executor:

            # Start all checks that have no dependencies
            not_done = set(executor.submit(run_check(name, self.checks_spec, checks_root))
                           for name, _ in self.child_map[None])
            not_passed = []

            while not_done:
                done, not_done = futures.wait(not_done, return_when=futures.FIRST_COMPLETED)
                for future in done:
                    # Get result from completed check
                    result, state = future.result()
                    results[result.name] = result
                    if result.passed:
                        # Dispatch dependent checks
                        for child_name, _ in self.child_map[result.name]:
                            not_done.add(executor.submit(
                                run_check(child_name, self.checks_spec, checks_root, state)))
                    else:
                        not_passed.append(result.name)

        for name in not_passed:
            self._skip_children(name, results)

        return results.values()