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

How to use
UrisToWriterListener
in
com.marklogic.client.datamovement

Best Java code snippets using com.marklogic.client.datamovement.UrisToWriterListener (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: marklogic/java-client-api

@Test
public void testUrisToWriterListenerException() {
 final AtomicInteger failureBatchCount = new AtomicInteger();
 StringWriter badWriter = new StringWriter() {
  public void write(String str) {
   throw new InternalError(errorMessage);
  }
 };
 testListenerException(
  new UrisToWriterListener(badWriter)
   .onBatchFailure( (batch, throwable) -> failureBatchCount.incrementAndGet() )
 );
 // there should be one failure sent to the UrisToWriterListener
 // onBatchFailure listener since the writer is invalid
 assertEquals(1, failureBatchCount.get());
}
origin: marklogic/java-client-api

/**
 * This implementation of initializeListener adds this instance of
 * UrisToWriterListener to the two RetryListener's in this QueryBatcher so they
 * will retry any batches that fail during the uris request.
 */
@Override
public void initializeListener(QueryBatcher queryBatcher) {
 HostAvailabilityListener hostAvailabilityListener = HostAvailabilityListener.getInstance(queryBatcher);
 if ( hostAvailabilityListener != null ) {
  BatchFailureListener<QueryBatch> retryListener = hostAvailabilityListener.initializeRetryListener(this);
  if ( retryListener != null )  onFailure(retryListener);
 }
 NoResponseListener noResponseListener = NoResponseListener.getInstance(queryBatcher);
 if ( noResponseListener != null ) {
  BatchFailureListener<QueryBatch> noResponseRetryListener = noResponseListener.initializeRetryListener(this);
  if ( noResponseRetryListener != null )  onFailure(noResponseRetryListener);
 }
}
origin: marklogic/java-client-api

.withThreadCount(5)
.withBatchSize(100)
.onUrisReady( new UrisToWriterListener(writer) )
.onUrisReady(batch -> successDocs1.addAndGet(batch.getItems().length))
.onQueryFailure( throwable -> {
origin: marklogic/java-client-api

QueryBatcher getUris = dataMovementManager.newQueryBatcher(query)
 .withBatchSize(5000)
 .onUrisReady( new UrisToWriterListener(writer) )
 .onQueryFailure(exception -> exception.printStackTrace());
JobTicket getUrisTicket = dataMovementManager.startJob(getUris);
com.marklogic.client.datamovementUrisToWriterListener

Javadoc

Facilitates writing uris to a file when necessary because setting merge timestamp and QueryBatcher#withConsistentSnapshot is not an option, but you need to run DeleteListener or ApplyTransformListener.

Example writing uris to disk then running a delete:
 
FileWriter writer = new FileWriter("uriCache.txt");

As with all the provided listeners, this listener will not meet the needs of all applications but the source code for it should serve as helpful sample code so you can write your own custom listeners.

Most used methods

  • <init>
  • onBatchFailure
    When a batch fails or a callback throws an Exception, run this listener code. Multiple listeners can
  • onFailure
    When a batch fails or a callback throws an Exception, run this listener code. Multiple listeners can

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Reference (javax.naming)
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