Codota Logo
CountingCompletionPolicy
Code IndexAdd Codota to your IDE (free)

How to use
CountingCompletionPolicy
in
org.springframework.batch.repeat.policy

Best Java code snippets using org.springframework.batch.repeat.policy.CountingCompletionPolicy (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-batch

@Override
protected int doUpdate(RepeatContext context) {
  super.doUpdate(context);
  count++;
  return 1;
}
origin: spring-projects/spring-batch

public void testFinishedResult() throws Exception {
  CountingCompletionPolicy policy = new CountingCompletionPolicy() {
    @Override
    protected int getCount(RepeatContext context) {
      return 1;
    }
  };
  policy.setMaxCount(10);
  RepeatContext context = policy.start(null);
  assertTrue(policy.isComplete(context, RepeatStatus.FINISHED));
}
origin: spring-projects/spring-batch

public void testDefaultBehaviourWithUpdate() throws Exception {
  CountingCompletionPolicy policy = new CountingCompletionPolicy() {
    int count = 0;
    @Override
    protected int getCount(RepeatContext context) {
      return count;
    }
    @Override
    protected int doUpdate(RepeatContext context) {
      count++;
      return 1;
    }
  };
  policy.setMaxCount(2);
  RepeatContext context = policy.start(null);
  policy.update(context);
  assertFalse(policy.isComplete(context));
  policy.update(context);
  assertTrue(policy.isComplete(context));
}
origin: spring-projects/spring-batch

public void testDefaultBehaviour() throws Exception {
  CountingCompletionPolicy policy = new CountingCompletionPolicy() {
    @Override
    protected int getCount(RepeatContext context) {
      return 1;
    }
  };
  RepeatContext context = policy.start(null);
  assertTrue(policy.isComplete(context));
}
origin: spring-projects/spring-batch

  @Override
  public RepeatContext start(RepeatContext context) {
    count = 0;
    return super.start(context);
  }
};
origin: spring-projects/spring-batch

policy.setMaxCount(2);
policy.setUseParent(true);
RepeatContextSupport session = new RepeatContextSupport(null);
RepeatContext context = policy.start(session);
policy.update(context);
assertFalse(policy.isComplete(context));
context = policy.start(session);
policy.update(context);
assertTrue(policy.isComplete(context));
origin: spring-projects/spring-batch

  @Override
  public RepeatContext start(RepeatContext context) {
    count = 0;
    return super.start(context);
  }
};
origin: spring-projects/spring-batch

public void testUpdateNotSavedAcrossSession() throws Exception {
  CountingCompletionPolicy policy = new CountingCompletionPolicy() {
    int count = 0;
    @Override
    protected int getCount(RepeatContext context) {
      return count;
    }
    @Override
    protected int doUpdate(RepeatContext context) {
      super.doUpdate(context);
      count++;
      return 1;
    }
    @Override
    public RepeatContext start(RepeatContext context) {
      count = 0;
      return super.start(context);
    }
  };
  policy.setMaxCount(2);
  RepeatContextSupport session = new RepeatContextSupport(null);
  RepeatContext context = policy.start(session);
  policy.update(context);
  assertFalse(policy.isComplete(context));
  context = policy.start(session);
  policy.update(context);
  assertFalse(policy.isComplete(context));
}
origin: spring-projects/spring-batch

@Override
protected int doUpdate(RepeatContext context) {
  super.doUpdate(context);
  count++;
  return 1;
}
origin: spring-projects/spring-batch

public void testNullResult() throws Exception {
  CountingCompletionPolicy policy = new CountingCompletionPolicy() {
    @Override
    protected int getCount(RepeatContext context) {
      return 1;
    }
  };
  policy.setMaxCount(10);
  RepeatContext context = policy.start(null);
  assertTrue(policy.isComplete(context, null));
}
origin: spring-projects/spring-batch

@Override
final public void update(RepeatContext context) {
  super.update(context);
  int delta = doUpdate(context);
  ((CountingBatchContext) context).getCounter().increment(delta);
}
origin: apache/servicemix-bundles

@Override
final public void update(RepeatContext context) {
  super.update(context);
  int delta = doUpdate(context);
  ((CountingBatchContext) context).getCounter().increment(delta);
}
org.springframework.batch.repeat.policyCountingCompletionPolicy

Javadoc

Abstract base class for policies that need to count the number of occurrences of some event (e.g. an exception type in the context), and terminate based on a limit for the counter. The value of the counter can be stored between batches in a nested context, so that the termination decision is based on the aggregate of a number of sibling batches.

Most used methods

  • doUpdate
    Extension point for subclasses. Inspect the context and update the state of a counter in whatever wa
  • isComplete
  • setMaxCount
    Setter for maximum value of count before termination.
  • setUseParent
    Flag to indicate whether the count is at the level of the parent context, or just local to the conte
  • start
  • update

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getContentResolver (Context)
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now