All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.lucene.store.XFSIndexOutput Maven / Gradle / Ivy

There is a newer version: 8.15.1
Show newest version
package org.apache.lucene.store;

import org.elasticsearch.common.RateLimiter;

import java.io.IOException;

/**
 */
class XFSIndexOutput extends FSDirectory.FSIndexOutput {

    private final RateLimiter rateLimiter;

    private final StoreRateLimiting.Listener rateListener;

    XFSIndexOutput(FSDirectory parent, String name, RateLimiter rateLimiter, StoreRateLimiting.Listener rateListener) throws IOException {
        super(parent, name);
        this.rateLimiter = rateLimiter;
        this.rateListener = rateListener;
    }

    @Override
    public void flushBuffer(byte[] b, int offset, int size) throws IOException {
        rateListener.onPause(rateLimiter.pause(size));
        super.flushBuffer(b, offset, size);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy