Trying to clear a dead-lock of some type
Trying to clear a dead-lock of some type
- Subject: Trying to clear a dead-lock of some type
- From: WebObjects <email@hidden>
- Date: Thu, 19 May 2005 12:22:26 -0700
The following function works consistently, unless there is some contention
(I'm sharing a datasource with other applications). There is the expected
issue of saving to a locked row - but even if I trap the exception, then
repeat this function some time later (after I'm certain the other apps are
not locking the same rows) I still get the same contention.
First, do you see anything in this method that is out of place or sequence?
(it occurs in a TimerTask within Application) I'm not 100% certain that my
ec.refreshAllObjects is place in the proper place.
Advice is greatly appreciated!
-Bill
public void SearchForSixAMTasks() {
try{
TimeZone tz = TimeZone.getTimeZone("Etc/GMT");
NSTimestamp SixAM = new NSTimestamp(1899, 12, 30, 14, 2, 0, tz);
NSMutableArray args = new NSMutableArray();
args.addObject(SixAM);
args.addObject("0");
EOQualifier qualifier =
EOQualifier.qualifierWithQualifierFormat("starttime = %@ AND
taskcompletedindicator = %@", args);
EOFetchSpecification spec = new EOFetchSpecification("Tbltasks",
qualifier, null);
EOEditingContext ec = new EOEditingContext();
ec.refreshAllObjects();
//lock EC
ec.lock();
//Fetch
NSArray array = ec.objectsWithFetchSpecification(spec);
NSMutableArray foundTasks = new NSMutableArray(array);
Enumeration e = foundTasks.objectEnumerator();
while(e.hasMoreElements()) {
Tbltasks currentTask = (Tbltasks)e.nextElement();
TaskReview review = new TaskReview();
System.out.println(currentTask.taskcomment() + " - before
change.");
review.GetRepsData(currentTask); //data is
read,modified,etc. in this method
System.out.println(currentTask.taskcompletedindicator());
System.out.println(currentTask.alarmindicator());
}
ec.saveChanges();
//-- unlock EC
ec.unlock();
ec.refreshAllObjects();
} catch (Exception e) {
// - Definite potential for locking issues with TPE, but
only when intentionally trying to break it
System.out.println("RepeatingTask: exception in
SearchForSixAMTasks()");
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden