Oops, and _getClassLoader

 private ClassLoader _getClassLoader()
 {
return Thread.currentThread().getContextClassLoader(); }

Gabrielle Crawford wrote:
Here's the implementation I have so far in org.apache.myfaces.trinidadinternal.context.RequestContextImpl

  @Override
  public ConcurrentMap<String, Object> getApplicationScopedConcurrentMap()
  {
    ClassLoader cl = _getClassLoader();
ConcurrentMap<String, Object> classMap = _applicationMaps.get(cl);

    if (classMap == null)
    {
ConcurrentMap<String, Object> newClassMap = new ConcurrentHashMap<String, Object>(); ConcurrentMap<String, Object> oldClassMap = _applicationMaps.putIfAbsent(cl, newClassMap);

      classMap = ((oldClassMap != null)? oldClassMap : newClassMap);

      assert(classMap != null);
    }
return classMap;
  }


  @SuppressWarnings({"CollectionWithoutInitialCapacity"})
private static final ConcurrentMap<ClassLoader, ConcurrentMap<String, Object>> _applicationMaps = new ConcurrentHashMap<ClassLoader, ConcurrentMap<String, Object>>();

Martin Marinschek wrote:
where will this map be stored?

regards,

Martin

On Jan 29, 2008 6:38 AM, Matthias Wessendorf <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    +1

    On Jan 29, 2008 2:48 AM, Blake Sullivan
    <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
    > I'm, of course, in favor.
    >
    > -- Blake Sullivan
    >
    >
    > Gabrielle Crawford wrote:
    > > Hi,
    > >
    > > In case anyone filtered away the [jira] message.....
    > >
    > > I'd like to add the method described below to the requestContext.
    > >
    > > Comments? Objections?
    > >
    > > Thanks,
    > >
    > > Gab
    > >
    > > -------- Original Message --------
    > >
    > > add method to get an application scoped concurrentMap to
    RequestContext
    > >
    -----------------------------------------------------------------------
    > >
    > >                 Key: TRINIDAD-926
    > >                 URL:
    https://issues.apache.org/jira/browse/TRINIDAD-926
    > >             Project: MyFaces Trinidad
    > >          Issue Type: Improvement
    > >    Affects Versions: 1.2.5-core, 1.0.5-core
    > >            Reporter: Gabrielle Crawford
    > >            Assignee: Gabrielle Crawford
    > >            Priority: Minor
    > >
    > >
    > > This started with Trin Issue 891
    > > https://issues.apache.org/jira/browse/TRINIDAD-891
    > >
    > > To avoid the locking in the class loader we'd like to store a
    map of
    > > name->class per app. However the external context app map calls
    > > through to the ServletContext. The Servlet specification doesn't
    > > specify whether the ServletContext performs any locking on the
    > > ServletContext attributes and the ServletContext doesn't
    expose the
    > > necessary methods for efficient concurrent access
    (essentially the
    > > operations exposed on ConcurrentMap) necessary to work
    efficiently in
    > > many cases even if the ServletContext didn't need to perform
    locking
    > > on reads.  The result is that the ExternalContext's
    ApplicationMap
    > > can't implement ConcurrentMap.
    > > We'd like to add a method to the RequestContext to get an
    application
    > > scoped concurrent map. This would not call through to the servlet
    > > context. The api proposed is this:
    > >
    > >
    > > /**
    > >   * Gets a per application concurrent map. There is no
    synchronization
    > >   * with ServletContext attributes.
    > >   */
    > >  public abstract ConcurrentMap<String, Object>
    > > getApplicationScopedConcurrentMap();
    > >
    > >
    >
    >



    --
    Matthias Wessendorf

    further stuff:
    blog: http://matthiaswessendorf.wordpress.com/
    sessions: http://www.slideshare.net/mwessendorf
    mail: matzew-at-apache-dot-org




--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to