Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6307918

RFE: Unsafe.tryMonitorEnter() support in HotSpot

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • hotspot
    • None
    • b48
    • generic
    • solaris_9

      In Mustang-b27 we integrated the single-threaded rendering project for the OGL-based
      Java 2D pipeline. Unfortunately this architecture has the potential for deadlock
      with the AWT Toolkit thread. See 6253009, 6280286, and 6249101 for more information
      on three related, but separate deadlock issues.

      There are a number of ways to solve the problem, most of which are complicated and
      require lots of changes. There is one simple solution, however, that avoids the
      deadlock by only entering the AWT lock if it is not already held. This solution
      requires functionality similar to ReentrantLock.tryLock(), but currently there is
      no tryLock() functionality for simple Java monitors (via the synchronized keyword
      or Unsafe.monitorEnter/Exit(), both of which are used to manage the AWT lock).

      This RFE is requesting a new Unsafe.tryMonitorEnter() method, with functionality
      similar to ReentrantLock.tryLock(). In sun.misc.Unsafe:
          public boolean tryMonitorEnter(Object o);

      This method would enter the monitor and return true if it is not currently locked;
      false otherwise. Note that we only need to call this method from Java code, so there
      is no need for a new JNI entrypoint offering this functionality.

            kbr Kenneth Russell (Inactive)
            campbell Christopher Campbell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: