-
- 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 DurationtaskTimeoutprivate final DurationpollingDriverTimeoutprivate final DurationidleTimeoutprivate final ConcurrentSkipListMap<BrowserInstanceId, LoadingWebDriverPool>driverPoolsprivate final ConcurrentSkipListSet<BrowserInstanceId>retiredPoolsprivate final BooleanisActiveprivate final InstantstartTimeprivate InstantlastActiveTimeprivate final DurationidleTimeprivate final BooleanisIdleprivate final MeternumResetprivate final MeternumTimeoutprivate final Map<String, Gauge<out Object>>gaugesprivate final IntegernumWaitingprivate final IntegernumFreeDriversprivate final IntegernumWorkingDriversprivate final IntegernumAvailableDriversprivate final IntegernumOnlineprivate 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 DurationgetTaskTimeout()final DurationgetPollingDriverTimeout()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 MetergetNumReset()final MetergetNumTimeout()final Map<String, Gauge<out Object>>getGauges()final IntegergetNumWaiting()final IntegergetNumFreeDrivers()final IntegergetNumWorkingDrivers()final IntegergetNumAvailableDrivers()final IntegergetNumOnline()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()
-
getTaskTimeout
final Duration getTaskTimeout()
-
getPollingDriverTimeout
final Duration getPollingDriverTimeout()
-
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 Meter getNumReset()
-
getNumTimeout
final Meter getNumTimeout()
-
getNumWaiting
final Integer getNumWaiting()
-
getNumFreeDrivers
final Integer getNumFreeDrivers()
-
getNumWorkingDrivers
final Integer getNumWorkingDrivers()
-
getNumAvailableDrivers
final Integer getNumAvailableDrivers()
-
getNumOnline
final Integer 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)
-
-
-
-