title: Why is client-side locking not generally recommended?
body: <p>Please explain the following statement about synchronized blocks from "Core Java" by Hortsmann, Cornell (9 ed., p.865): </p>
  
  <blockquote>
    <p>The get and set methods of the Vector class are synchronized, but that doesn't help us.<br>
    ...<br>
    However, we can hijack the lock:</p>
  
  <pre><code>public void transfer(Vector&lt;Double&gt; accounts, int from, int to, int amount)
  {
      synchronized (accounts)
      {
          accounts.set(from, accounts.get(from) - amount);
          accounts.set(to, accounts.get(to) + amount);
      }
      //...
  }
  </code></pre>
    
    <p>This approach works, but it is entirely dependent on the fact that the Vector class uses the intrinsic lock for all of its mutator methods. </p>
  </blockquote>
  
  <p>Why does the synchronization depend on the mentioned fact? If a Thread A 
  owns the lock on accounts, no other Thread can acquire the same lock. It does not depend on a lock which Vector uses for its mutator methods.</p>
  
  <p>The only possible explanation I was able to think of is the following one. Let Thread A owns lock on accounts. If Vector uses another lock for its set/get, then Thread A must acquire an additional lock to proceed through set/get, and this is impossible for some reason (can a Thread hold 2 different locks at the same time?). </p>
  
  <p>This explanation does not look plausible to me, but I don't have anything else. 
  What am I missing?</p>