Here is some code:

```
public class A {
  private volatile B b;

  public void methodC() {
    b.doSomething();
  }

  public void setB(B newB) {
    this.b = newB;
  }
}

```

'Thread 1' is executing b.doSomething() by executing methodC().

At the same time 'thread 2' set a new B object into 'b'.

My question is:

Could the object previously refereced by 'b' be garbage-collected although doSomething() method on it is still executing?