Anthony,
The ContextService is required to provide for the serialization of
context, such that an application could capture context at one point and
save it for future use - even running it on another server or on the same
server after having restarted it. Additionally, the statement "Callable
or Runnable could already be run within an application context when used
with ManagedThreadFactory instances which have context configuration
properties defined" only covers limited scenarios, where each type of
context is always the same. But that often isn't the case. Consider
security context, where different users are invoking the app. The context
of the ManagedThreadFactory is not correct for this and would produce
undesirable behavior - not running as the correct user. ContextService is
required to address this.
Regards,
Fred Rowe
WebSphere Architect
IBM Software Group
Anthony Lai <anthony.lai_at_oracle.com>
08/21/2012 06:07 PM
Please respond to
jsr236-experts
To
jsr236-experts_at_concurrency-ee-spec.java.net
cc
Subject
[jsr236-experts] Thoughts on contextual proxy objects?
Dear experts,
I am having some doubts on how useful are contextual proxy objects and
whether they have a place in JSR 236.
Currently, section 3.3 in the specs listed a few usages for contextual
proxy objects:
- Contextual objects allow application components to develop a wide
variety of applications and services that are not normally possible in the
Java EE platform, such as workflow systems. When used in conjunction with
a ManagedThreadFactory, customized Java SE platform ExecutorService
implementations can be used.
Callable or Runnable could already be run within an application context
when used with ManagedThreadFactory instances which have context
configuration properties defined. In the example in section 3.3.1, the
tasks agency2 and agency3 could well be plain Callable and still be run
with the application's execution context if the ManagedThreadFactory at
"concurrent/ThreadFactory" in the same example is configured with
Context="concurrent/AllContexts".
- The ContextService also allows non-Java EE service callbacks (such as
JMS MessageListeners and JMX NotificationListeners) to run in the context
of the listener registrant instead of the implementation provider's
undefined thread context. See section 4.4.3 for an example).
Is JSR 236 the proper place where the issue of non-Java EE service
callbacks be handled?
Regards
Anthony