Przykład
public
static
class
ClassA {
Condition c;
boolean
flag;
public
void
methodA {
if
(flag) {
try
{
c.await();
}
catch
( Exception e ) {
}
//...
}
}
}
Rozwiązanie
Umieść wywołanie await() w pętli while.
public
static
class
ClassA {
Condition c;
boolean
flag;
public
void
methodA {
while
(flag) {
try
{
c.await();
}
catch
( Exception e ) {
}
//...
}
}
}