Adobe Version Cue CS3 Server Programmer’s Guide
Version Cue Architecture
16
z A short-running tasks thread pool, for tasks expected to be relatively short in duration,
which run synchronously. The threads in this pool are named “[Job Executor[shortRun-
ning]...” and can be viewed in the Version Cue SDK debugger.
z A longer-running tasks thread pool, for tasks expected to take a longer time, which run
asynchronously and can be associated with a progress monitor. The threads in this pool are
named “[Job Executor[longRunning]...”.
Within the handling of a job, when the job takes longer than about three seconds, a job pend-
ing status is returned to the Version Cue client. The job pending status object contains
progress information, which lets the client accurately reflect how much of the job has com-
pleted; for example, in a progress monitor widget shown to the end user.
Not all SOAP requests result in a transaction on the underlying database; for example, they
may be read-only calls at the controller level. See the Extension Point Reference under the
com.adobe.versioncue.controller.core.listener extension point, for information about whether
controller calls are read-only.
If it is not a read-only request, a SOAP request is processed in a thread from one of the job
executor pools, which invokes a controller call and then a transaction on the underlying data-
base in another thread of execution. There is one thread per transaction on the underlying
database.
The context you get using Context.currentContext() is a ThreadLocal variable, which belongs
to the current thread and is associated with a single request. Every transaction runs within the
context from which it was started.
The thread-pooling architecture is based on the work of Doug Lea (Lea, 2005), whose concur-
rency utilities are incorporated into JDK 1.5 through JSR166 “Concurrency Utilities.”
Caveats and Guidance for Thread-safety
The transaction on the database underlying Version Cue Server cannot be used over more
than one thread, and this should not be attempted. For example, if you were to start a new
thread, open a transaction on the underlying database, and continue processing the data
affected by the transaction in a different thread of execution, this pattern would fail. You must
be very cautious about creating new threads from the context of a valve or listener, as you
already have a distinct thread of execution within which the request is being processed.
We recommend you try to use the existing thread pools if you need to create new threads for
your own business logic, but you are not prevented from creating your own thread, such as
worker threads.
Optimistic Locking
Each transaction runs in its own thread, and an optimistic locking scheme controls concur-
rency and ensures the conditions for serializability are met when transactions are executed
concurrently. If a transaction has problems completing, owing to the unavailability of
resources needed to lock for modifications, three retry attempts are made before the transac-
tion is aborted. In this case, an OptimisticLockException is thrown, indicating an unusually
high load on the Version Cue Server.