Dear Experts,
I have received some feedback about the spec and the APIs. Please let me
know what your opinions are on these 6 items.
1. ContextService: To clarify the behavior when no interfaces is passed
in to the createContextualProxy APIs that takes "Class<?>... interfaces"
as one of the arguments
- We could either
- a) treat this as legal and the ContextService implementation would
find out the what interfaces that the object to have proxy created
implements, or
- b) throws exception, possibly IllegalArgumentException
2. ContextService: The name USE_PARENT_TRANSACTION is confusing.
Consider renaming to USE_CALLER_TRANSACTION
- This property is intended to run the proxy method under the same
transaction on the thread of the caller who invokes the proxy method to
be run on the same thread. The name USE_PARENT_TRANSACTION could lead
users to think that the proxy method would be invoked under the
transaction of the thread where the contextual proxy method was created.
3. ManagedTask: Consider renaming CONTEXTUAL_CALLBACK_HINT to
CONTEXTUAL_CALLBACK
- Reason being Java EE container are required to make the callback
contextual if this property is set to "true" for a submitted task.
Having "HINT" in the property name suggests that the Java EE container
can choose not to make the callback contextual.
- The javadoc for CONTEXTUAL_CALLBACK property would be
Execution property to be returned in|getExecutionProperties()|
<../../../javax/enterprise/concurrent/ManagedTask.html#getExecutionProperties%28%29>or|ContextService.createContextualProxy()|
<../../../javax/enterprise/concurrent/ContextService.html#createContextualProxy%28T,%20java.util.Map,%20java.lang.Class%29>*to
inform the Java EE Product Provider* about whether the methods
in|ManagedTaskListener|
<../../../javax/enterprise/concurrent/ManagedTaskListener.html>and|Trigger|
<../../../javax/enterprise/concurrent/Trigger.html>associated with this
task needs to be called under the same context as the task. Any values
other than "true" means the methods will be run with unspecified context.
4. ManagedTaskListener: Consider passing the task to methods of
ManagedTaskListener
- The idea is to allow the applications to resubmit the task from
ManagedTaskListener methods. ManagedTaskListener methods already passed
in ManagedExecutorService as one of the arguments.
- If we agree that this is a good idea, one possibility is to change the
first argument in the methods from Future to FutureTask.
5. Should we use annotations instead of executionProperties?
- For example, instead of using LONGRUNNING_HINT="true" and
IDENTITY_NAME="some description", a task can be annotated with something
like @LongRunning and @IdentityName(value="some description")
- CONTEXTUAL_CALLBACK[_HINT] would become an annotation for the
ManagedTaskListener implementation. For example @Contextual.
6. There is also a suggestion to use CDI Events mechanism with using
@Observes instead of ManagedTaskListener interface for getting notified
of task submission lifecycle callback.
Comments are welcome.
Regards
Anthony