|
15 | 15 | */
|
16 | 16 | package com.navercorp.pinpoint.web.realtime.activethread.count.dao;
|
17 | 17 |
|
18 |
| -import com.google.common.cache.Cache; |
19 |
| -import com.google.common.cache.CacheBuilder; |
20 |
| -import com.navercorp.pinpoint.common.server.cluster.ClusterKey; |
21 | 18 | import com.navercorp.pinpoint.pubsub.endpoint.PubSubClientFactory;
|
22 | 19 | import com.navercorp.pinpoint.pubsub.endpoint.PubSubFluxClient;
|
23 | 20 | import com.navercorp.pinpoint.realtime.RealtimePubSubServiceDescriptors;
|
24 | 21 | import com.navercorp.pinpoint.realtime.dto.ATCDemand;
|
25 | 22 | import com.navercorp.pinpoint.realtime.dto.ATCSupply;
|
26 | 23 | import com.navercorp.pinpoint.redis.pubsub.RedisPubSubConfig;
|
27 | 24 | import com.navercorp.pinpoint.web.realtime.RealtimeWebCommonConfig;
|
28 |
| -import org.springframework.beans.factory.annotation.Value; |
29 | 25 | import org.springframework.context.annotation.Bean;
|
30 | 26 | import org.springframework.context.annotation.Configuration;
|
31 | 27 | import org.springframework.context.annotation.Import;
|
32 | 28 |
|
33 |
| -import java.util.concurrent.TimeUnit; |
34 |
| - |
35 | 29 | /**
|
36 | 30 | * @author youngjin.kim2
|
37 | 31 | */
|
38 | 32 | @Configuration
|
39 | 33 | @Import({ RealtimeWebCommonConfig.class, RedisPubSubConfig.class })
|
40 | 34 | public class ActiveThreadCountWebDaoConfig {
|
41 | 35 |
|
42 |
| - @Value("${pinpoint.web.realtime.atc.supply.expireInMs:3000}") |
43 |
| - private long supplyExpireInMs; |
44 |
| - |
45 |
| - @Value("${pinpoint.web.realtime.atc.supply.prepareInMs:10000}") |
46 |
| - private long prepareInMs; |
47 |
| - |
48 | 36 | @Bean
|
49 | 37 | PubSubFluxClient<ATCDemand, ATCSupply> atcEndpoint(PubSubClientFactory clientFactory) {
|
50 | 38 | return clientFactory.build(RealtimePubSubServiceDescriptors.ATC);
|
51 | 39 | }
|
52 | 40 |
|
53 | 41 | @Bean
|
54 |
| - Cache<ClusterKey, Fetcher<ATCSupply>> fetcherCache() { |
55 |
| - return CacheBuilder.newBuilder() |
56 |
| - .expireAfterAccess(1, TimeUnit.HOURS) |
57 |
| - .initialCapacity(512) |
58 |
| - .maximumSize(65536) |
59 |
| - .build(); |
60 |
| - } |
61 |
| - |
62 |
| - @Bean |
63 |
| - FetcherFactory<ClusterKey, ATCSupply> atcSupplyFetcherFactory( |
64 |
| - PubSubFluxClient<ATCDemand, ATCSupply> endpoint, |
65 |
| - Cache<ClusterKey, Fetcher<ATCSupply>> fetcherCache |
66 |
| - ) { |
67 |
| - final long recordMaxAgeNanos = TimeUnit.MILLISECONDS.toNanos(supplyExpireInMs); |
68 |
| - final long prepareInNanos = TimeUnit.MILLISECONDS.toNanos(prepareInMs); |
69 |
| - final ActiveThreadCountFetcherFactory fetcherFactory |
70 |
| - = new ActiveThreadCountFetcherFactory(endpoint, recordMaxAgeNanos, prepareInNanos); |
71 |
| - return new CachedFetcherFactory<>(fetcherFactory, fetcherCache); |
| 42 | + ActiveThreadCountDao activeThreadCountDao(PubSubFluxClient<ATCDemand, ATCSupply> client) { |
| 43 | + return new PubSubActiveThreadCountDao(client); |
72 | 44 | }
|
73 | 45 |
|
74 | 46 | }
|
0 commit comments