Package com.opengamma.engine.view.worker.trigger

Examples of com.opengamma.engine.view.worker.trigger.ViewCycleTriggerResult


  }

  private synchronized ViewCycleType waitForNextCycle() throws InterruptedException {
    while (true) {
      final long currentTimeNanos = System.nanoTime();
      final ViewCycleTriggerResult triggerResult = getMasterCycleTrigger().query(currentTimeNanos);

      ViewCycleEligibility cycleEligibility = triggerResult.getCycleEligibility();
      if (_forceTriggerCycle) {
        cycleEligibility = ViewCycleEligibility.FORCE;
        _forceTriggerCycle = false;
      }
      if (cycleEligibility == ViewCycleEligibility.FORCE || (cycleEligibility == ViewCycleEligibility.ELIGIBLE && _cycleRequested)) {
        _cycleRequested = false;
        ViewCycleType cycleType = triggerResult.getCycleType();
        if (_previousCycleReference == null) {
          // Cannot do a delta if we have no previous cycle
          cycleType = ViewCycleType.FULL;
        }
        try {
          getMasterCycleTrigger().cycleTriggered(currentTimeNanos, cycleType);
        } catch (final Exception e) {
          s_logger.error("Error notifying trigger of intention to execute cycle", e);
        }
        s_logger.debug("Eligible for {} cycle", cycleType);
        if (_masterCycleTriggerChanges != null) {
          // TODO: If we wish to support execution option changes mid-execution, we will need to add/remove any relevant triggers here
          // Currently only the run-as-fast-as-possible trigger becomes valid for the second cycle if we've also got wait-for-initial-trigger
          addMasterCycleTrigger(_masterCycleTriggerChanges);
          _masterCycleTriggerChanges = null;
        }
        return cycleType;
      }

      // Going to sleep
      final long wakeUpTime = triggerResult.getNextStateChangeNanos();
      if (_cycleRequested) {
        s_logger.debug("Sleeping until eligible to perform the next computation cycle");
        // No amount of market data can make us eligible for a computation cycle any sooner.
        _wakeOnCycleRequest = false;
      } else {
View Full Code Here

TOP

Related Classes of com.opengamma.engine.view.worker.trigger.ViewCycleTriggerResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.