Documentation Archive Developer
Search
PATH  WebObjects 4.0 Documentation > What's New in EOF 3.0

Table of Contents Previous Section

Support for Multi-Threaded Applications

Enterprise Objects Framework 3.0 provides thread-safe APIs. This means that you can now write a multi-threaded enterprise object application. (For information on multi-threading WebObjects applications, see "What's New in WebObjects 4.0.")

The following operations are now thread-safe:

Enterprise Objects Framework 3.0 allows one thread to be active in each EOEditingContext and one thread to be active in each EODatabaseContext. In other words, multiple threads can access and modify objects concurrently in different editing contexts, but only one thread can access the database at a time (to save, fetch, or fault). Consequently, the support for multi-threaded applications can't be used to increase the level of database concurrency, but this wasn't the goal. Rather, the goal for 3.0 was to provide thread safety for applications that perform other types of operations using multiple threads. To increase the level of database concurrency in your WebObjects applications, simply run multiple instances. This technique has been proven to scale very well.

The following tables describe the new API provided to support multi-threaded applications:
EOEditingContext (conformance to NSLocking)
lock Locks access to the EOEditingContext to prevent other threads from accessing it. You should lock the editing context when you are making changes to the object graph, when you are fetching objects, and when you are saving objects. Only one thread is allowed per editing context tree.
unlock Unlocks access to the EOEditingContext so that other threads may access it.
EODatabaseContext (conformance to NSLocking)
lock Locks access to the EODatabaseContext to prevent other threads from accessing it. You typically don't have to invoke this method yourself.
unlock Unlocks access to the EODatabaseContext. You typically don't have to invoke this method yourself.

Table of Contents Next Section