Uploaded image for project: 'netvirt'
  1. netvirt
  2. NETVIRT-1510

Get rid of 'synchronized (String.intern())'

    XMLWordPrintable

Details

    Description

      Genius and Netvirt are using a very funky locking scheme, which is precisely:

      String foo; // related to what is being processed
      synchronized (foo.intern()) {
          // ...
      }
      

      From software design perspective, this is bonkers, as this synchronizes with any entity performing this same thing (or accidentally uses synchronized(String)) – leading to potential collisions and preventing reasoning about locks.

      From performance perspective, this is purely abysmal, as String.intern() is forcing a round-trip to the JVM level, cannot be optimized and is slow – as detailed in https://shipilev.net/jvm-anatomy-park/10-string-intern/ .

      This needs to tackle only hiding this monstrosity behind an API, not with a complete migration of netvirt code to some other locking scheme.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            abhinav.gupta Abhinav Gupta
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: