Class BasicBrowserManager
-
- All Implemented Interfaces:
-
ai.platon.pulsar.skeleton.workflow.fetch.driver.BrowserManager,java.lang.AutoCloseable
public class BasicBrowserManager implements BrowserManager
-
-
Field Summary
Fields Modifier and Type Field Description private final BrowserSettingssettingsprivate final Map<BrowserId, Browser>browsersprivate final BrowserFactorybrowserFactoryprivate final ImmutableConfigconf
-
Constructor Summary
Constructors Constructor Description BasicBrowserManager(BrowserFactory browserFactory, ImmutableConfig conf)
-
Method Summary
Modifier and Type Method Description BrowserSettingsgetSettings()Map<BrowserId, Browser>getBrowsers()BrowserFactorygetBrowserFactory()final ImmutableConfiggetConf()final BooleanisActive(BrowserId browserId)Check if the browser is active. Browserlaunch(BrowserProfileMode profileMode)Browserlaunch(BrowserId browserId, BrowserSettings settings)Launch the system default browser, the system default browser is your daily used browser. BrowserlaunchSystemDefaultBrowser()Launch the system default browser, the system default browser is your daily used browser. BrowserlaunchDefaultBrowser()Launch the default browser, notice, the default browser is not the one you used daily. BrowserlaunchPrototypeBrowser()Launch the prototype browser, the prototype browser is a browser instance with default settings. BrowserlaunchRandomTempBrowser()Launch a random temporary browser, the browser's user data dir is a random temporary dir. BrowserfindBrowserOrNull(BrowserId browserId)Find an existing browser by id. UnitcloseBrowser(BrowserId browserId)Close a browser. UnitcloseBrowser(Browser browser)final UnitdestroyBrowserForcibly(BrowserId browserId)UnitcloseDriver(WebDriver driver)final WebDriverfindLeastValuableDriver()final UnitcloseLeastValuableDriver()final UnitdestroyZombieBrowsersForcibly()Destroy the zombie browsers forcibly, kill the associated browser processes, release all allocated resources, regardless of whether the browser is closed or not. final Unitmaintain()Unitclose()-
-
Method Detail
-
getSettings
BrowserSettings getSettings()
-
getBrowsers
Map<BrowserId, Browser> getBrowsers()
-
getBrowserFactory
BrowserFactory getBrowserFactory()
-
getConf
final ImmutableConfig getConf()
-
launch
Browser launch(BrowserProfileMode profileMode)
-
launch
Browser launch(BrowserId browserId, BrowserSettings settings)
Launch the system default browser, the system default browser is your daily used browser.
-
launchSystemDefaultBrowser
Browser launchSystemDefaultBrowser()
Launch the system default browser, the system default browser is your daily used browser.
-
launchDefaultBrowser
Browser launchDefaultBrowser()
Launch the default browser, notice, the default browser is not the one you used daily.
-
launchPrototypeBrowser
Browser launchPrototypeBrowser()
Launch the prototype browser, the prototype browser is a browser instance with default settings.
-
launchRandomTempBrowser
Browser launchRandomTempBrowser()
Launch a random temporary browser, the browser's user data dir is a random temporary dir.
-
findBrowserOrNull
@Synchronized() Browser findBrowserOrNull(BrowserId browserId)
Find an existing browser by id. If the browser is not found, return null.
- Parameters:
browserId- The browser id- Returns:
The browser or null if not found
-
closeBrowser
@Synchronized() Unit closeBrowser(BrowserId browserId)
Close a browser.
-
closeBrowser
@Synchronized() Unit closeBrowser(Browser browser)
-
destroyBrowserForcibly
@Synchronized() final Unit destroyBrowserForcibly(BrowserId browserId)
-
closeDriver
@Synchronized() Unit closeDriver(WebDriver driver)
-
findLeastValuableDriver
@Synchronized() final WebDriver findLeastValuableDriver()
-
closeLeastValuableDriver
@Synchronized() final Unit closeLeastValuableDriver()
-
destroyZombieBrowsersForcibly
@Synchronized() final Unit destroyZombieBrowsersForcibly()
Destroy the zombie browsers forcibly, kill the associated browser processes, release all allocated resources, regardless of whether the browser is closed or not.
-
close
@Synchronized() Unit close()
-
-
-
-