On Fri, Mar 27, 2009 at 1:59 PM, hideki tihiri <[email protected]>wrote:
> Hi, > > I have a service in soapsession scope. > > The underlying code needs to access a record in a table (so multiple > sessions will try to lock te same record). > > How can I build in a kind of locking strategy ? > > Meaning, there are 2 operations that needs to be performed in the same > session(groupid): > service.operation1 ==> does something and, locks the record, return some > value. > service.operation2 ==> does something, unlock te record and return a value. > > My problem is that if, for some reason, service.operation2 is never called > by the client, the record is 'locked' forever. > > Any ideas what a good solution/strategy could be ? > I think you need to start a transaction with the first call and store the connection in the ServiceContext and use it on the second operation. you may use the service life cycle to events to rollback or commit the transactions. thanks, Amila. > > Regards, > > H. > > > -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/
