MarketDataManager implements MarketDataListener, Lifecycle, SubscriptionStateQuery { public void requestMarketDataSubscriptions(final Set<ValueSpecification> requiredSubscriptions) { ArgumentChecker.notNull(requiredSubscriptions, "requiredSubscriptions"); Set<ValueSpecification> newSubscriptions = manageOngoingSubscriptions(requiredSubscriptions); if (!newSubscriptions.isEmpty()) { OperationTimer timer = new OperationTimer(s_logger, "Adding {} market data subscriptions", newSubscriptions.size()); makeSubscriptionRequest(newSubscriptions); timer.finished(); } } MarketDataManager(MarketDataChangeListener listener,
                           MarketDataProviderResolver marketDataProviderResolver,
                           String viewProcessorName,
                           String viewProcessId); SnapshotManager createSnapshotManagerForCycle(UserPrincipal marketDataUser, List<MarketDataSpecification> marketDataSpecifications); SnapshottingViewExecutionDataProvider getMarketDataProvider(); @Override void subscriptionsSucceeded(final Collection<ValueSpecification> valueSpecifications); @Override void subscriptionFailed(final ValueSpecification valueSpecification, final String msg); @Override void subscriptionStopped(final ValueSpecification valueSpecification); @Override void valuesChanged(Collection<ValueSpecification> specifications); void replaceMarketDataProviderIfRequired(UserPrincipal marketDataUser); void requestMarketDataSubscriptions(final Set<ValueSpecification> requiredSubscriptions); @Override int retryFailedSubscriptions(); MarketDataAvailabilityProvider getAvailabilityProvider(); boolean isMarketDataProviderDirty(); void markMarketDataProviderClean(); @Override synchronized void start(); @Override synchronized void stop(); @Override synchronized boolean isRunning(); @Override Map<String, SubscriptionStatus> queryFailedSubscriptions(); @Override Map<String, SubscriptionStatus> queryPendingSubscriptions(); @Override Map<String, SubscriptionStatus> queryRemovedSubscriptions(); @Override Map<String, SubscriptionStatus> queryActiveSubscriptions(); @Override int getFailedSubscriptionCount(); @Override int getPendingSubscriptionCount(); @Override int getRemovedSubscriptionCount(); @Override int getActiveSubscriptionCount(); @Override Map<String, SubscriptionStatus> querySubscriptionState(String ticker); static final Duration SUBSCRIPTION_ABANDONMENT_DURATION; static final Duration SUBSCRIPTION_RETRY_DURATION; }
@Test public void testMarketDataRequestIsInitiallyPending() { _manager.requestMarketDataSubscriptions(ImmutableSet.of(createValueSpecForMarketValue("AAPL."))); checkSingleSubscriptionState("AAPL.", SubscriptionStateQuery.SubscriptionState.PENDING); }