-
- All Implemented Interfaces:
-
ai.platon.pulsar.common.config.Parameterized,java.lang.AutoCloseable
public class WebDriverPoolManager extends PreemptChannelSupport implements Parameterized, AutoCloseable
Created by vincent on 18-1-1. Copyright @ 2013-2017 Platon AI. All rights reserved
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classWebDriverPoolManager.Companion
-
Field Summary
Fields Modifier and Type Field Description private final WebDriverSettingsdriverSettingsprivate final DurationidleTimeoutprivate final ConcurrentSkipListMap<BrowserInstanceId, LoadingWebDriverPool>driverPoolsprivate final ConcurrentSkipListSet<BrowserInstanceId>retiredPoolsprivate final BooleanisActiveprivate final InstantstartTimeprivate InstantlastActiveTimeprivate final DurationidleTimeprivate final BooleanisIdleprivate final <ERROR CLASS>numResetprivate final <ERROR CLASS>numTimeoutprivate final <ERROR CLASS>gaugesprivate final <ERROR CLASS>numWaitingprivate final <ERROR CLASS>numFreeDriversprivate final <ERROR CLASS>numWorkingDriversprivate final <ERROR CLASS>numAvailableDriversprivate final <ERROR CLASS>numOnlineprivate final WebDriverFactorydriverFactoryprivate final ImmutableConfigimmutableConfigprivate final BooleansuppressMetricsprivate final BooleanhasEventprivate final BooleanisNormalprivate final BooleanisPreemptedprivate final Stringname
-
Constructor Summary
Constructors Constructor Description WebDriverPoolManager(WebDriverFactory driverFactory, ImmutableConfig immutableConfig, Boolean suppressMetrics)
-
Method Summary
Modifier and Type Method Description final WebDriverSettingsgetDriverSettings()final DurationgetIdleTimeout()final ConcurrentSkipListMap<BrowserInstanceId, LoadingWebDriverPool>getDriverPools()final ConcurrentSkipListSet<BrowserInstanceId>getRetiredPools()final BooleangetIsActive()final InstantgetStartTime()final InstantgetLastActiveTime()final UnitsetLastActiveTime(Instant lastActiveTime)final DurationgetIdleTime()final BooleangetIsIdle()final <ERROR CLASS>getNumReset()final <ERROR CLASS>getNumTimeout()final <ERROR CLASS>getGauges()final <ERROR CLASS>getNumWaiting()final <ERROR CLASS>getNumFreeDrivers()final <ERROR CLASS>getNumWorkingDrivers()final <ERROR CLASS>getNumAvailableDrivers()final <ERROR CLASS>getNumOnline()final WebDriverFactorygetDriverFactory()final ImmutableConfiggetImmutableConfig()final BooleangetSuppressMetrics()final BooleangetHasEvent()final BooleangetIsNormal()final BooleangetIsPreempted()final StringgetName()final <R extends Any> Rrun(BrowserInstanceId browserId, Integer priority, VolatileConfig volatileConfig, SuspendFunction1<WebDriver, R> action)TODO: consider pro-actor model insteadreactor: tell me if you can do this job proactor: here is a job, tell me if you finished it final <R extends Any> Rrun(WebDriverTask<R> task)final LoadingWebDriverPoolcreateUnmanagedDriverPool(BrowserInstanceId browserId, Integer priority, VolatileConfig volatileConfig)Create a driver pool, but the driver pool is not added to driverPools final BooleanisRetiredPool(BrowserInstanceId browserId)final WebDrivercancel(String url)Cancel the fetch task specified by url remotely NOTE: A cancel request should run immediately not waiting for any browser task return final WebDrivercancel(BrowserInstanceId browserId, String url)Cancel the fetch task specified by url remotely NOTE: A cancel request should run immediately not waiting for any browser task return final UnitcancelAll()Cancel all the fetch tasks, stop loading all pages final UnitcancelAll(BrowserInstanceId browserId)Cancel all the fetch tasks, stop loading all pages final UnitcloseDriverPool(BrowserInstanceId browserId, Duration timeToWait)Cancel all running tasks and close all web drivers final StringformatStatus(BrowserInstanceId browserId, Boolean verbose)Unitclose()StringtoString()-
Methods inherited from class ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager
formatPreemptChannelStatus, getParams, preempt, releaseLocks, whenNormal, whenNormalDeferred -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
WebDriverPoolManager
WebDriverPoolManager(WebDriverFactory driverFactory, ImmutableConfig immutableConfig, Boolean suppressMetrics)
-
-
Method Detail
-
getDriverSettings
final WebDriverSettings getDriverSettings()
-
getIdleTimeout
final Duration getIdleTimeout()
-
getDriverPools
final ConcurrentSkipListMap<BrowserInstanceId, LoadingWebDriverPool> getDriverPools()
-
getRetiredPools
final ConcurrentSkipListSet<BrowserInstanceId> getRetiredPools()
-
getIsActive
final Boolean getIsActive()
-
getStartTime
final Instant getStartTime()
-
getLastActiveTime
final Instant getLastActiveTime()
-
setLastActiveTime
final Unit setLastActiveTime(Instant lastActiveTime)
-
getIdleTime
final Duration getIdleTime()
-
getNumReset
final <ERROR CLASS> getNumReset()
-
getNumTimeout
final <ERROR CLASS> getNumTimeout()
-
getGauges
final <ERROR CLASS> getGauges()
-
getNumWaiting
final <ERROR CLASS> getNumWaiting()
-
getNumFreeDrivers
final <ERROR CLASS> getNumFreeDrivers()
-
getNumWorkingDrivers
final <ERROR CLASS> getNumWorkingDrivers()
-
getNumAvailableDrivers
final <ERROR CLASS> getNumAvailableDrivers()
-
getNumOnline
final <ERROR CLASS> getNumOnline()
-
getDriverFactory
final WebDriverFactory getDriverFactory()
-
getImmutableConfig
final ImmutableConfig getImmutableConfig()
-
getSuppressMetrics
final Boolean getSuppressMetrics()
-
getHasEvent
final Boolean getHasEvent()
-
getIsNormal
final Boolean getIsNormal()
-
getIsPreempted
final Boolean getIsPreempted()
-
run
final <R extends Any> R run(BrowserInstanceId browserId, Integer priority, VolatileConfig volatileConfig, SuspendFunction1<WebDriver, R> action)
TODO: consider pro-actor model instead
reactor: tell me if you can do this job proactor: here is a job, tell me if you finished it
-
run
final <R extends Any> R run(WebDriverTask<R> task)
-
createUnmanagedDriverPool
final LoadingWebDriverPool createUnmanagedDriverPool(BrowserInstanceId browserId, Integer priority, VolatileConfig volatileConfig)
Create a driver pool, but the driver pool is not added to driverPools
-
isRetiredPool
final Boolean isRetiredPool(BrowserInstanceId browserId)
-
cancel
final WebDriver cancel(String url)
Cancel the fetch task specified by url remotely NOTE: A cancel request should run immediately not waiting for any browser task return
-
cancel
final WebDriver cancel(BrowserInstanceId browserId, String url)
Cancel the fetch task specified by url remotely NOTE: A cancel request should run immediately not waiting for any browser task return
-
cancelAll
final Unit cancelAll(BrowserInstanceId browserId)
Cancel all the fetch tasks, stop loading all pages
-
closeDriverPool
final Unit closeDriverPool(BrowserInstanceId browserId, Duration timeToWait)
Cancel all running tasks and close all web drivers
-
formatStatus
final String formatStatus(BrowserInstanceId browserId, Boolean verbose)
-
-
-
-