Tutorial on the impasse, should not block even

The deadlock tutorial consists of two sons and two objects of a friend: alphonse and gaston

Allows you to call your threads. and Tg.

Ta starts by calling: alphonse.bow (gaston)
GE starts by calling: gaston.bow (alphonse)

If two threads call the same method 'arc' of separate objects. No conflict.

Ta then calls gaston.bowBack, same Tg call alphonse.bowBack

So the two threads call bowBack, this may or may not be at different times and a call may or may not overlap.

The threads then ask "bowBack" of each object. Again he must avoid any conflict. BUT for some reason, there isn't and this
What says the tutorial. Well that doesn't matter that each thread calling the same method, they are separate objects.
This is the case also for when Ta and Tg calling 'Bow' - same different objects of the method.
SO WHY should the threads will block when the 'same method, different objects' call for bowBack?

WHAT ME MISSING HERE? -J' I seem to have completely missed the point of the example.
As I understand it, both threads are unable to enter a method synchronized of the same object. So we must avoid a conflict in the example of the tutorial.
Can someone explain what's wrong with my reasoning?

Published by: 838238 on February 20, 2011 13:12

To put it another way, if we have two complete different objects (i.e. the data they contain are completely different) and two threads attempt to enter the same method, but operate on different objects, we have a deadlock.

N ° deadlock occurs when two or more locks are required in different orders of two or more threads. It can occur only in Java if you use locks or synchronization. It has nothing to do with the methods se.

Given that the threads do not operate on the same data set, it seems unnecessary to have methods synchronized in the first place, unless the threads enter the methods of the same object.

The deadlock proves that they are the same object blocking.

So in summary, the "synchronized" keyword requires a very strict on a method lock, even if the discussions do not share the same object/data.

Fake.

It does not seem necessary.

It is incorrect. Your comments on what is locked up are at fault.

Tags: Java

Similar Questions

  • What reason is there to find my friends send me the mesasge 'Location not available', even though the iPhone, I'll try to find is always on and always is sharing its location with me?

    What reason is there to find my friends send me the mesasge 'Location not available', even though the iPhone, I'll try to find is always on and always is sharing its location with me?

    Hello

    If there are several device linked to the account, it's probably just that it took to give the positions of the other device or the iPhone is not connected by wifi or cellular connection.

  • How do to set the policy, the user should not change/reset password twice within 24 hours

    Hello

    I have a requirement in which, the user should not change/reset password twice within 24 hours. Is there a way to achieve the IOM.

    Is there a property in IOM whereby we can set this property?

    I checked the password and all the properties of the system strategy, but he could find a?

    Could you please suggest, how to get there. all references are greatly appreciated.

    Thanks in advance

    If you set password history on don't allow orevious you can reference the table pwh.

    You can also create a UDF who inquire about the handler reset passwoed and check against it. IOM has many points of validation of your code to.

    -Kevin

  • The music does not open even when no signal.

    I have a spotty cell service where I live. When at work and I am in one of these areas of service not, my music even will not open. I saved music to play offline, but the screen is not yet open. (If I'm in a 'dead zone') no cell signal) does not even open the music.  It searches only. I can't open until I again service.

    Really? Argh! It will be a nightmare when I travel through the mountains of Colorado.  Looks like I'll be getting my Nano out of retirement.

  • ODI-17769: OdiRef: internal ID of the SnpSession of the IObjects should not be used when the repository is in mode 12 c

    Hi people,

    I created a variable with refreshing: select '< % = odiRef.getPrevStepLog ("SESS_NO") % >' FROM DUAL

    The error Code is:

    ODI-17769: OdiRef: ID internal 261 of the IObjects SnpSession should not be used when the repository is in mode 12 c.

    Here is a solution for getLoadPlanInstance offered:

    Rittman Mead Consulting"Data Integration tips: ODI 12 c - Substitution API GUID

    based on a "non-written response" by David Allan of Oracle data integration team

    But what of on SESS_NO? Is there a "written response" too?

    Thanx

    Frank

    Hello

    Something like below:

    For example, SESS_NO = "<%=odiRef.getPrevStepLog("SESS_NO")%>". »

    try to replace it by GLOBAL_ID = "<%=odiRef.getPrevStepLog("SESS_GUID")%>." »

    If you use KMs delivered with ODI, you must replace them with their corresponding versions of 12 c.

    If you have your own custom KMs, you must either adjust your KMs to use new odiRef methods that return the GUID of the object.

    or re - upgrade their repositories to use 11 g compatibility mode.

    Thank you

    ASP.

    Please close the message it useful or response.

  • The user should not have Edit access in EA

    Hello gurus,

    My requirement is: I or my team mates are not supposed to have access in the EA had to make a change to the applications / databases on an Essbase server. that is, I should only be able to see the map, see statistics, see if the sessions running etc. I wouldn't be able to copy the application, create the application, remove application, change contours etc..

    Please let me know if there is a way to do it.

    Thank you

    Read access to the database should be enough.

  • How to find the address is not valid even if Google returns geocoding?

    Hey, guys:

    I use Oracle APEX to get Google geocoding, but some addresses are actually disabled, Google returns always an alternative geocoding, probably the center of the city. Is it possible that I might know that it is in fact an invalid address, so I can avoid using these inaccurate geocoding? For example, the address is incorrect, then how do I find is invalid n address same Google map service returns a geocode?
                   declare
                
                     l_address varchar2(4000);
                     l_url varchar2(32000);
                     l_response varchar2(3200);
                
                     BEGIN
                        /* TODO implementation required */
                   
                        l_address:=APEX_UTIL.URL_ENCODE('Rt. 1 Box 97-5 Braggs Muskogee Oklahoma 74423');
                        dbms_output.put_line(l_address);
                        l_address := replace(l_address,' ','+');
                   
                        l_url := 'http://maps.google.com/maps/geo?q='||l_address||'&'||'output=csv';
                        l_response := utl_http.request(l_url, APEX_APPLICATION.G_PROXY_SERVER);
                        dbms_output.put_line(l_response);
                        l_response:=substr(l_response,instr(l_response,',',1,2)+1);
                   
                        dbms_output.put_line('In function: l_response ='||l_response);
        
      
      
                END;
        
    Published by: lxiscas on August 20, 2012 13:23

    Published by: lxiscas on August 20, 2012 13:23

    Published by: lxiscas on August 20, 2012 13:26

    Oh, and in the second place, when you look at the documentation of the api:

    >
    geometry contains the following information:

    location contains the geocoded latitude, longitude value. For normal address searches, this field is usually the most important.
    location_type stores extra data at the specified location. The following values are currently supported:

    On the 'ROOF' indicates that the returned result is a precise geocoding for which we have accurate location information until the accuracy of the address.
    'RANGE_INTERPOLATED' indicates that the returned result reflects an approximation (usually on a road) interpolated between two specific points (for example, intersections). Interpolated results are usually returned when the geocoded on the roof are not available for a street address.
    "GEOMETRIC_CENTER" indicates that the result returned is the geometric center of a result such as a polyline (for example, a street) or polygon (region).
    "APPROXIMATE" indicates that the result returned is approximate.
    display window contains the window recommended to display the result returned, specified as two latitude, values of longitude defining the Southwest and northeast of the viewport encompassing. The display window is generally used to frame a result when it displays to the user.
    limits (possibly returned) stores the bounding box that can fully contain the returned result. Note that these limits may not correspond to the recommended viewport. (For example, San Francisco includes the Farallon Islands, which are technically part of the city, but probably should not be returned in the display window.)
    partial_match indicates that the geocode not returned an exact match to the original application, although it was not part of the requested address. You can examine the original query for misspellings or incomplete address. Partial matches most often occur for addresses that do not exist in the locality that you pass in the query.

    I think you should examine the data returned by the API a bit, it should say that it is an approximate result in some cases.

    . Robin

  • Printing of multiple copies and the order should not be reunited

    Hello

    I have a requirement to print multiple copies (2) a pdf in report editor BI. And order print copies should not be reunited.

    Collating:
    Copy-1: Page 1, 2, 3
    2-copy: Page 1, 2, 3

    Do not collect: (I need the output in this format)
    Page 1, page 1
    Page 2, page 2
    Page 3 page 3

    How can we get multiple copies, and how we can control the order of output?

    Pointers would be most useful.

    Thanks in advance,
    Kind regards
    Mukthi

    Can you send me the files

  • I can not even open FF because the profile is not found, even after using the profile in order to create a new profile.

    I've recently upgraded to version 40 39.0.3. The first upgrade was not so I removed FF using the control panel (uninstall program). I reinstalled again, but I got the messages that FF was already running, etc. as other users have noticed. I open profiles (Open firefox.exe - p) and tried to open FF with the "default" profile that did not work. I created a new profile ("defaultuser") and FF open. (I have the box checked to use the new profile on startup). I have created FF as I wanted it, and then exit. When I started later FF, the profile is not found. The profile did not have the "defaultuser" profile, does not open with the "default" profile, but would a new profile must be created and FF to open and run. Quit FF and reopen produces the same sequence (profile not found, etc.) I uninstalled 40 and reinstalled version 39.0.3 and I have the same problems with this version (39.0.3), plus he's starting the upgrade to version 40, and soon as I complete the installation again. I uninstalled the 39.0.3/40 version and reinstalled 40 using the Profiles page to write this question.

    I removed the version FF 40 using the Panel of control/uninstall. I deleted all the files that have been "* firefox *" and "* mozilla * ' (and there are some). I rebooted, and then reinstalled FF version 39.0.3. I could we FF immediately (without having to create a new profile). I have not had any problems with a bad certificate of Google, Yahoo, etc.. I went to all the web sites open very well. I could restart, then restart FF several times without problems or issues of certificate. Meanwhile, I made no changes to Kaspersky, and as far as I know, Kaspersky works as he usually does. I am almost sure that FF 40 version has a certificate problem that I can't fix. I'm less sure if the original upgrade to version FF 39.0.3 to 40.0.0 (then 40.0.2) played a role in my profile questions. Regardless, I have a version of FF that works and auto-updated to FF is off (and it will remain like that until I gather a few of this blog and other insurance which emits 40 FF are ironed out). I appreciate the help that you (and jscher200 in another thread) has attempted to provide. While the issues are not fixed, the thread can be closed.

  • My antivirus found and removed a virus called Hijacker.DosPop_Toolbar, and now the Firfox browser not open, even to uninstall and reinstall?

    I have uninstalled version 8 and tried to revert to a previous version, but the browser still not open.

    Delete the program files for Firefox and install a freshly downloaded Firefox_setup file.

    http://www.Mozilla.com/en-us/Firefox/

  • How to make my confidence one ways c# windows application that should not blocked by antivirus Applications and how to get the third-party certificate for that?

    Hello

    I built a windows c# application that accesses OS, printer information using WMI query, monitor keyboard strokes overall Win32 API and calls others our executables too.

    Whenever I try to deploy it to computers to our customers, it is getting blocked by antivirus applications.

    If I want to make my request as being approved, we mean that it shouldn't be blocked by antivirus applications.

    How to get the certificate of trustee for my application? Even I am ready to make my request as registered product.

    Kindly let me know the procedures, solutions.

    Thank you

    Senthilkumar AK


    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.msdn.Microsoft.com/forums/en-us/home

  • the mouse does not work even if it's a brand new mouse

    Hey guys,.

    I'm running into a problem with my mouse.  It seems that even when it is plugged in, and my computer makes the sound indicating having recognized the usb device, and even when the mouse is everything is turned on, it still does not.  I even bought a new one, and that one doesn't work either.  I cannot use the touchpad.  I use a HP Envy dv7 notebook pc with windows 8.  Other stuff usb works fine, it's just these mice.

    Hello brentonoho.  I understand that you are having problems with your mouse.

    I want you to check and see how the computer detects the mouse after that you are connecting.  This would be better done by Device Manager.  Here are the steps.

    1. Go to your device manager.
    2. Expand the section 'mouse and other pointing devices '.
    3. If the mouse is listed here, double click on it and let me know if it is giving errors.

    Have a great day!  I'll keep an eye out for your answer.

  • error when the test server - user has reached the limit or the firewall is not blocking. Using Godaddy as a host

    Try to download files on godaddy by Dreamweaver CC 2015.2 - an FTP error occurred - cannot make connection to the host. Maximum number of users reached or not authorized to make the connection because of local firewall blocks FTP data.

    Have turned off windows firewall and other antivirus software. I'm not sure which limit the means reached.

    Help, please

    "Limit reached" means that the disk is full or you have reached the maximum of files you can store on your remote server. If necessary, you will need to remove some files before you can upload more.

  • What are the files should not be checked into Source code control?

    Good afternoon.

    11 of RoboHelp, integrated with Team Foundation Server and Visual Studio 2010 running.

    When two colleagues recently "received" the latest files from Source code control project, they also got the elements that have been removed or deleted. For example, I had deleted all the tags of conditional compilation of my project, but their version included always build tags. Finally, thanks in part to an old post from Peter Grainge, we realized that the PSS in Source code control contains a lot of this old information. We have removed the PSS and order check into Source control. Problem solved. No conditional build tags or unwanted Source unique Layouts, etc. (I think the PSS got archived by our release engineer when he was trying to solve another problem. There are two years it has been not been archived.)

    I vaguely remember something read somewhere once in checking is not some files in RoboHelp project in source control management. So far, I have not found such information in RoboHelp help or online.

    Anyone know where I can find a list of RoboHelp HTML project management files, such as the PSS file, which should never be checked into Source code control?

    Thank you very much.


    Carol Levine

    Watch excerpts on my site.

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • Why do disappear from the things on the page, can not see even when you type

    When I hoover on any part of a page, it disappears. When I type in this box all the characters disappear. Sometimes half of the web page is gone and then goes back disappear again when I have the top cleaner.

    If I run in safe mode it seems to work very well, but then I lose my bookmarks and labels. I haven't added new addons since before this problem started.

    It happens on all websites that I opened.

    Hello

    Try disabling graphics hardware acceleration. You will have to perhaps restart Firefox for it to take effect, so save any work first (e.g. you compose mail, documents online that you are editing, etc.).

    Then perform the following steps:

    1. Click the menu button

      and select Options

    2. In the window of Firefox Options (or preferences), click on the Advanced tab, and then select general.
    3. You will find in the list of parameters, the checkbox use hardware acceleration when available . Clear this check box.
    4. Now restart Firefox and see if the problems persist.

    In addition, please check the updates for your graphics driver by following the steps in the following knowledge base article:

    ---
    If she did not help, then probably one of your extensions is causing problems. You can follow some tips in this article to help understand that one.

    The problem occurred recently? It could be that an old extension does not play nice with an update of Firefox, or an extension recently update causes problems for some users.

    If your right click on your tab bar, you can bookmark all your open tabs in the window of a folder of bookmarks. Please see the article to see how you can save your bookmarks:

    When find you what is causing your problems, please let us know. This might help others with the same problem.

    Thank you.

Maybe you are looking for

  • 20 - c012a: pop ups

    Hi I was wondering if there is anyway I can stop hp "Welcome to your new hp" of poping up every time. I hit the done button and he disappears, but returned shortly after.  It is the image that I want to talk. Thank you bunch of Kate

  • Qosmio G50 change IDE to AHCI controller

    HelloI recently bought an SSDand the wand to increase its performance and the Firmware upgrade by changing the IDE SATA AHCI controllerHow can I change from AHCI? through the BIOS, I don't see any indication in the BIOSI read all disks to increase pe

  • Hey ~ I need help in Windows Media Player 12, remove album art!

    Hey ~ I need help in Windows Media Player 12, I got some song I want to add in the album art, but I had a song I add in a hard cover and I can't remove... so pls help

  • Local Q10 blackBerry sync of calendar and contacts, not business, not of wireless

    I'm just a user who doesn't want my calendar or contacts in everyone 'cloud.'  If I understand it right now, there is no synchronization local, wired or wireless, between his computer and his Q10.  Is this correct?  If so,. 1. when they finally made

  • Single computer home group. Unknown password

    I set up Hospitality Group on a Windows 7 computer, but did not join other computers. This computer has crashed and was replaced. The home group still exists, but I do not know the password. How can I remove that and start a new group of residential?