public void signalAll() { for (SingleConsumerCondition condition : conditions) { condition.signal(); } } }
public void signalAll() { for (SingleConsumerCondition condition : conditions) { condition.signal(); } } }
@Override public void run() { condition.signal(); } };
@Override public void shutdown() { try { ProcessEngineImpl.EXT_TASK_CONDITIONS.removeConsumer(condition); } finally { isRunning = false; condition.signal(); } try { handlerThread.join(); } catch (InterruptedException e) { LOG.log(Level.WARNING, "Shutting down the handler thread failed: {0}", e); } }
protected void addRequest(FetchAndLockRequest request) { if (!queue.offer(request)) { AsyncResponse asyncResponse = request.getAsyncResponse(); errorTooManyRequests(asyncResponse); } condition.signal(); }
@Test public void shouldSignalConditionOnTaskCreate() { // when rule.getRuntimeService() .startProcessInstanceByKey("theProcess"); // then verify(condition, times(1)).signal(); }
@Test(timeout=10000) public void shouldNotBlockIfSignalAvailable() { SingleConsumerCondition condition = new SingleConsumerCondition(Thread.currentThread()); // given condition.signal(); // then condition.await(100000); }
@Test public void shouldSignalConditionOnTaskCreateMultipleTimes() { // when rule.getRuntimeService() .startProcessInstanceByKey("theProcess"); rule.getRuntimeService() .startProcessInstanceByKey("theProcess"); // then verify(condition, times(2)).signal(); }
@Test public void shouldSignalConditionOnUnlock() { // given rule.getRuntimeService() .startProcessInstanceByKey("theProcess"); reset(condition); // clear signal for create LockedExternalTask lockedTask = rule.getExternalTaskService().fetchAndLock(1, "theWorker") .topic("theTopic", 10000) .execute() .get(0); // when rule.getExternalTaskService().unlock(lockedTask.getId()); // then verify(condition, times(1)).signal(); }
public void signalAll() { for (SingleConsumerCondition condition : conditions) { condition.signal(); } } }
@Override public void shutdown() { try { ProcessEngineImpl.EXT_TASK_CONDITIONS.removeConsumer(condition); } finally { isRunning = false; condition.signal(); } }
@Override public void run() { condition.signal(); } };
protected void addRequest(FetchAndLockRequest request) { if (!queue.offer(request)) { AsyncResponse asyncResponse = request.getAsyncResponse(); errorTooManyRequests(asyncResponse); } condition.signal(); }
@Test public void shouldSignalConditionOnTaskCreate() { // when rule.getRuntimeService() .startProcessInstanceByKey("theProcess"); // then verify(condition, times(1)).signal(); }
@Test(timeout=10000) public void shouldNotBlockIfSignalAvailable() { SingleConsumerCondition condition = new SingleConsumerCondition(Thread.currentThread()); // given condition.signal(); // then condition.await(100000); }
@Test public void shouldSignalConditionOnTaskCreateMultipleTimes() { // when rule.getRuntimeService() .startProcessInstanceByKey("theProcess"); rule.getRuntimeService() .startProcessInstanceByKey("theProcess"); // then verify(condition, times(2)).signal(); }
@Test public void shouldSignalConditionOnUnlock() { // given rule.getRuntimeService() .startProcessInstanceByKey("theProcess"); reset(condition); // clear signal for create LockedExternalTask lockedTask = rule.getExternalTaskService().fetchAndLock(1, "theWorker") .topic("theTopic", 10000) .execute() .get(0); // when rule.getExternalTaskService().unlock(lockedTask.getId()); // then verify(condition, times(1)).signal(); }