Package ai.platon.pulsar.common.collect
Class LoadingUrlCache
-
- 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.
-
-
Field Summary
Fields Modifier and Type Field Description public final static IntegerG_NON_REENTRANTpublic final static IntegerG_N_ENTRANTpublic final static IntegerG_REENTRANTprivate 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 Unitload()Collection<UrlAware>loadNow()UnitdeepClear()Clear both the local cache and external source. -
Methods inherited from class ai.platon.pulsar.common.collect.AbstractUrlCache
clear, getName, getPriority, removeDeceased -
Methods inherited from class ai.platon.pulsar.common.collect.UrlCache
getEstimatedSize, getSize -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
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
-
loadNow
Collection<UrlAware> loadNow()
-
-
-
-