Adam Heath wrote:
Adrian Crum wrote:
Consider something stored into the cache, then referenced from another
thread.  What is the correct delegator?
Huh?

Entity caches store EntityCondition as key, and List<GenericValue> as
the value.  Fetching from the cache can still be made to work, because
the in-memory evaulation will use the thread's delegator, and
everything will work correctly.

However, when looking at the items in webtools' cache pages, you'll
end up seeing string versions of the conditions.   If the condition
objects start fetching the thread's delegator, they will end up using
the delegator that webtools has been configured to use, *not* the
version that represents the cache for which they were stored.

I'm sure there will be many decisions like that along the way. For now, the basic concept is you have a user or process who is logged into a particular delegator, and there is a static method available to retrieve it. In most cases, that approach will simplify code. There will be exceptions where you want to specify something different.

Let's say you have class methods that take a delegator argument. If a delegator argument isn't null, then the assumption is to use that as an alternate to the one the user is currently logged into (the default). If it's null, use the default.

-Adrian

Reply via email to