Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to make a method thread safe without using synchronized
keyword?

Answer Posted / venkat

Hi Jitender,

Here the scnroniziation is happening in methodA(){}
But the same thread(Thread-0) is executing even second time
also. Could you please clarify the same.

Here is the output.

Constructor..
Thread started..Thread-0
processing....Thread-0
Thread started..Thread-1
complete..Thread-0
processing....Thread-0
complete..Thread-0

Regards,
Venkat

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you replace all in word?

1010


what is the swingutilities.invokelater(runnable) method for? : Java thread

1004


Does java allow overriding static methods ?

1075


What is protected in java?

961


Add a value x to array from index l to r where 0 <= l <= r <= n-1

1051


Can You Have Virtual Functions In Java?

1108


Define an enumeration?

1002


What is var keyword ?

1143


What does the exclamation mark mean in java?

1195


I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com

1659


How can the checkbox class be used to create a radio button?

992


What is set and get methods in java?

938


Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?

1048


Is java a digit method?

963


What are heap memory and stack memory and what are memory tables.

945