Search in sources :

Example 1 with FastOutputStream

use of org.apache.solr.common.util.FastOutputStream in project lucene-solr by apache.

the class CdcrTransactionLog method reopenOutputStream.

/**
   * Re-open the output stream of the tlog and position
   * the file pointer at the end of the file. It assumes
   * that the tlog is non-empty and that the tlog's header
   * has been already read.
   */
synchronized void reopenOutputStream() {
    try {
        if (debug) {
            log.debug("Re-opening tlog's output stream: " + this);
        }
        raf = new RandomAccessFile(this.tlogFile, "rw");
        channel = raf.getChannel();
        long start = raf.length();
        raf.seek(start);
        os = Channels.newOutputStream(channel);
        fos = new FastOutputStream(os, new byte[65536], 0);
        // reflect that we aren't starting at the beginning
        fos.setWritten(start);
    } catch (IOException e) {
        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
    }
}
Also used : FastOutputStream(org.apache.solr.common.util.FastOutputStream) RandomAccessFile(java.io.RandomAccessFile) IOException(java.io.IOException) SolrException(org.apache.solr.common.SolrException)

Aggregations

IOException (java.io.IOException)1 RandomAccessFile (java.io.RandomAccessFile)1 SolrException (org.apache.solr.common.SolrException)1 FastOutputStream (org.apache.solr.common.util.FastOutputStream)1