T
- if you implement a Callable
this is the result type of
the callable, if you implement a Runnable
you don't
need to specify this.public abstract class ERXTask<T> extends Object
Runnable
and/or Callable
tasks. It provides support for
cleaning up editing context locks at the end of your task's run() method
just like the behavior at the end of a normal R-R loop.Constructor and Description |
---|
ERXTask() |
Modifier and Type | Method and Description |
---|---|
T |
_call()
Override _call to provide your task's implementation if you have a
Callable . |
void |
_run()
Override _run to provide your task's implementation if you have a
Runnable . |
T |
call()
If you have a
Callable do not override call directly. |
protected com.webobjects.eocontrol.EOEditingContext |
newEditingContext()
You must manually lock and unlock the editing context returned by
this method. It is not recommended that you depend on auto
locking in background threads.
|
protected com.webobjects.eocontrol.EOObjectStore |
parentObjectStore()
See Effective Java item #71 for explanation of this threadsafe lazy
initialization technique
|
void |
run()
If you have a
Runnable do not override run directly. |
void |
setParentObjectStore(com.webobjects.eocontrol.EOObjectStore parentObjectStore) |
protected long |
taskEditingContextTimestampLag()
By design EOEditingContext's have a fetch timestamp (default is 1 hour)
that effectively creates an in-memory caching system for EOs.
|
public final void run()
Runnable
do not override run directly. Instead,
override _run. The run method in ERXTask makes your _run method appear
to be in a request, and cleans up resources at the end of the request.public void _run()
Runnable
.public final T call() throws Exception
Callable
do not override call directly. Instead,
override _call. The call method in ERXTask makes your _call method appear
to be in a request, and cleans up resources at the end of the request.Exception
- if unable to compute a resultpublic T _call() throws Exception
Callable
.Exception
- if unable to compute a resultprotected final com.webobjects.eocontrol.EOObjectStore parentObjectStore()
EOObjectStoreCoordinator
to
partition the task's EOF intensive work form the rest of the app.public final void setParentObjectStore(com.webobjects.eocontrol.EOObjectStore parentObjectStore)
parentObjectStore
- the parent, usually an EOObjectStoreCoordinator
to
partition the task's EOF intensive work from the rest of the
app. If you are going to manually set this, you should do it
before starting the task.protected com.webobjects.eocontrol.EOEditingContext newEditingContext()
protected long taskEditingContextTimestampLag()
Copyright © 2002 – 2020 Project Wonder.