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

How to use
ResilientFileOutputStream
in
ch.qos.logback.core.recovery

Best Java code snippets using ch.qos.logback.core.recovery.ResilientFileOutputStream (Showing top 19 results out of 315)

origin: camunda/camunda-bpm-platform

private void safeWrite(E event) throws IOException {
 ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
 FileChannel fileChannel = resilientFOS.getChannel();
 if (fileChannel == null) {
  return;
 }
 FileLock fileLock = null;
 try {
  fileLock = fileChannel.lock();
  long position = fileChannel.position();
  long size = fileChannel.size();
  if (size != position) {
   fileChannel.position(size);
  }
  super.writeOut(event);
 } finally {
  if (fileLock != null) {
   fileLock.release();
  }
 }
}
origin: camunda/camunda-bpm-platform

 ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(
   file, append);
 resilientFos.setContext(context);
 setOutputStream(resilientFos);
} finally {
origin: stackoverflow.com

 public class MyFileAppender<E> extends FileAppender<E> {
  protected void writeOut(E event) throws IOException {
    super.writeOut(event);
    ResilientFileOutputStream resilientFos = (ResilientFileOutputStream) super.getOutputStream();
    resilientFos.flush();
    resilientFos.getChannel().force(true);
  }
}
origin: tony19/logback-android

@Test
public void verifyRecuperationAfterFailure() throws Exception {
 File file = new File(CoreTestConstants.OUTPUT_DIR_PREFIX+"resilient"+diff+".log");
 ResilientFileOutputStream rfos = new ResilientFileOutputStream(file, true, FileAppender.DEFAULT_BUFFER_SIZE);
 rfos.setContext(context);
 ResilientFileOutputStream spy = spy(rfos);
 spy.write("a".getBytes());
 spy.flush();
 spy.getChannel().close();
 spy.write("b".getBytes());
 spy.flush();
 Thread.sleep(RecoveryCoordinator.BACKOFF_COEFFICIENT_MIN+10);
 spy.write("c".getBytes());
 spy.flush();
 verify(spy).openNewOutputStream();
}
origin: tony19/logback-android

private void safeWrite(E event) throws IOException {
 ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
 FileChannel fileChannel = resilientFOS.getChannel();
 if (fileChannel == null) {
  return;
 }
 // Clear any current interrupt (see LOGBACK-875)
 boolean interrupted = Thread.interrupted();
 FileLock fileLock = null;
 try {
  fileLock = fileChannel.lock();
  long position = fileChannel.position();
  long size = fileChannel.size();
  if (size != position) {
   fileChannel.position(size);
  }
  super.writeOut(event);
 } catch (IOException e) {
  // Mainly to catch FileLockInterruptionExceptions (see LOGBACK-875)
  resilientFOS.postIOFailure(e);
 } finally {
  if (fileLock != null && fileLock.isValid()) {
   fileLock.release();
  }
  // Re-interrupt if we started in an interrupted state (see LOGBACK-875)
  if (interrupted) {
   Thread.currentThread().interrupt();
  }
 }
}
origin: Nextdoor/bender

private void safeWrite(E event) throws IOException {
  ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
  FileChannel fileChannel = resilientFOS.getChannel();
  if (fileChannel == null) {
    return;
  }
  // Clear any current interrupt (see LOGBACK-875)
  boolean interrupted = Thread.interrupted();
  FileLock fileLock = null;
  try {
    fileLock = fileChannel.lock();
    long position = fileChannel.position();
    long size = fileChannel.size();
    if (size != position) {
      fileChannel.position(size);
    }
    super.writeOut(event);
  } catch (IOException e) {
    // Mainly to catch FileLockInterruptionExceptions (see LOGBACK-875)
    resilientFOS.postIOFailure(e);
  } finally {
    if (fileLock != null && fileLock.isValid()) {
      fileLock.release();
    }
    // Re-interrupt if we started in an interrupted state (see LOGBACK-875)
    if (interrupted) {
      Thread.currentThread().interrupt();
    }
  }
}
origin: com.hynnet/logback-core

 ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(
   file, append);
 resilientFos.setContext(context);
 setOutputStream(resilientFos);
} finally {
origin: com.hynnet/logback-core

private void safeWrite(E event) throws IOException {
 ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
 FileChannel fileChannel = resilientFOS.getChannel();
 if (fileChannel == null) {
  return;
 } catch (IOException e) {
  resilientFOS.postIOFailure(e);
origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

private void safeWrite(E event) throws IOException {
 ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
 FileChannel fileChannel = resilientFOS.getChannel();
 if (fileChannel == null) {
  return;
 }
 FileLock fileLock = null;
 try {
  fileLock = fileChannel.lock();
  long position = fileChannel.position();
  long size = fileChannel.size();
  if (size != position) {
   fileChannel.position(size);
  }
  super.writeOut(event);
 } finally {
  if (fileLock != null) {
   fileLock.release();
  }
 }
}
origin: com.impetus.fabric/fabric-jdbc-driver-shaded

  ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(file, append, bufferSize.getSize());
  resilientFos.setContext(context);
  setOutputStream(resilientFos);
} finally {
origin: com.impetus.fabric/fabric-jdbc-driver-shaded

private void safeWrite(E event) throws IOException {
  ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
  FileChannel fileChannel = resilientFOS.getChannel();
  if (fileChannel == null) {
    return;
  }
  // Clear any current interrupt (see LOGBACK-875)
  boolean interrupted = Thread.interrupted();
  FileLock fileLock = null;
  try {
    fileLock = fileChannel.lock();
    long position = fileChannel.position();
    long size = fileChannel.size();
    if (size != position) {
      fileChannel.position(size);
    }
    super.writeOut(event);
  } catch (IOException e) {
    // Mainly to catch FileLockInterruptionExceptions (see LOGBACK-875)
    resilientFOS.postIOFailure(e);
  } finally {
    if (fileLock != null && fileLock.isValid()) {
      fileLock.release();
    }
    // Re-interrupt if we started in an interrupted state (see LOGBACK-875)
    if (interrupted) {
      Thread.currentThread().interrupt();
    }
  }
}
origin: ch.qos.logback/core

private void safeWrite(E event) throws IOException {
 ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
 FileChannel fileChannel = resilientFOS.getChannel();
 if (fileChannel == null) {
  return;
 }
 FileLock fileLock = null;
 try {
  fileLock = fileChannel.lock();
  long position = fileChannel.position();
  long size = fileChannel.size();
  if (size != position) {
   fileChannel.position(size);
  }
  super.writeOut(event);
 } finally {
  if (fileLock != null) {
   fileLock.release();
  }
 }
}
origin: Nextdoor/bender

  ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(file, append, bufferSize.getSize());
  resilientFos.setContext(context);
  setOutputStream(resilientFos);
} finally {
origin: io.virtdata/virtdata-lib-realer

private void safeWrite(E event) throws IOException {
  ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
  FileChannel fileChannel = resilientFOS.getChannel();
  if (fileChannel == null) {
    return;
  }
  // Clear any current interrupt (see LOGBACK-875)
  boolean interrupted = Thread.interrupted();
  FileLock fileLock = null;
  try {
    fileLock = fileChannel.lock();
    long position = fileChannel.position();
    long size = fileChannel.size();
    if (size != position) {
      fileChannel.position(size);
    }
    super.writeOut(event);
  } catch (IOException e) {
    // Mainly to catch FileLockInterruptionExceptions (see LOGBACK-875)
    resilientFOS.postIOFailure(e);
  } finally {
    if (fileLock != null && fileLock.isValid()) {
      fileLock.release();
    }
    // Re-interrupt if we started in an interrupted state (see LOGBACK-875)
    if (interrupted) {
      Thread.currentThread().interrupt();
    }
  }
}
origin: tony19/logback-android

 private void closeLogFileOnPurpose() throws IOException {
  ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) fa
   .getOutputStream();
  FileChannel fileChannel = resilientFOS.getChannel();
  fileChannel.close();
 }
}
origin: io.virtdata/virtdata-lib-realer

  ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(file, append, bufferSize.getSize());
  resilientFos.setContext(context);
  setOutputStream(resilientFos);
} finally {
origin: ch.qos.logback/core

ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(
  file, append);
resilientFos.setContext(context);
setOutputStream(resilientFos);
origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(
  file, append);
resilientFos.setContext(context);
setOutputStream(resilientFos);
origin: tony19/logback-android

ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(file, append, bufferSize.getSize());
resilientFos.setContext(context);
setOutputStream(resilientFos);
successful = true;
ch.qos.logback.core.recoveryResilientFileOutputStream

Most used methods

  • getChannel
  • <init>
  • setContext
  • postIOFailure
  • flush
  • getFile
  • openNewOutputStream
  • write

Popular in Java

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Permission (java.security)
    Legacy security code; do not use.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Top 17 PhpStorm Plugins
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