This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Isolation & Locking  RSS feed

vaithee sub
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have two batch jobs that are invoked concurrently at times in each of the cluster that do the same thing. We would like to ensure that only one of them id running at any given time.
Everytiem the job runs it creates an entry in the database logging in the timestamp it started running. The table has a running sequence# as a primary key. So what we see when the jobs run concurrently is 2 records with the same start timestamp. We are using EJB CMT on each of the nodes.
I would like to know how to ensure that one of them runs at any given time and the other one gracefully exits. I assume that the way to control is at the database level as they are concurrently trying to insert a record in the database. I assume that the solution will be using a combination of isolation level setting and pessimistic locking.
We are using Websphere 6.1 and UDB.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!