browsermob-proxy icon indicating copy to clipboard operation
browsermob-proxy copied to clipboard

Dependency on GuiceyFruit, 3rd party repository

Open jekh opened this issue 12 years ago • 3 comments

PR #118 introduced a dependency on GuiceyFruit in Main.java, specifically the class Jsr250Module. This dependency requires adding a new repository to the pom, which is the only non-central repository the project uses. This can cause issues if, for example, access to 3rd party repositories is disabled or blocked.

I'm not familiar enough with GuiceyFruit to know what it does or why it's required for the changes in PR #118. Does anybody know why we need this? @nite23, can you comment?

jekh avatar Nov 19 '14 05:11 jekh

Yes, I agree we don't want that in there. Let's either copy a fork of the sources we need in to the repo or get the jar in to Maven central.

lightbody avatar Nov 19 '14 14:11 lightbody

GuiceyFruit allows us to use the JSR-250 annotation @PreDestroy. The only reason it's there is to stop the ScheduledExecutorService that handles expiration of proxies, whenever the ProxyManager singleton is destroyed. I did it this way purely for the simplicity, so I'm open to suggestions on how to get rid of the dependency. I could either rewrite the ExpirableMap so it doesn't use a scheduler (check expiration on write?), or somehow stop the scheduler in the main() method.

nite23 avatar Nov 19 '14 15:11 nite23

Continuing to use the ScheduledExecutorService makes the most sense to me. Since the ProxyManager and ExpirableMap are only used when running from the command line, could we just skip the graceful shutdown of the executor? As long as the spawned threads are daemon threads, they won't prevent the JVM from shutting down. You'll probably have to use the Executors.newSingleThreadScheduledExecutor(ThreadFactory threadFactory) method and create a ThreadFactory that sets the daemon flag, but that should be pretty easy and minimally invasive.

jekh avatar Nov 19 '14 17:11 jekh