Příklad
public
static
class
ClassA {
Condition c;
boolean
flag;
public
void
methodA {
if
(flag) {
try
{
c.await();
}
catch
( Exception e ) {
}
//...
}
}
}
Řešení
Umístěte await() do smyčky while.
public
static
class
ClassA {
Condition c;
boolean
flag;
public
void
methodA {
while
(flag) {
try
{
c.await();
}
catch
( Exception e ) {
}
//...
}
}
}