ERXEC Class Reference

Inherits com::webobjects::eocontrol::EOEditingContext.

Inherited by ERXECLockingTestCase.EC.

Collaboration diagram for ERXEC:

Collaboration graph
[legend]

List of all members.

Classes

class  _DenyMergeDelegate
class  DefaultFactory
interface  Delegate
class  DumpLocksSignalHandler
interface  Factory

Public Member Functions

void _objectsChangedInStore (NSNotification nsnotification)
void _processObjectStoreChanges (NSDictionary info)
NSArray arrayFaultWithSourceGlobalID (EOGlobalID eoglobalid, String s, EOEditingContext eoeditingcontext)
boolean coalesceAutoLocks ()
NSDictionary committedSnapshotForObject (EOEnterpriseObject eoenterpriseobject)
Exception creationTrace ()
NSDictionary currentEventSnapshotForObject (EOEnterpriseObject eoenterpriseobject)
NSArray deletedObjects ()
void deleteObject (EOEnterpriseObject eo)
void deleteObjects (NSArray objects)
void dispose ()
void editingContextDidForgetObjectWithGlobalID (EOEditingContext eoeditingcontext, EOGlobalID eoglobalid)
 ERXEC (EOObjectStore os)
 ERXEC ()
EOEnterpriseObject faultForGlobalID (EOGlobalID eoglobalid, EOEditingContext eoeditingcontext)
void finalize () throws Throwable
void forgetObject (EOEnterpriseObject eoenterpriseobject)
EOGlobalID globalIDForObject (EOEnterpriseObject eoenterpriseobject)
boolean hasChanges ()
void initializeObject (EOEnterpriseObject eoenterpriseobject, EOGlobalID eoglobalid, EOEditingContext eoeditingcontext)
NSArray insertedObjects ()
void insertObject (EOEnterpriseObject eoenterpriseobject)
void insertObjectWithGlobalID (EOEnterpriseObject eoenterpriseobject, EOGlobalID eoglobalid)
void invalidateAllObjects ()
void invalidateObjectsWithGlobalIDs (NSArray nsarray)
Object invokeRemoteMethod (EOEditingContext eoeditingcontext, EOGlobalID eoglobalid, String s, Class aclass[], Object aobj[])
boolean isAutoLocked ()
void lock ()
void lockObject (EOEnterpriseObject eoenterpriseobject)
void lockObjectStore ()
EOEnterpriseObject objectForGlobalID (EOGlobalID eoglobalid)
NSArray objectsForSourceGlobalID (EOGlobalID eoglobalid, String s, EOEditingContext eoeditingcontext)
NSArray objectsWithFetchSpecification (EOFetchSpecification fs, EOEditingContext eoeditingcontext)
void objectWillChange (Object obj)
NSDictionary< Thread,
NSMutableArray< Exception > > 
openLockTraces ()
void processRecentChanges ()
void recordObject (EOEnterpriseObject eoenterpriseobject, EOGlobalID eoglobalid)
void redo ()
void refaultAllObjects ()
void refaultObject (EOEnterpriseObject eoenterpriseobject, EOGlobalID eoglobalid, EOEditingContext eoeditingcontext)
void refaultObject (EOEnterpriseObject eoenterpriseobject)
void refreshObject (EOEnterpriseObject eoenterpriseobject)
NSArray registeredObjects ()
void reset ()
void revert ()
void saveChanges (Object obj)
void saveChanges ()
void saveChangesInEditingContext (EOEditingContext eoeditingcontext)
void saveChangesTolerantly (boolean doesRetry)
void saveChangesTolerantly ()
void saveChangesTolerantly (boolean doesRetry, boolean mergesChanges)
void setCoalesceAutoLocks (boolean value)
void setDelegate (Object d)
void setOptions (boolean recoversFromException, boolean doesRetry, boolean mergesChanges)
void setSharedEditingContext (EOSharedEditingContext eosharededitingcontext)
void setUseAutoLock (boolean value)
void undo ()
void unlock ()
void unlockObjectStore ()
NSArray updatedObjects ()
boolean useAutoLock ()

Static Public Member Functions

static boolean defaultAutomaticLockUnlock ()
static boolean defaultCoalesceAutoLocks ()
static Factory factory ()
static boolean markOpenLocks ()
static EOEditingContext newEditingContext (EOObjectStore objectStore)
static EOEditingContext newEditingContext (boolean validation)
static EOEditingContext newEditingContext (EOObjectStore parent, boolean validationEnabled)
static EOEditingContext newEditingContext ()
static EOEditingContext newTolerantEditingContext (EOObjectStore osc)
static EOEditingContext newTolerantEditingContext ()
static EOEditingContext newTolerantEditingContext (EOObjectStore parent, boolean retry, boolean merge)
static String outstandingLockDescription ()
static void popLockedContextForCurrentThread (EOEditingContext ec)
static void pushLockedContextForCurrentThread (EOEditingContext ec)
static void registerOpenEditingContextLockSignalHandler (String signalName)
static void registerOpenEditingContextLockSignalHandler ()
static boolean safeLocking ()
static void saveChangesTolerantly (EOEditingContext ec)
static void saveChangesTolerantly (EOEditingContext ec, boolean doesRetry, boolean mergesChanges)
static void setFactory (Factory aFactory)
static void setMarkOpenLocks (boolean value)
static void setTraceOpenLocks (boolean value)
static void setUseUnlocker (boolean value)
static boolean traceOpenLocks ()
static void unlockAllContextsForCurrentThread ()
static boolean useUnlocker ()

Static Public Attributes

static boolean _shouldLockOnLockObjectStore = false
static final String EditingContextDidCreateNotification = "EOEditingContextDidCreate"
static final String EditingContextDidRevertChanges = "EOEditingContextDidRevertChanges"
static final String EditingContextFailedToSaveChanges = "EOEditingContextFailedToSaveChanges"
static final String EditingContextWillSaveChangesNotification = "EOEditingContextWillSaveChanges"
static final Logger lockLogger = Logger.getLogger("er.extensions.ERXEC.LockLogger")
static final Logger lockTrace = Logger.getLogger("er.extensions.ERXEC.LockTrace")
static final Logger log = Logger.getLogger(ERXEC.class)

Protected Member Functions

void _checkOpenLockTraces ()
void _initWithParentObjectStore (EOObjectStore parent)
void _saveChanges ()
boolean autoLock (String method)
void autoUnlock (boolean wasAutoLocked)
void didSaveChanges (NSArray insertedObjects, NSArray updatedObjects, NSArray deletedObjects)
void willSaveChanges (NSArray insertedObjects, NSArray updatedObjects, NSArray deletedObjects)

Static Protected Attributes

static Map< ERXEC, StringactiveEditingContexts = Collections.synchronizedMap(new WeakHashMap())
static Factory factory

Package Attributes

Thread lockingThread
String lockingThreadName
NSMutableDictionary< Thread,
NSMutableArray< Exception > > 
openLockTraces = new NSMutableDictionary<Thread, NSMutableArray<Exception>>()

Private Member Functions

boolean isLockedInThread ()
void processQueuedNotifications ()
synchronized void traceLock ()
synchronized void traceUnlock ()

Private Attributes

_NSDelegate _denyDelegate
boolean _doesRetry
boolean _mergesChanges
boolean _recoversFromException
int autoLocked
Boolean coalesceAutoLocks
Exception creationTrace
boolean isFinalizing
ThreadLocal< Integer > lockAttempts
NSMutableArray queuedNotifications = new NSMutableArray()
boolean savingChanges
Boolean useAutolock

Static Private Attributes

static Exception defaultTrace = new Exception("DefaultTrace")
static final NSSelector EditingContextDidFailSaveChangesDelegateSelector = new NSSelector("editingContextDidFailSaveChanges", new Class[] { EOEditingContext.class, EOGeneralAdaptorException.class })
static final NSSelector EditingContextDidRevertObjectsDelegateSelector = new NSSelector("editingContextDidRevertObjects", new Class[] { EOEditingContext.class, NSArray.class, NSArray.class, NSArray.class })
static final NSSelector EditingContextWillRevertObjectsDelegateSelector = new NSSelector("editingContextWillRevertObjects", new Class[] { EOEditingContext.class, NSArray.class, NSArray.class, NSArray.class })
static final String LockedContextsForCurrentThreadKey = "ERXEC.lockedContextsForCurrentThread"
static ThreadLocal< List > locks
static Boolean markOpenLocks
static Boolean traceOpenLocks
static Boolean useUnlocker


Detailed Description

Subclass of com.webobjects.eocontrol.EOEditingContext that has every public method overridden to support automatic lock/unlock handling for you. This is very useful, as it is potentially very dangerous to rely on EOFs automatic lock handling - it will invariably lead into deadlocks. As you will need to use this class and its subclasses exclusively as your ECs, it also contains a factory instances. The Factory also sets a default delegate for you and is used everywhere in ERExtensions and ERDirectToWeb. The Factory is actually an interface and you would create a new EC by using: ERXEC.newEditingContext() You can also install your own Factory classes. It is recommended to subclass ERXEC.DefaultFactory and override _createEditingContext()

Constructor & Destructor Documentation

ERXEC (  ) 

ERXEC ( EOObjectStore  os  ) 


Member Function Documentation

void _checkOpenLockTraces (  )  [protected]

void _initWithParentObjectStore ( EOObjectStore  parent  )  [protected]

void _objectsChangedInStore ( NSNotification  nsnotification  ) 

Overridden so add a bugfix from Lenny Marks

void _processObjectStoreChanges ( NSDictionary  info  ) 

Quick and experimental hack to hook into the merge-changes system. If it's not useful, it should be removed again.

void _saveChanges (  )  [protected]

Reimplemented in ERXECLockingTestCase.EC.

NSArray arrayFaultWithSourceGlobalID ( EOGlobalID  eoglobalid,
String  s,
EOEditingContext  eoeditingcontext 
)

boolean autoLock ( String  method  )  [protected]

Utility to actually emit the log messages and do the locking, based on the result of useAutoLock().

Parameters:
method method name which to prepend to log message
Returns:
whether we did lock automatically

Reimplemented in ERXECLockingTestCase.EC.

void autoUnlock ( boolean  wasAutoLocked  )  [protected]

Utility to unlock the EC is it was locked in the previous invocation.

Parameters:
wasAutoLocked true if the EC was autolocked

Reimplemented in ERXECLockingTestCase.EC.

boolean coalesceAutoLocks (  ) 

If you just use autolocking, you will end up churning locks constantly. Additionally, you can still end up with race conditions since you're not actually locking across your entire request. Coalescing auto locks attempts to solve this problem by leaving your auto lock open after the first use. This "hanging lock" will be cleaned up at the end of the RR loop by the unlocker.

NSDictionary committedSnapshotForObject ( EOEnterpriseObject  eoenterpriseobject  ) 

Exception creationTrace (  ) 

If traceOpenEditingContextLocks is true, returns the stack trace from when this EC was created

NSDictionary currentEventSnapshotForObject ( EOEnterpriseObject  eoenterpriseobject  ) 

static boolean defaultAutomaticLockUnlock (  )  [static]

Returns the value of the er.extensions.ERXEC.defaultAutomaticLockUnlock property, which turns on auto-locking by default. Also returns true if safeLocking is true.

static boolean defaultCoalesceAutoLocks (  )  [static]

Returns the value of the er.extensions.ERXEC.defaultCoalesceAutoLocks property, which turns on coalescing auto-locks, meaning that the EC gets locked once and unlocked at the end of the RR loop. Also returns true if safeLocking is true.

NSArray deletedObjects (  ) 

void deleteObject ( EOEnterpriseObject  eo  ) 

Overridden to support autoLocking and to call mightDelete() on subclasses of ERXEnterpriseObject.

void deleteObjects ( NSArray  objects  ) 

Utility to delete a bunch of objects.

void didSaveChanges ( NSArray  insertedObjects,
NSArray  updatedObjects,
NSArray  deletedObjects 
) [protected]

void dispose (  ) 

void editingContextDidForgetObjectWithGlobalID ( EOEditingContext  eoeditingcontext,
EOGlobalID  eoglobalid 
)

static Factory factory (  )  [static]

Gets the factory used to create editing contexts

Returns:
editing context factory

EOEnterpriseObject faultForGlobalID ( EOGlobalID  eoglobalid,
EOEditingContext  eoeditingcontext 
)

void finalize (  )  throws Throwable

void forgetObject ( EOEnterpriseObject  eoenterpriseobject  ) 

EOGlobalID globalIDForObject ( EOEnterpriseObject  eoenterpriseobject  ) 

boolean hasChanges (  ) 

void initializeObject ( EOEnterpriseObject  eoenterpriseobject,
EOGlobalID  eoglobalid,
EOEditingContext  eoeditingcontext 
)

NSArray insertedObjects (  ) 

void insertObject ( EOEnterpriseObject  eoenterpriseobject  ) 

void insertObjectWithGlobalID ( EOEnterpriseObject  eoenterpriseobject,
EOGlobalID  eoglobalid 
)

void invalidateAllObjects (  ) 

void invalidateObjectsWithGlobalIDs ( NSArray  nsarray  ) 

Object invokeRemoteMethod ( EOEditingContext  eoeditingcontext,
EOGlobalID  eoglobalid,
String  s,
Class  aclass[],
Object  aobj[] 
)

boolean isAutoLocked (  ) 

Returns whether we did autolock this instance.

Returns:
true if we were autolocked.

boolean isLockedInThread (  )  [private]

void lock (  ) 

Overridden to emit log messages and push this instance to the locked editing contexts in this thread.

Reimplemented in ERXECLockingTestCase.EC.

void lockObject ( EOEnterpriseObject  eoenterpriseobject  ) 

void lockObjectStore (  ) 

static boolean markOpenLocks (  )  [static]

Returns the value of the er.extensions.ERXEC.markOpenLocks property, which turns on marking of locks. You can see the threads that hold the lock either by kill -HUP, by the ERXDirectAction/showOpenEditingContextLockTraces action or by setting your App's statistic store to ERXStatisticStore. Also returns true if traceOpenLocks is true.

static EOEditingContext newEditingContext ( EOObjectStore  objectStore  )  [static]

Creates a new editing context with the specified object store as the parent object store. This method is useful when creating nested editing contexts. After creating the editing context the default delegate is set on the editing context.

Note: an EOEditingContext is a subclass of EOObjectStore so passing in another editing context to this method is completely kosher.

Parameters:
objectStore parent object store for the newly created editing context.
Returns:
new editing context with the given parent object store

static EOEditingContext newEditingContext ( boolean  validation  )  [static]

Factory method to create a new editing context with validation disabled. Sets the default no validation delegate on the editing context. Be careful - an editing context that does not perform validation means that none of the usual validation methods are called on the enterprise objects before they are saved to the database.

Parameters:
validation flag that determines if validation should or should not be enabled.
Returns:
a newly created editing context with a delegate set that has disabled validation.

static EOEditingContext newEditingContext ( EOObjectStore  parent,
boolean  validationEnabled 
) [static]

Creates a new editing context with the specified object store as the parent object store and with validation turned on or off depending on the flag passed in. This method is useful when creating nested editing contexts. After creating the editing context the default delegate is set on the editing context if validation is enabled or the default no validation delegate is set if validation is disabled.

Note: an EOEditingContext is a subclass of EOObjectStore so passing in another editing context to this method is completely kosher.

Parameters:
parent object store for the newly created editing context.
validationEnabled determines if the editing context should perform validation
Returns:
new editing context with the given parent object store and the delegate corresponding to the validation flag

static EOEditingContext newEditingContext (  )  [static]

Factory method to create a new editing context. Sets the current default delegate on the newly created editing context.

Returns:
a newly created editing context with the default delegate set.

static EOEditingContext newTolerantEditingContext ( EOObjectStore  osc  )  [static]

static EOEditingContext newTolerantEditingContext (  )  [static]

static EOEditingContext newTolerantEditingContext ( EOObjectStore  parent,
boolean  retry,
boolean  merge 
) [static]

Factory method to create a new tolerant editing context.

EOEnterpriseObject objectForGlobalID ( EOGlobalID  eoglobalid  ) 

NSArray objectsForSourceGlobalID ( EOGlobalID  eoglobalid,
String  s,
EOEditingContext  eoeditingcontext 
)

NSArray objectsWithFetchSpecification ( EOFetchSpecification  fs,
EOEditingContext  eoeditingcontext 
)

void objectWillChange ( Object  obj  ) 

NSDictionary<Thread, NSMutableArray<Exception> > openLockTraces (  ) 

If traceOpenEditingContextLocks is true, returns the stack trace from when this EC was locked

static String outstandingLockDescription (  )  [static]

Returns a string describing outstanding locks for the created ECs

Returns:
description of locks

static void popLockedContextForCurrentThread ( EOEditingContext  ec  )  [static]

Pops the given EC from the array of contexts to unlock. The ECs left over after the RR-loop will be automagically unlocked.

Parameters:
ec unlocked EOEditingContext

void processQueuedNotifications (  )  [private]

Overridden so add a bugfix from Lenny Marks

void processRecentChanges (  ) 

static void pushLockedContextForCurrentThread ( EOEditingContext  ec  )  [static]

Pushes the given EC to the array of locked ECs in the current thread. The ECs left over after the RR-loop will be automagically unlocked.

Parameters:
ec locked EOEditingContext

void recordObject ( EOEnterpriseObject  eoenterpriseobject,
EOGlobalID  eoglobalid 
)

void redo (  ) 

void refaultAllObjects (  ) 

void refaultObject ( EOEnterpriseObject  eoenterpriseobject,
EOGlobalID  eoglobalid,
EOEditingContext  eoeditingcontext 
)

Overridden to support autoLocking and to flush the cache of all ERXEnterpriseObjects.

void refaultObject ( EOEnterpriseObject  eoenterpriseobject  ) 

void refreshObject ( EOEnterpriseObject  eoenterpriseobject  ) 

NSArray registeredObjects (  ) 

static void registerOpenEditingContextLockSignalHandler ( String  signalName  )  [static]

Register the OpenEditingContextLockSignalHandler signal handle on the named signal.

Parameters:
signalName the name of the signal to handle

static void registerOpenEditingContextLockSignalHandler (  )  [static]

Register the OpenEditingContextLockSignalHandler signal handle on the HUP signal.

void reset (  ) 

void revert (  ) 

Overridden to support autoLocking and will/did revert delegate methods. *

static boolean safeLocking (  )  [static]

Returns the value of the er.extensions.ERXEC.safeLocking property, which is the new catch-all setting that turns on all of the recommended locking settings.

void saveChanges ( Object  obj  ) 

void saveChanges (  ) 

Smarter version of normal saveChanges() method. Overridden to support autoLocking and a bugfix from Lenny Marks, calls up Will/Did methods on ERXEnterpriseObjects and corrects issues with flushCaches() needing to be called on objects in the parent context when committing the child context to the parent. If the editing context is a child of the object-store coordinator---that is, it's not a nested context---this method behaves exactly the same as EOEditingContext.saveChanges(). Otherwise, this method looks over the changed objects in ec (updatedObjects(), insertedObjects() and deletedObjects()). The changed objects lists are filtered for instances of ERXGenericRecord. The order of operations then becomes:

  1. Call processRecentChanges() on the child context to propagate changes.
  2. Lock the parent editing context.
  3. On the deleted objects list in the child editing context, call flushCaches() on each corresponding EO in the parent context.
  4. Unlock the parent editing context.
  5. Call saveChanges() on the child, committing the child changes to the parent editing context.
  6. Lock the parent editing context.
  7. On the objects that were updated or inserted in the child, call flushCaches() on each corresponding EO in the parent context.
  8. Unlock the parent editing context.

The order of operations is a bit peculiar: flush deletes, save, flush inserts and updates. This is done because deletes must be flushed because there may be dependent computed state that needs to be reset. But following the delete being committed, the relationships to other objects cannot be relied upon so it isn't reliable to call flushCaches after the commit. It's not entirely correct to flush the deletes like this, but it's the best we can do.

This works around an issue in EOF that we don't get a merge notification when a child EC saves to its parent. Because there's no merge notification, flushCaches() isn't called by the EC delegate and we're essentially screwed vis-a-vis resetting computed state.

This method assumes that the ec is locked before this method is invoked, but this method will take the lock on the parent editing context if the ec is a nested context before and after the save in order to get the objects and to flush caches on them.

void saveChangesInEditingContext ( EOEditingContext  eoeditingcontext  ) 

static void saveChangesTolerantly ( EOEditingContext  ec  )  [static]

static void saveChangesTolerantly ( EOEditingContext  ec,
boolean  doesRetry,
boolean  mergesChanges 
) [static]

void saveChangesTolerantly ( boolean  doesRetry  ) 

void saveChangesTolerantly (  ) 

void saveChangesTolerantly ( boolean  doesRetry,
boolean  mergesChanges 
)

Saves changes and tries to recover from optimistic locking exceptions by refaulting the object in question, optionally merging the changed values and optionally retrying the save.

Parameters:
doesRetry when true, saves again after resolving. when false, throws the optimistic locking after resolving
mergesChanges 

void setCoalesceAutoLocks ( boolean  value  ) 

Sets whether or not coalescing auto locks should be enabled.

void setDelegate ( Object  d  ) 

Sets the delegate for this context.

static void setFactory ( Factory  aFactory  )  [static]

Sets the default editing context factory

Parameters:
aFactory factory used to create editing contexts

static void setMarkOpenLocks ( boolean  value  )  [static]

Sets whether or not open editing context lock marking is enabled.

void setOptions ( boolean  recoversFromException,
boolean  doesRetry,
boolean  mergesChanges 
)

Set the options for the saveChanges() operation.

Parameters:
recoversFromException 
doesRetry 
mergesChanges 

void setSharedEditingContext ( EOSharedEditingContext  eosharededitingcontext  ) 

static void setTraceOpenLocks ( boolean  value  )  [static]

Sets whether or not open editing context lock tracing is enabled.

void setUseAutoLock ( boolean  value  ) 

Sets whether to use autoLocking on this EC.

static void setUseUnlocker ( boolean  value  )  [static]

synchronized void traceLock (  )  [private]

Adds the current stack trace to openLockTraces.

static boolean traceOpenLocks (  )  [static]

Returns the value of the er.extensions.ERXEC.traceOpenLocks property, which turns on tracing of locks. You can see the trace either by kill -HUP, by the ERXDirectAction/showOpenEditingContextLockTraces action or by setting your App's statistic store to ERXStatisticStore.

synchronized void traceUnlock (  )  [private]

void undo (  ) 

void unlock (  ) 

Overridden to emit log messages and pull this instance from the locked editing contexts in this thread.

Reimplemented in ERXECLockingTestCase.EC.

static void unlockAllContextsForCurrentThread (  )  [static]

Unlocks all remaining locked contexts in the current thread. You shouldn't call this yourself, but let the Unlocker handle it for you.

void unlockObjectStore (  ) 

NSArray updatedObjects (  ) 

boolean useAutoLock (  ) 

Decides on a per-EC-level if autoLocking should be used.

static boolean useUnlocker (  )  [static]

Returns the value of the er.extensions.ERXEC.useUnlocker property, which turns on unlocking at the end of the RR loop. Also returns true if safeLocking is true.

void willSaveChanges ( NSArray  insertedObjects,
NSArray  updatedObjects,
NSArray  deletedObjects 
) [protected]


Member Data Documentation

_NSDelegate _denyDelegate [private]

boolean _doesRetry [private]

boolean _mergesChanges [private]

boolean _recoversFromException [private]

boolean _shouldLockOnLockObjectStore = false [static]

Technically, the OSC is public API and as such should also get auto-locked. In practice, it's called too often to warrant it. If you want, you can turn it on on a case by case basis.

Map<ERXEC, String> activeEditingContexts = Collections.synchronizedMap(new WeakHashMap()) [static, protected]

int autoLocked [private]

if > 0, there is an autolock on this editingContext

Boolean coalesceAutoLocks [private]

if true, then autolocks are left open inside of a request to be cleaned up at the end

Exception creationTrace [private]

if traceOpenEditingContextLocks is true, this contains the stack trace from this EC's call to lock

Exception defaultTrace = new Exception("DefaultTrace") [static, private]

final String EditingContextDidCreateNotification = "EOEditingContextDidCreate" [static]

Name of the notification that is posted after editing context is created.

final NSSelector EditingContextDidFailSaveChangesDelegateSelector = new NSSelector("editingContextDidFailSaveChanges", new Class[] { EOEditingContext.class, EOGeneralAdaptorException.class }) [static, private]

final String EditingContextDidRevertChanges = "EOEditingContextDidRevertChanges" [static]

Name of the notification that is posted when an editing context is reverted.

final NSSelector EditingContextDidRevertObjectsDelegateSelector = new NSSelector("editingContextDidRevertObjects", new Class[] { EOEditingContext.class, NSArray.class, NSArray.class, NSArray.class }) [static, private]

final String EditingContextFailedToSaveChanges = "EOEditingContextFailedToSaveChanges" [static]

Name of the notification that is posted when an editing context has failed to save changes.

final NSSelector EditingContextWillRevertObjectsDelegateSelector = new NSSelector("editingContextWillRevertObjects", new Class[] { EOEditingContext.class, NSArray.class, NSArray.class, NSArray.class }) [static, private]

final String EditingContextWillSaveChangesNotification = "EOEditingContextWillSaveChanges" [static]

Name of the notification that is posted before an editing context is saved.

Factory factory [static, protected]

holds a reference to the factory used to create editing contexts

boolean isFinalizing [private]

holds a flag if the EC is in finalize(). This is needed because we can't autolock then.

ThreadLocal<Integer> lockAttempts [private]

Initial value:

 new ThreadLocal<Integer>() {
                @Override
                protected Integer initialValue() {
                        return Integer.valueOf(0);
                }
        }

final String LockedContextsForCurrentThreadKey = "ERXEC.lockedContextsForCurrentThread" [static, private]

key for the thread storage used by the unlocker.

Thread lockingThread [package]

if traceOpenEditingContextLocks is true, this will contain the locking thread

And, as the name might change, also the name of the locking thread (might contain session ID or other info)

final Logger lockLogger = Logger.getLogger("er.extensions.ERXEC.LockLogger") [static]

Logs a message when set to DEBUG and an EC is locked/unlocked. Logs a message with trace if lockTrace is also set to DEBUG.

ThreadLocal<List> locks [static, private]

Initial value:

 new ThreadLocal() {
                @Override
                protected Object initialValue() {
                        return new Vector();
                }
        }

final Logger lockTrace = Logger.getLogger("er.extensions.ERXEC.LockTrace") [static]

Logs a message with trace when set to DEBUG if autoLocking is enabled and an EC is used without a lock. Adds traces to messages by lockLogger if it is also set to DEBUG.

final Logger log = Logger.getLogger(ERXEC.class) [static]

general logging

Boolean markOpenLocks [static, private]

holds a flag if editing context locks should be marked

NSMutableDictionary<Thread, NSMutableArray<Exception> > openLockTraces = new NSMutableDictionary<Thread, NSMutableArray<Exception>>() [package]

boolean savingChanges [private]

Boolean traceOpenLocks [static, private]

holds a flag if editing context locks should be traced

Boolean useAutolock [private]

decides whether to lock/unlock automatically when used without a lock.

Boolean useUnlocker [static, private]

holds a flag if locked ECs should be unlocked after the request-response loop.


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:08 2012 for Project Wonder by  doxygen 1.5.8