java - How should I access class members in beforeExecute and afterExecute hooks in ThreadPoolExecutor? -


i extending threadpoolexecutor class. inside want set member value in beforeexecute (thread t, runnable r) , afterexecute (runnable r, throwable t). not sure how so. can me that?

presumably, want access instance field of runnable instances. access them need downcast runnable actual class of runnable class, , access fields via downcast reference. or better still, make fields private , access them via getter / setter calls on reference.

this awkward if runnable anonymous inner class. in case, may need turn named class: either nested, inner or top level.

on other hand, if talking static fields or methods of runnable implementation class, can use them ... provided access modifiers allow this.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -