Tabnine Logo
SingleConsumerCondition
Code IndexAdd Tabnine to your IDE (free)

How to use
SingleConsumerCondition
in
org.camunda.bpm.engine.impl.util

Best Java code snippets using org.camunda.bpm.engine.impl.util.SingleConsumerCondition (Showing top 20 results out of 315)

origin: camunda/camunda-bpm-platform

 public void signalAll() {
  for (SingleConsumerCondition condition : conditions) {
   condition.signal();
  }
 }
}
origin: camunda/camunda-bpm-platform

@Test(timeout=10000)
public void shouldNotBlockIfSignalAvailable() {
 SingleConsumerCondition condition = new SingleConsumerCondition(Thread.currentThread());
 // given
 condition.signal();
 // then
 condition.await(100000);
}
origin: camunda/camunda-bpm-platform

@Test(timeout=10000)
public void shouldNotBlockIfSignalAvailableDifferentThread() throws InterruptedException {
 final SingleConsumerCondition condition = new SingleConsumerCondition(Thread.currentThread());
 Thread consumer = new Thread() {
  @Override
  public void run() {
   condition.signal();
  }
 };
 consumer.start();
 consumer.join();
 // then
 condition.await(100000);
}
origin: camunda/camunda-bpm-platform

public FetchAndLockHandlerImpl() {
 this.condition = new SingleConsumerCondition(handlerThread);
}
origin: camunda/camunda-bpm-platform

protected void suspendAcquisition(long millis) {
 try {
  if (queue.isEmpty() && isRunning) {
   LOG.log(Level.FINEST, "Suspend acquisition for {0}ms", millis);
   condition.await(millis);
   LOG.log(Level.FINEST, "Acquisition woke up");
  }
 }
 finally {
  if (handlerThread.isInterrupted()) {
   Thread.currentThread().interrupt();
  }
 }
}
origin: camunda/camunda-bpm-platform

@Test
public void cannotAwaitFromDifferentThread() {
 // given
 SingleConsumerCondition condition = new SingleConsumerCondition(new Thread());
 // when then
 try {
  condition.await(0);
  Assert.fail("expected exception");
 }
 catch (RuntimeException e) {
  // expected
 }
}
origin: camunda/camunda-bpm-platform

@Test
public void cannotCreateWithNull() {
 try {
  new SingleConsumerCondition(null);
  Assert.fail("expected exception");
 }
 catch (IllegalArgumentException e) {
  // expected
 }
}
origin: org.camunda.bpm/camunda-engine-rest-jaxrs2

protected void suspendAcquisition(long millis) {
 try {
  if (queue.isEmpty() && isRunning) {
   LOG.log(Level.FINEST, "Suspend acquisition for {0}ms", millis);
   condition.await(millis);
   LOG.log(Level.FINEST, "Acquisition woke up", millis);
  }
 }
 finally {
  if (handlerThread.isInterrupted()) {
   Thread.currentThread().interrupt();
  }
 }
}
origin: camunda/camunda-bpm-platform

 public void signalAll() {
  for (SingleConsumerCondition condition : conditions) {
   condition.signal();
  }
 }
}
origin: org.camunda.bpm/camunda-engine

@Test(timeout=10000)
public void shouldNotBlockIfSignalAvailable() {
 SingleConsumerCondition condition = new SingleConsumerCondition(Thread.currentThread());
 // given
 condition.signal();
 // then
 condition.await(100000);
}
origin: org.camunda.bpm/camunda-engine

@Test(timeout=10000)
public void shouldNotBlockIfSignalAvailableDifferentThread() throws InterruptedException {
 final SingleConsumerCondition condition = new SingleConsumerCondition(Thread.currentThread());
 Thread consumer = new Thread() {
  @Override
  public void run() {
   condition.signal();
  }
 };
 consumer.start();
 consumer.join();
 // then
 condition.await(100000);
}
origin: org.camunda.bpm/camunda-engine-rest-jaxrs2

public FetchAndLockHandlerImpl() {
 this.condition = new SingleConsumerCondition(handlerThread);
}
origin: camunda/camunda-bpm-platform

 @Override
 public void run() {
  condition.signal();
 }
};
origin: org.camunda.bpm/camunda-engine

@Test
public void cannotAwaitFromDifferentThread() {
 // given
 SingleConsumerCondition condition = new SingleConsumerCondition(new Thread());
 // when then
 try {
  condition.await(0);
  Assert.fail("expected exception");
 }
 catch (RuntimeException e) {
  // expected
 }
}
origin: org.camunda.bpm/camunda-engine

@Test
public void cannotCreateWithNull() {
 try {
  new SingleConsumerCondition(null);
  Assert.fail("expected exception");
 }
 catch (IllegalArgumentException e) {
  // expected
 }
}
origin: camunda/camunda-bpm-platform

@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);
 }
}
origin: camunda/camunda-bpm-platform

protected void addRequest(FetchAndLockRequest request) {
 if (!queue.offer(request)) {
  AsyncResponse asyncResponse = request.getAsyncResponse();
  errorTooManyRequests(asyncResponse);
 }
 condition.signal();
}
origin: camunda/camunda-bpm-platform

@Test
public void shouldSignalConditionOnTaskCreate() {
 // when
 rule.getRuntimeService()
  .startProcessInstanceByKey("theProcess");
 // then
 verify(condition, times(1)).signal();
}
origin: camunda/camunda-bpm-platform

@Test
public void shouldSignalConditionOnTaskCreateMultipleTimes() {
 // when
 rule.getRuntimeService()
  .startProcessInstanceByKey("theProcess");
 rule.getRuntimeService()
  .startProcessInstanceByKey("theProcess");
 // then
 verify(condition, times(2)).signal();
}
origin: org.camunda.bpm/camunda-engine

 public void signalAll() {
  for (SingleConsumerCondition condition : conditions) {
   condition.signal();
  }
 }
}
org.camunda.bpm.engine.impl.utilSingleConsumerCondition

Javadoc

MPSC Condition implementation.

Implementation Notes:

  • #await(long) may spuriously return before the deadline is reached.
  • if #signal() is called before the consumer thread calls #await(long), the next call to #await(long) returns immediately.

Most used methods

  • signal
  • <init>
  • await

Popular in Java

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • setScale (BigDecimal)
  • getContentResolver (Context)
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Collectors (java.util.stream)
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now