Package com.opengamma.id

Examples of com.opengamma.id.VersionCorrection


    // TODO: The distributed caches use a message bus for eventual consistency. This should really be (NOW - maximum permitted clock drift - eventual consistency time limit)
    return Instant.now();
  }

  private VersionCorrection getResolverVersionCorrection(final ViewCycleExecutionOptions viewCycleOptions) {
    VersionCorrection vc;
    do {
      vc = viewCycleOptions.getResolverVersionCorrection();
      if (vc != null) {
        break;
      }
      final ViewCycleExecutionOptions options = getExecutionOptions().getDefaultExecutionOptions();
      if (options != null) {
        vc = options.getResolverVersionCorrection();
        if (vc != null) {
          break;
        }
      }
      vc = VersionCorrection.LATEST;
    } while (false);
    // Note: NOW means NOW as the caller has requested LATEST. We should not be using the valuation time.
    if (vc.getCorrectedTo() == null) {
      if (vc.getVersionAsOf() == null) {
        if (!_ignoreCompilationValidity) {
          subscribeToTargetResolverChanges();
        }
        return vc.withLatestFixed(now());
      } else {
        vc = vc.withLatestFixed(now());
      }
    } else if (vc.getVersionAsOf() == null) {
      vc = vc.withLatestFixed(now());
    }
    unsubscribeFromTargetResolverChanges();
    return vc;
  }
View Full Code Here


  public CalculationJob buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
    final CalculationJobSpecification jobSpec = CalculationJobSpecificationFudgeBuilder.buildObjectImpl(message);
    final CacheSelectHint cacheSelectHint = CacheSelectHintFudgeBuilder.buildObjectImpl(message);
    final long[] requiredJobIds = message.getValue(long[].class, REQUIRED_FIELD_NAME);
    final long functionInitializationIdentifier = message.getLong(FUNCTION_INITIALIZATION_IDENTIFIER_FIELD_NAME);
    final VersionCorrection resolverVersionCorrection = deserializer.fieldValueToObject(VersionCorrection.class, message.getByName(RESOLVER_VERSION_CORRECTION_FIELD_NAME));
    final List<CalculationJobItem> jobItems = buildItemsObject(deserializer, message.getMessage(ITEMS_FIELD_NAME));
    return new CalculationJob(jobSpec, functionInitializationIdentifier, resolverVersionCorrection, requiredJobIds, jobItems, cacheSelectHint);
  }
View Full Code Here

        s_logger.error("Error obtaining compilation valuation time", e);
        cycleExecutionFailed(executionOptions, new OpenGammaRuntimeException("Error obtaining compilation valuation time", e));
        return;
      }

      final VersionCorrection versionCorrection = getResolverVersionCorrection(executionOptions);
      VersionCorrectionUtils.lock(versionCorrection);
      try {
        final CompiledViewDefinitionWithGraphs compiledViewDefinition;
        try {
          // Don't query the cache so that the process gets a "compiled" message even if a cached compilation is used
View Full Code Here

    final ViewExecutionCacheLock locks = new ViewExecutionCacheLock();
    final ViewExecutionCacheKey keyA = ViewExecutionCacheKey.of(viewDefinition(), marketDataProvider("A"));
    final ViewExecutionCacheKey keyB = ViewExecutionCacheKey.of(viewDefinition(), marketDataProvider("B"));
    final Instant valuationTimeA = Instant.now();
    final Instant valuationTimeB = valuationTimeA.plusSeconds(100);
    final VersionCorrection resolverVersionCorrectionA = VersionCorrection.of(valuationTimeA.minusSeconds(1), valuationTimeA.minusSeconds(2));
    final VersionCorrection resolverVersionCorrectionB = VersionCorrection.of(valuationTimeA.minusSeconds(3), valuationTimeA.minusSeconds(3));
    @SuppressWarnings("unchecked")
    final Pair<Lock, Lock>[] ls = new Pair[] {locks.get(keyA, valuationTimeA, resolverVersionCorrectionA),
        locks.get(keyA, valuationTimeA, resolverVersionCorrectionB),
        locks.get(keyA, valuationTimeB, resolverVersionCorrectionA),
        locks.get(keyA, valuationTimeB, resolverVersionCorrectionB),
View Full Code Here

TOP

Related Classes of com.opengamma.id.VersionCorrection

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.