[jboss-jira] [JBoss JIRA] Created: (JBCACHE-1253) Unneeded copying of data in Notifier

Bela Ban (JIRA) jira-events at lists.jboss.org
Sun Dec 30 03:02:26 EST 2007


Unneeded copying of data in Notifier
------------------------------------

                 Key: JBCACHE-1253
                 URL: http://jira.jboss.com/jira/browse/JBCACHE-1253
             Project: JBoss Cache
          Issue Type: Task
      Security Level: Public (Everyone can see)
    Affects Versions: 2.1.0.CR2
            Reporter: Bela Ban
         Assigned To: Manik Surtani


All Notifier.notifyXXX() methods are written like this:
 public void notifyNodeActivated(Fqn fqn, boolean pre, Map data, InvocationContext ctx)
   {
      boolean originLocal = ctx.isOriginLocal();
      Map dataCopy = copy(data); // <===== COPY !
      Transaction tx = ctx.getTransaction();
      List<ListenerInvocation> listeners = listenerInvocations.get(NodeActivated.class);

      if (listeners != null && listeners.size() > 0)
      {
         InvocationContext backup = resetInvocationContext(ctx);
         // ... bla bla
      }
   }

The data (hashmap) is copied regardless of whether there are actually any listeners, this leads to poor performance. I saw this as hotspot #1 in my perf tests with JBossCache in JProfiler.

FIX: copy only if there are any listeners

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list