WebObjects 5.2.3

com.webobjects.foundation
Class NSDelayedCallbackCenter

java.lang.Object
  extended bycom.webobjects.foundation.NSDelayedCallbackCenter

public class NSDelayedCallbackCenter
extends Object

An NSDelayedCallbackCenter object (also called a delayed callback center) provides a way to guarantee that particular methods are invoked after an event has ended. It allows you to postpone or schedule the execution of certain tasks for a point in time, for example because they can't be performed earlier, or because then they will have to be performed only once (combined effect). Selectors are registered with the delayed callback center in an internal list. The center, in turn, invokes them when the event ends. In WebObjects, this happens at the end of the current request-response cycle.

When a selector is registered, a priority is specified, which determines the order in which it is invoked relative to the other selectors. The selectors are invoked in order of ascending priority. To register a selector with the delayed callback center, use performSelector. To cancel it before the event ends, use cancelPerformSelector.

The event loop invokes eventEnded to indicate that the current event has ended. The eventEnded method invokes the queued selectors.

Each task has a default delayed callback center that you access with the defaultCenter static method.

See Also:
performSelector(NSSelector,Object,Object,int), cancelPerformSelector(NSSelector,Object,Object), eventEnded(), defaultCenter()

Constructor Summary
NSDelayedCallbackCenter()
           
 
Method Summary
 void cancelPerformSelector(NSSelector selector, Object target, Object argument)
          Removes the specified selector for the specified target object and argument from the list of registered selectors.
static NSDelayedCallbackCenter defaultCenter()
          Returns the current default center for the current request-response cycle.
 void eventEnded()
          Invokes the registered selectors in order of ascending priority.
 void performSelector(NSSelector selector, Object target, Object argument, int order)
          Registers selector to be invoked on target with the specified argument and order (priority).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NSDelayedCallbackCenter

public NSDelayedCallbackCenter()
Method Detail

cancelPerformSelector

public void cancelPerformSelector(NSSelector selector,
                                  Object target,
                                  Object argument)
Removes the specified selector for the specified target object and argument from the list of registered selectors. Only this specific combination of selector, target and argument will be removed.

Parameters:
selector - The selector to be cancelled (to be removed)
target - The target object for which the selector was registered
argument - The argument object for which the selector was registered

defaultCenter

public static NSDelayedCallbackCenter defaultCenter()
Returns the current default center for the current request-response cycle. This is the current delayed callback center (NSDelayedCallbackCenter) for the calling thread.

Returns:
the current default center

eventEnded

public void eventEnded()
Invokes the registered selectors in order of ascending priority. The event loop should invoke this method when the current event ends.


performSelector

public void performSelector(NSSelector selector,
                            Object target,
                            Object argument,
                            int order)
Registers selector to be invoked on target with the specified argument and order (priority). When the current event ends, the registered selectors are invoked in order of ascending priority.

Parameters:
selector - The selector to be registered
target - The target object on which the selector will be called
argument - The argument with which the selector will be called on the target object
order - The priority (order) of the invocation

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.