![JAR search and dependency download from the Maven repository](/logo.png)
net.java.truevfs.kernel.impl.LockOutputService Maven / Gradle / Ivy
/*
* Copyright © 2005 - 2021 Schlichtherle IT Services.
* All rights reserved. Use is subject to license terms.
*/
package net.java.truevfs.kernel.impl;
import edu.umd.cs.findbugs.annotations.DischargesObligation;
import net.java.truecommons.cio.*;
import net.java.truecommons.io.LockOutputStream;
import net.java.truecommons.io.LockSeekableChannel;
import javax.annotation.WillCloseWhenClosed;
import javax.annotation.concurrent.ThreadSafe;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.channels.SeekableByteChannel;
import java.util.Iterator;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* Decorates another output service to allow concurrent access which is synchronized by a
* {@link java.util.concurrent.locks.Lock}.
*
* @param the type of the entries in the decorated output service.
* @author Christian Schlichtherle
* @see LockInputService
*/
@ThreadSafe
class LockOutputService extends DecoratingOutputService implements LockAspect {
private final Lock lock = new ReentrantLock();
LockOutputService(@WillCloseWhenClosed OutputService output) {
super(output);
}
@Override
public Lock lock() {
return lock;
}
@DischargesObligation
@Override
public void close() throws IOException {
locked(new Op
© 2015 - 2025 Weber Informatics LLC | Privacy Policy