@Provides @Singleton @Memoized public Supplier<Map<String, Network>> listNetworks(AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds, final NetworksForCurrentUser networksForCurrentUser) { return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, networksForCurrentUser, seconds, TimeUnit.SECONDS); }
@Provides @Singleton @Region protected Supplier<Set<String>> regionIdsSupplier(AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds, RegionIdFilter filter, RegionIdsSupplier uncached) { return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, Suppliers.compose(new FilterStrings(filter), uncached), seconds, TimeUnit.SECONDS); }
@Provides @Singleton @Memoized Supplier<Map<URI, Location>> locationsByUri( @Memoized final Supplier<Set<? extends Location>> locations, @Named(PROPERTY_SESSION_INTERVAL) long seconds) { return memoizeWithExpiration(new Supplier<Map<URI, Location>>() { @Override public Map<URI, Location> get() { ImmutableMap.Builder<URI, Location> result = ImmutableMap.builder(); for (Location location : locations.get()) { result.put(URI.create(location.getDescription()), location); } return result.build(); } }, seconds, SECONDS); }
@Provides @Singleton // TODO: we should eventually get rid of memoized as an annotation, as it is confusing @Memoized protected Supplier<Set<? extends Location>> memoizedLocationsSupplier( AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds, LocationsSupplier uncached) { return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, uncached, seconds, TimeUnit.SECONDS); }
@Provides @Singleton @Zone protected Supplier<Set<String>> zoneIdsSupplier( AtomicReference<AuthorizationException> authException, @Named(PROPERTY_SESSION_INTERVAL) long seconds, ZoneIdFilter filter, ZoneIdsSupplier uncached) { return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, Suppliers.compose(new FilterStrings(filter), uncached), seconds, TimeUnit.SECONDS); }
@Provides @Named("eventhub.journaleventstorage") public Journal getEventJournal( @Named("eventhub.eventstorage.directory") String eventStorageDirectory, @Named("eventhub.journaleventstorage.journalFileSize") int journalFileSize, @Named("eventhub.journaleventstorage.journalWriteBatchSize") int journalWriteBatchSize) { return JournalUtil.createJournal(eventStorageDirectory + "/event_journal/", journalFileSize, journalWriteBatchSize); }
@Provides @Singleton public WarningCollectorFactory createWarningCollectorFactory(WarningCollectorConfig config, TestingWarningCollectorConfig testConfig) { requireNonNull(config, "config is null"); requireNonNull(testConfig, "testConfig is null"); return () -> new TestingWarningCollector(config, testConfig); } }