Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 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   is currently offline Samuel Friend
Messages: 22
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);
}
},
serverSession.getClass(),
new Holder<IServerSession>(IServerSession.class,serverSession),
null
);

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
Member
I have the same question, but I'm using ServerJobs:

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

      @Override
      protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
        SQL.selectInto("...
      }
    }
    myJob.schedule();

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
Member
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: Thu Mar 28 21:29:59 GMT 2024

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

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

Back to the top