Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1042799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:33:57+00:00 2026-05-16T15:33:57+00:00

I am currently resolving a performance degradation issue due to heavy lock contention. I

  • 0

I am currently resolving a performance degradation issue due to heavy lock contention. I am considering “Lock splitting” to resolve this issue.

The skeletal usage pattern is ::

CURRENT USAGE ::

public class HelloWorld{

   public static synchronized method1(){
       //uses resource 1
   }
   public static synchronized method2(){
        //uses resource 2
   }

}

MY APPROACH ::

since method1() and method2() does not use the same resource, I am thinking of splitting the locks. As of now, they both contend for the Class lock since they are both static synchronized. I am thinking of changing it to ::

public class HelloWorld{

   **private static Object resr1Lock = new Object();**

   public static method1(){
       synchronized(resrc1Lock){
            //uses resource 1
       }
   }

   **private static Object resr2Lock = new Object();** 
   public static method2(){
        synchronized(resrc2Lock){
             //uses resource 2
        }
   }

}

Will they now contend for the “Class Lock” or resr1Lock/resrc2Lock ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:33:57+00:00Added an answer on May 16, 2026 at 3:33 pm

    They will now contend for the 2 objects “resr1Lock”/”resrc2Lock. It will work as you expect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have this code: <?php echo '<meta name=robots content=noindex>'; $arr = json_decode(file_get_contents(http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json),true);
I am doing POC for one of my performance projects , Currently it is
I'm noticing exponential performance degradation in MySQL query execution times when queries include calls
This lightning is really affecting my game's performance because I am constantly adding and
I’m looking into an architecture for high scale web performance application (theoretical at this
I'm currently working on a performance critical application which incorporates legacy c code (a
I'm currently maintaining an "old" system written in C# .NET, removing some obsolete features
Currently, I am writing a MiddleWare application that synchronizes information between and accounting application
Currently I am using HTML files for parts of my user interface. I display
currently, I`m implementing a map App with Mono4Droid and there I`m using a WebView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.