I wanted to grab the concept of "Execution Context class" . I'm refering to this post at http://tinyurl.com/ryjn5o . Can anyone enlighten by explain more on how to create such class ?
An "execution context class" is just a holder class, created by the top level of your program, which holds all of the things (like the Transaction object in the linked example) from the top level which might be needed.
It's a packaged way to avoid global variables.
Some people believe that even this is kind of skeezy, because if top calls A which calls B which calls C which calls D which needs the top level, you have to pass the context to A, B, and C, which don't otherwise need it.
And so it promotes binding where it wouldn't be needed - A, B, and C are not reusable in a program which doesn't use this context. But it's a perfectly workable alternative to hidden global state, and to the endless proliferation of singletons and other messy things.
Edit: this paragraph is invalid: I do recommend that you use the ExecutionContext class in javax.resource.spi.work ( http://www.j2ee.me/j2ee/1.4/docs/api/javax/resource/spi/work/ExecutionContext.html ), because at least that restricts the binding on the intervening classes to a standard, rather than something app-specific.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With