eu.stratosphere.nephele.io.channels.ChannelWithAccessInfo Maven / Gradle / Ivy
/***********************************************************************************************************************
* Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
**********************************************************************************************************************/
package eu.stratosphere.nephele.io.channels;
import java.nio.channels.FileChannel;
interface ChannelWithAccessInfo {
FileChannel getChannel();
FileChannel getAndIncrementReferences();
/**
* Increments the references to this channel. Returns true
, if successful, and false
,
* if the channel has been disposed in the meantime.
*
* @return True, if successful, false, if the channel has been disposed.
*/
boolean incrementReferences();
ChannelWithPosition reserveWriteSpaceAndIncrementReferences(int spaceToReserve);
/**
* Decrements the number of references to this channel. If the number of references is zero after the
* decrement, the channel is deleted.
*
* @return The number of references remaining after the decrement.
* @throws IllegalStateException
* Thrown, if the number of references is already zero or below.
*/
int decrementReferences();
/**
* Disposes the channel without further notice. Tries to close it (swallowing all exceptions) and tries
* to delete the file.
*/
void disposeSilently();
/**
* Updates the flag which indicates whether the underlying physical file shall be deleted when it is closed. Once
* the flag was updated to false
it cannot be set to true
again.
*
* @param deleteOnClose
* true
to indicate the file shall be deleted when closed, false
otherwise
*/
void updateDeleteOnCloseFlag(final boolean deleteOnClose);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy