« Return to Thread: why copy the map this way?

why copy the map this way?

by 许恒 :: Rate this Message:

Reply to Author | View in Thread


in class *org.sakaiproject.entity.impl.EntityManagerComponent* , function

public void registerEntityProducer(EntityProducer manager, String
referenceRoot)
{
     if (referenceRoot == null || referenceRoot.trim().length() == 0)
        {
            referenceRoot = String.valueOf(System.currentTimeMillis());
            M_log.warn("Entity Producer does not provide a root reference :"
+ manager);
        }
        if (referenceRoot.startsWith("/"))
        {
            referenceRoot = referenceRoot.substring(1);
        }


        // Why copy the producer map in this way? It create two new Map
every regist active. I know the HashMap is asynchronous and efficient, but
why we use ConcurrencyMap ahead?
*        m_producersIn.put(referenceRoot, manager);
        m_performanceIn.put(manager, new Calls(manager));

        m_producers = new HashMap<String, EntityProducer>(m_producersIn);
        m_performance = new HashMap<EntityProducer, Calls>(m_performanceIn);
*
}

xuheng
2008-7-25

----------------------
This automatic notification message was sent by Sakai Collab (https://collab.sakaiproject.org//portal) from the DG: Development (a.k.a. sakai-dev) site.
You can modify how you receive notifications at My Workspace > Preferences.

 « Return to Thread: why copy the map this way?

LightInTheBox - Buy quality products at wholesale price!