Synchronizing access to an inner object's methods?
<p>Suppose I have the following:</p>

<pre><code>public class Foo {
    private ReadingList mReadingList = new ReadingList();

    public ReadingList getReadingList() {
        synchronized (mReadingList) {
            return mReadingList;
        }
    }
}
</code></pre>

<p>If I try modifying the ReadingList object in two threads, the synchronization above won't help me, right?:</p>

<pre><code>// Thread 1
foo1.getReadingList().setName("aaa");

// Thread 2
foo2.getReadingList().setName("bbb");
</code></pre>

<p>do I have to wrap each method I want synchronized like so:</p>

<pre><code>public class Foo {
    private ReadingList mReadingList = new ReadingList();

    public synchronized void setReadingListName(String name) {
        mReadingList.setName(name);
    }

    public synchronized void setReadingListAuthor(String author) {
        mReadingList.setAuthor(author);
    }

    ...
</code></pre>

<p>and so on for each method of ReadingList I want exposed and synched? I'd end up just writing wrapper methods for each method of ReadingList.</p>

<p>Thanks</p>
