congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
BatchingCallback.commit
Code IndexAdd Tabnine to your IDE (free)

How to use
commit
method
in
com.nesscomputing.callback.BatchingCallback

Best Java code snippets using com.nesscomputing.callback.BatchingCallback.commit (Showing top 5 results out of 315)

origin: com.nesscomputing.components/ness-core

/**
 * Alternate method of committing, for use with {@code try-with-resources}.
 */
@Override
public void close()
{
  commit();
}
origin: com.nesscomputing.components/ness-core

@Override
public boolean commit()
{
  boolean result = super.commit();
  ExecutorCallback.class.cast(getOut()).close();
  return result;
}
origin: com.nesscomputing.components/ness-core

@Test
public void testBatchingCallback() throws Exception
{
  CallbackCollector<List<String>> collector = new CallbackCollector<>();
  try (BatchingCallback<String> batcher = BatchingCallback.batchInto(2, collector)) {
    batcher.call("a");
    batcher.call("b");
    batcher.call("c");
    batcher.commit();
    batcher.call("d");
    batcher.call("e");
    batcher.call("f");
  }
  assertEquals(of(
      of("a", "b"),
      of("c"),
      of("d", "e"),
      of("f")
    ), collector.getItems());
}
origin: com.nesscomputing.components/ness-core

@Test
public void testGood() throws Exception
{
  ExecutorService executor = MoreExecutors.sameThreadExecutor();
  CallbackCollector<List<String>> out = new CallbackCollector<>();
  BatchingCallback<String> batcher = BatchingCallback.batchInto(2, executor, out, false);
  batcher.call("a");
  batcher.call("b");
  batcher.call("c");
  batcher.call("d");
  batcher.call("e");
  batcher.commit();
  assertEquals(of(of("a", "b"), of("c", "d"), of("e")), out.getItems());
}
origin: com.nesscomputing.components/ness-core

  batcher.commit();
  fail();
} catch (BatchingCallbackExecutionException bcee) {
com.nesscomputing.callbackBatchingCallbackcommit

Javadoc

Explicitly flush the buffer, even if it is not full.

Popular methods of BatchingCallback

  • <init>
  • batchInto
    Collect into a buffer, and schedule the given callback with the given executor whenever the buffer i
  • call
    Add an item to the buffer. May cause a commit if the buffer is full.
  • close
    Alternate method of committing, for use with try-with-resources.
  • commitInternal

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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