throw new IllegalArgumentException("Timeout cannot be negative.");
}
// If there is a gate, wait on it; otherwise, return immediately.
// Grab a copy of the gate, since it is volatile.
ThreadGate gate = m_shutdownGate;
boolean open = false;
if (gate != null)
{
open = gate.await(timeout);
}
FrameworkEvent event;
if (open && (gate.getMessage() != null))
{
event = (FrameworkEvent) gate.getMessage();
}
else if (!open && (gate != null))
{
event = new FrameworkEvent(FrameworkEvent.WAIT_TIMEDOUT, this, null);
}