Search:

Type: Posts; User: Norm

Search: Search took 0.42 seconds.

  1. Replies
    10
    Views
    2,574

    [SOLVED] Re: Creating a Deadlock

    I didn't make a deadlock. The two threads ran to completion.
  2. Replies
    10
    Views
    2,574

    [SOLVED] Re: Creating a Deadlock

    The code creates two instances with the following statements:
    Runnable job1 = new DeadLockSample().new Job1();
    Runnable job2 = new DeadLockSample().new Job2();

    I didn't for me....
  3. Replies
    10
    Views
    2,574

    [SOLVED] Re: Creating a Deadlock

    Yes.
    The print out shows that there are two Foo objects, one for each thread. For synchronize to work, there must be one object that all methods use.

    For a quick and dirty test, make the foo...
  4. Replies
    10
    Views
    2,574

    [SOLVED] Re: Creating a Deadlock

    Are the threads locking on the same object?
    Add some debug code to print out the class objects addresses: this
    Add a constructor to Foo that prints out its this value.
Results 1 to 4 of 4