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 139021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:21:38+00:00 2026-05-11T07:21:38+00:00

Now, I’m not sure whether this is a stupid question, please bear with me

  • 0

Now, I’m not sure whether this is a stupid question, please bear with me if it is.

Is the lock on an object ‘recursive’, i. e. if two objects have references to a third object in their fields and a thread is running a synchronized method on one of the two, can any other thread access the third object?

// a and b are some objects that implement Runnable // they both reference the same third object a.ref = c; b.ref = c;  // a is run in a thread and processes some data in a loop for a long time // the method the loop belongs to is declared synchronized threadA = new Thread(a); threadA.start();  a.someSyncedMethod(); // this would block ... b.ref.someOtherSyncedMethod(); // ... but would this? a.ref.someOtherSyncedMethod(); // ... and how about this? 
  • 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. 2026-05-11T07:21:38+00:00Added an answer on May 11, 2026 at 7:21 am

    It’s worth separating out the concepts of ‘a lock’ and ‘locking an object’. There’s no real idea of ‘locking an object’ – there’s ‘acquiring (and releasing)’ the lock associated with an object. Yes, it sounds like I’m nitpicking – but the distinction is important because if you talk about an object being locked it sounds like no other threads will be able to change anything in the object while that lock is held.

    Instead, it just means that no other thread will be able to acquire the same lock while the lock is held. There’s no direct relationship between the lock and any of the contents of the object that the lock is associated with.

    Methods declared ‘synchronized’ acquire the lock associated with the instance of the object they belong to. This only makes other synchronized methods on the same object wait, and synchronized statements that explicitly sync on it.

    Personally I don’t like synchronized methods – I like to make it clearer by explicitly synchronizing on a (private, final) member variable which is only used for synchronization.

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

Sidebar

Ask A Question

Stats

  • Questions 323k
  • Answers 323k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can try to more accurately monitor memory usage by… May 14, 2026 at 12:57 am
  • Editorial Team
    Editorial Team added an answer One of the things to keep in mind is that… May 14, 2026 at 12:57 am
  • Editorial Team
    Editorial Team added an answer Welp. I went with a different approach if anyone is… May 14, 2026 at 12:57 am

Related Questions

this is what i have right now Drawing an RSS feed into the php,
Now, I know this is completely subjective, so please don't flame me. I've never
Now, I know a difference between parameters in a URL and a POST parameter:
Now, I could go ahead and write this using FileSystemWatcher etc, but before I
Now, I'm not sure whether this is a stupid question, please bear with me

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.