boolean[] r= new boolean[50];
int i= 0;
WeakBase aObj1= new WeakBase();
// WeakBase aObj2= new WeakBase();
WeakReference wr1= new WeakReference(aObj1);
WeakReference wr2= new WeakReference(wr1);
r[i++]= wr1.get() == aObj1;
r[i++]= wr2.get() == aObj1;
aObj1= null;
// Object obj= ref.get();
System.out.println("Wait 5 sec");
for(int c= 0; c < 50; c++)
{
try
{
Thread.currentThread().sleep(100);
System.gc();
System.runFinalization();
}catch (InterruptedException ie)
{
}
}
r[i++]= wr1.get() == null;
r[i++]= wr2.get() == null;
boolean bOk= true;
for (int c= 0; c < i; c++)
bOk= bOk && r[c];
if (bOk == false)