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

net.java.truevfs.comp.inst.InstrumentingBufferPool Maven / Gradle / Ivy

There is a newer version: 0.14.0
Show newest version
/*
 * Copyright (C) 2005-2015 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.truevfs.comp.inst;

import java.io.IOException;
import java.util.Objects;
import javax.annotation.concurrent.ThreadSafe;
import net.java.truecommons.cio.DecoratingIoBufferPool;
import net.java.truecommons.cio.IoBuffer;
import net.java.truecommons.cio.IoBufferPool;

/**
 * @param   the type of the mediator.
 * @author Christian Schlichtherle
 */
@ThreadSafe
public class InstrumentingBufferPool>
extends DecoratingIoBufferPool {

    protected final M mediator;

    public InstrumentingBufferPool(
            final M mediator,
            final IoBufferPool pool) {
        super(pool);
        this.mediator = Objects.requireNonNull(mediator);
    }

    @Override
    public IoBuffer allocate() throws IOException {
        return mediator.instrument(this, pool.allocate());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy