Pessimistic Locking with WCF Data Services

Thread is closed for posting
4 posts, 1 answers
  1. Nikolai Hellwig
    Nikolai Hellwig avatar
    16 posts
    Member since:
    Mar 2010

    Posted 07 Apr 2010 Link to this post

    hi,

    we're developing an application which is used in parallel with "Oracle Forms 11g". In order to prevent malfunction, we have to deal with locking. Forms is using "SELECT FOR UPDATE" for locking so we used OA Transactions with EXPLICIT_LOCKING in our application.
    Now we are starting to port our business layer to WCF. 
    So my questions are: 
    Is it possible to do Pessimistic Locking with WCF Services? 
    Would you recommend that?
    What alternative solutions do you know?

    thanks
    Nikolai Hellwig
    CHW Software GmbH
  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 07 Apr 2010 Link to this post

    Hello Nikolai,

    In principle this is possible. The only problem is that in order to perform '... for update', the connection will  be pinned (bound to the object scope), and therefore you will need to find+use the same object scope instance for the same client again. Otherwise another WCF client could get the scope -> pinned connection and would fail then. This applies only, if the client is stateful (doing the locking, going back to the client, returning to terminate the transaction).

    One consideration more: It is best practice to lock things only for a short period of time, otherwise the scalability in the server will be affected. How do you manage to keep the lock time down (or is it an atomar call like (find,lock,change,commit)?

    I do not know how Oracle Forms can perform concurrency control, but having 'ROWVERSION' field is another way of CC that does not involve explicit lock calls. You will need to consider the amount of work that is done in parallel, on how many different rows and which operations should be blocked if values change.

    Best wishes,
    Thomas
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Nikolai Hellwig
    Nikolai Hellwig avatar
    16 posts
    Member since:
    Mar 2010

    Posted 07 Apr 2010 Link to this post

    thank you very much.
    this is what i already thought. we're going to discuss this optimistic locking aproach with rowversions. The Only problem is, that Oracle Forms is blocking rows and if i try to change values (UPDATE ...), the thread is hanging until Forms commits the current Transaction.

    Is There a way of calling Native SQL (Select ... For Update) with Table Name and Primary Keys except scope.GetSqlQuery()?
  4. Answer
    Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 07 Apr 2010 Link to this post

    Hello Nikolai,

    there is no other way of doing SQL execution, except using stored procedures. 
    Maybe you should check if the lock timeout value is set correctly, so that lock do not block forever?

    Regards,
    Thomas
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top