1. Velocity
  2. VELOCITY-595

ResourceManagerImpl.getResource() causes locking issues


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
    • Environment:
      jdk 1.5


      The ResourceManagerImpl.getResource() method is synchronized, which makes it difficult to share a Velocity Runtime between threads in an environment such as a j2ee web application.

      After upgrading Velocity to version 1.5 in Roller and running some performance tests I saw a very noticeable decrease in throughput for the application. I fired up jconsole and noticed that almost all of my app server threads were in a BLOCKED state and were waiting on the ResourceManagerImpl.getResource() method.

      In my particular case the difference resulted in a loss of 2/3 of my original ops/sec, which is pretty huge. After simply switching Velocity back to the 1.4 release and rerunning the test I saw the results I expected.

      I assume this is overactive use of Java synchronization because the developer guide suggests that the singleton model is "very appropriate model for use in a Servlet 2.2+ compliant web application".

      1. VELOCITY-595.jarkko.patch
        8 kB
        Nathan Bubna
      2. VELOCITY-595.patch
        2 kB
        Nathan Bubna

        Issue Links


          Allen Gilliland created issue -
          Nathan Bubna made changes -
          Field Original Value New Value
          Link This issue is related to VELOCITY-24 [ VELOCITY-24 ]
          Nathan Bubna made changes -
          Attachment VELOCITY-595.patch [ 12383794 ]
          Nathan Bubna made changes -
          Attachment VELOCITY-595.jarkko.patch [ 12386756 ]
          Nathan Bubna made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.6 [ 12310290 ]
          Resolution Fixed [ 1 ]
          Mark Thomas made changes -
          Workflow jira [ 12431183 ] Default workflow, editable Closed status [ 12551539 ]
          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12551539 ] jira [ 12552425 ]


            • Assignee:
              Allen Gilliland
            • Votes:
              1 Vote for this issue
              0 Start watching this issue


              • Created: