-
- All Implemented Interfaces:
-
ai.platon.pulsar.common.collect.Loadable,ai.platon.pulsar.common.collect.UrlCache
public final class LoadingUrlCache extends AbstractUrlCache implements Loadable<UrlAware>
Contains a sets of loading queues which can load urls from external source using urlLoader.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classLoadingUrlCache.Companion
-
Field Summary
Fields Modifier and Type Field Description private final ConcurrentNonReentrantLoadingQueuenonReentrantQueueprivate final ConcurrentNEntrantLoadingQueuenReentrantQueueprivate final ConcurrentLoadingQueuereentrantQueueprivate final List<Queue<UrlAware>>queuesprivate final IntegerexternalSizeprivate final IntegerestimatedExternalSizeprivate final ExternalUrlLoaderurlLoaderprivate final Integercapacityprivate final Stringnameprivate final Integerpriorityprivate final Integersizeprivate final IntegerestimatedSize
-
Constructor Summary
Constructors Constructor Description LoadingUrlCache(String name, Integer priority, ExternalUrlLoader urlLoader, Integer capacity)
-
Method Summary
Modifier and Type Method Description ConcurrentNonReentrantLoadingQueuegetNonReentrantQueue()A non-reentrant queue accepts the same url only once ConcurrentNEntrantLoadingQueuegetNReentrantQueue()An n-reentrant queue accepts the same url for n times at most ConcurrentLoadingQueuegetReentrantQueue()A reentrant queue accepts the same url multiple times List<Queue<UrlAware>>getQueues()IntegergetExternalSize()IntegergetEstimatedExternalSize()final ExternalUrlLoadergetUrlLoader()A loader to load urls from external sources final IntegergetCapacity()The capacity for each queue StringgetName()The cache name IntegergetPriority()The priority IntegergetSize()IntegergetEstimatedSize()Unitload()Collection<UrlAware>loadNow()UnitdeepClear()Clear both the local cache and external source. -
-
Constructor Detail
-
LoadingUrlCache
LoadingUrlCache(String name, Integer priority, ExternalUrlLoader urlLoader, Integer capacity)
-
-
Method Detail
-
getNonReentrantQueue
ConcurrentNonReentrantLoadingQueue getNonReentrantQueue()
A non-reentrant queue accepts the same url only once
-
getNReentrantQueue
ConcurrentNEntrantLoadingQueue getNReentrantQueue()
An n-reentrant queue accepts the same url for n times at most
-
getReentrantQueue
ConcurrentLoadingQueue getReentrantQueue()
A reentrant queue accepts the same url multiple times
-
getExternalSize
Integer getExternalSize()
-
getEstimatedExternalSize
Integer getEstimatedExternalSize()
-
getUrlLoader
final ExternalUrlLoader getUrlLoader()
A loader to load urls from external sources
-
getCapacity
final Integer getCapacity()
The capacity for each queue
-
getPriority
Integer getPriority()
The priority
-
getEstimatedSize
Integer getEstimatedSize()
-
loadNow
Collection<UrlAware> loadNow()
-
-
-
-