try {
if (eventSemaphore.tryAcquire(occurrences, timeout, TimeUnit.MILLISECONDS)) {
log.debug("received '" + event + "' notification");
}
else {
throw new JbpmException("event '" + event + "' did not occur within " + timeout + " ms");
}
}
catch (InterruptedException e) {
throw new JbpmException("wait for event '" + event + "' was interrupted", e);
}
}