Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Cancellation of parallel queries on server
Cancellation of parallel queries on server [message #916005] Tue, 18 September 2012 11:47 Go to next message
Samuel  Renold is currently offline Samuel RenoldFriend
Messages: 17
Registered: January 2012
Junior Member
There is a mechanism to cancel long running statements on the server.
The mechanism works as follows:
- Each SQL statement is put into a map of currently running statements before it is executed.
- After the execution, the statement is removed from the map.

The client can request a cancel of the currently executing server calls.
This can be done by clicking the cancel button on the bottom right of the application window that appears e.g. when a search is executed.

This works as long as the server call does not open its own threads.
However, when the server call opens its own threads (e.g. for parallel execution of database queries), the mechanism no longer works.

In our application, a server call opens own threads. Each thread executes a query as can be seen in the following code snippet:

Object[][] searchResult = ServerUtility.doScoutTransaction(
new RunnableWithException<Object[][]>() {
public Object[][] run() throws Throwable {
return execSearch(searchFormData);
new Holder<IServerSession>(IServerSession.class,serverSession),

What is the recommended way to execute "interruptible" parallel queries on the server?

[Updated on: Tue, 18 September 2012 11:47]

Report message to a moderator

Re: Cancellation of parallel queries on server [message #916022 is a reply to message #916005] Tue, 18 September 2012 12:18 Go to previous messageGo to next message
Arthur vD is currently offline Arthur vDFriend
Messages: 52
Registered: March 2010
I have the same question, but I'm using ServerJobs:

    ServerJob myJob = new ServerJob("myJobName", ServerJob.getCurrentSession()) {

      protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {

Can I somehow ensure that cancel() is called on the jobs I've created on the server side, whenever I cancel the ClientJob that has called the server side service?
Re: Cancellation of parallel queries on server [message #940366 is a reply to message #916022] Thu, 11 October 2012 15:14 Go to previous message
Ken Lee is currently offline Ken LeeFriend
Messages: 97
Registered: March 2012
Hi Samuel,

I had a deeper look into the Scout code.

In the general case where the client application makes a server call, a server job is created with a new transaction.
This transaction will be registered in the ActiveTransactionRegistry that is a map containing the service request sequence number as key and the transaction object as value.
If the client cancels its query execution, the ServerProcessingCancelService is used where the client passes the previous service request sequence number as a parameter.
The server fetches the transaction object in the ActiveTransactionRegistry and then executes the cancel operation on it.

For your use case, the following would be required to enable cancellation of multiple server jobs:

  1. Each server job that is created inside the service call should have the same transaction sequence number. That could be done be calling the setter setTransactionSequence before the "child server job" is scheduled.
  2. When a child server job gets started, a new transaction object is created automatically and registered in the ActiveTransactionRegistry.
  3. ActiveTransactionRegistry must be able to map a transaction sequence number to a list of transaction objects.
    This however is currently not possible, since a the ActiveTransactionRegistry can only map one sequence number to a transaction object.

In summary, cancellation of multiple queries is currently not possible. But it could be done by extending the ActiveTransactionRegistry.

Feel free to create an enhancement ticket for Scout in Bugzilla

[Updated on: Thu, 11 October 2012 15:15]

Report message to a moderator

Previous Topic:Wizard: Manipulating the flow
Next Topic:Eclipse not picking up maven Managed Dependencies
Goto Forum:

Current Time: Tue Jun 19 10:30:24 GMT 2018

Powered by FUDForum. Page generated in 0.02002 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top