-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public abstract class PrivacyManager implements AutoCloseable
-
-
Field Summary
Fields Modifier and Type Field Description private final PrivacyContextIdGeneratorprivacyContextIdGeneratorprivate final BooleanisActiveprivate final ConcurrentLinkedDeque<PrivacyContext>zombieContextsprivate final ConcurrentHashMap<PrivacyContextId, PrivacyContext>activeContextsprivate final ImmutableConfigconf
-
Constructor Summary
Constructors Constructor Description PrivacyManager(ImmutableConfig conf)
-
Method Summary
Modifier and Type Method Description PrivacyContextIdGeneratorgetPrivacyContextIdGenerator()final BooleangetIsActive()final ConcurrentLinkedDeque<PrivacyContext>getZombieContexts()final ConcurrentHashMap<PrivacyContextId, PrivacyContext>getActiveContexts()NOTE: we can use a priority queue and every time we need a context, take the top one final ImmutableConfiggetConf()abstract FetchResultrun(FetchTask task, SuspendFunction2<FetchTask, WebDriver, FetchResult> fetchFun)Run a task within this privacy manager abstract PrivacyContextcomputeNextContext(Fingerprint fingerprint)Create a new context or return an exist one abstract PrivacyContextcomputeIfNecessary(Fingerprint fingerprint)Create a new context or return an exist one abstract PrivacyContextcomputeIfAbsent(PrivacyContextId id)Create a context with id and add to active context list if not absent abstract PrivacyContextcreateUnmanagedContext(PrivacyContextId id)Create a context and do not add to active context list Unitclose(PrivacyContext privacyContext)Unitclose()-
-
Method Detail
-
getPrivacyContextIdGenerator
PrivacyContextIdGenerator getPrivacyContextIdGenerator()
-
getIsActive
final Boolean getIsActive()
-
getZombieContexts
final ConcurrentLinkedDeque<PrivacyContext> getZombieContexts()
-
getActiveContexts
final ConcurrentHashMap<PrivacyContextId, PrivacyContext> getActiveContexts()
NOTE: we can use a priority queue and every time we need a context, take the top one
-
getConf
final ImmutableConfig getConf()
-
run
abstract FetchResult run(FetchTask task, SuspendFunction2<FetchTask, WebDriver, FetchResult> fetchFun)
Run a task within this privacy manager
-
computeNextContext
abstract PrivacyContext computeNextContext(Fingerprint fingerprint)
Create a new context or return an exist one
-
computeIfNecessary
abstract PrivacyContext computeIfNecessary(Fingerprint fingerprint)
Create a new context or return an exist one
-
computeIfAbsent
abstract PrivacyContext computeIfAbsent(PrivacyContextId id)
Create a context with id and add to active context list if not absent
-
createUnmanagedContext
abstract PrivacyContext createUnmanagedContext(PrivacyContextId id)
Create a context and do not add to active context list
-
close
Unit close(PrivacyContext privacyContext)
-
-
-
-