Skip to content

Commit

Permalink
use ReentrantLock instead of NSRecursiveLock
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Nov 18, 2012
1 parent 082572b commit d9b2502
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package er.extensions.eof;

import java.io.Serializable;
import java.util.concurrent.locks.ReentrantLock;

import org.apache.log4j.Logger;

Expand All @@ -18,7 +19,6 @@
import com.webobjects.foundation.NSDictionary;
import com.webobjects.foundation.NSMutableArray;
import com.webobjects.foundation.NSNotificationCenter;
import com.webobjects.foundation.NSRecursiveLock;

import er.extensions.foundation.ERXProperties;

Expand All @@ -41,7 +41,7 @@ public class ERXAdaptorOperationWrapper implements Serializable {

public static final Logger log = Logger.getLogger(ERXAdaptorOperationWrapper.class);

public static final NSRecursiveLock adaptorOperationsLock = new NSRecursiveLock();
public static final ReentrantLock adaptorOperationsLock = new ReentrantLock();

public static final String AdaptorOperationsDidPerformNotification = "AdaptorOperationsDidPerform";

Expand Down Expand Up @@ -111,10 +111,10 @@ public static void performWrappedAdaptorOperations(NSArray ops) {
EODatabaseContext context = EOUtilities.databaseContextForModelNamed(ec, op.operation().entity().model().name());
context.lock();
adaptorOperationsLock.lock();
EODatabaseChannel dchannel = context.availableChannel();
EOAdaptorChannel achannel = dchannel.adaptorChannel();
achannel.adaptorContext().beginTransaction();
try {
EODatabaseChannel dchannel = context.availableChannel();
EOAdaptorChannel achannel = dchannel.adaptorChannel();
achannel.adaptorContext().beginTransaction();
boolean wasOpen = achannel.isOpen();
if (!wasOpen) {
achannel.openChannel();
Expand Down

2 comments on commit d9b2502

@pascalrobert
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Johann, since this is changing the return type, I think it should have been marked as deprecated first and the change to be done later?

@darkv
Copy link
Member Author

@darkv darkv commented on d9b2502 Nov 19, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You think someone could be using this lock object in his own code? Seems quite improbable. The important methods lock(), tryLock() and unlock() exist in both classes.
Would you defer that change to Wonder 6.0? Even if we deprecate the object, we will have to switch from the one to the other without a transition time where botch objects are usable.

Please sign in to comment.