Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Trying to understand Unsafe.park method

  1. #1
    Junior Member
    Join Date
    Jun 2022
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trying to understand Unsafe.park method

    I understand we have Object.wait method for same purpose. But I heard that Unsafe.park method performance is better. I am trying to find out Javadoc for Unsafe class. But I couldn't find it. Also there are limited resources where it is explained in details with code example.

    Can someone please share the details here or help me with some Java doc link? I also want to understand why it actually performs better than Object.wait method.

  2. #2
    Junior Member
    Join Date
    Jun 2022
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Trying to understand Unsafe.park method

    What I understood by more searching is that this class is not meant for public use. That's why there is no Javadoc. I found this article in W3 Spot https://www.w3spot.com/2020/07/diffe...va-thread.html. Though it is not an official doc, but it explains why performance is better for Unsafe.park method & the difference with Object.wait method. Anyways it also says that I should go with Object.wait method as an application developer which makes sense. I am parking my thought of using Unsafe.park for now.

Similar Threads

  1. CAR PARK SIMULATOR
    By philmartinuk in forum What's Wrong With My Code?
    Replies: 12
    Last Post: May 3rd, 2018, 04:00 AM
  2. Car Park Simulator - HELP!
    By lycan17 in forum AWT / Java Swing
    Replies: 1
    Last Post: August 15th, 2012, 08:11 AM
  3. About add and remove method of ListNode, i don't understand....
    By Timloneungpo in forum Collections and Generics
    Replies: 1
    Last Post: September 28th, 2011, 08:09 AM
  4. Unsafe cast
    By Kerr in forum Collections and Generics
    Replies: 2
    Last Post: April 19th, 2011, 06:49 AM