本文整理汇总了Java中org.apache.cassandra.utils.CLibrary类的典型用法代码示例。如果您正苦于以下问题:Java CLibrary类的具体用法?Java CLibrary怎么用?Java CLibrary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CLibrary类属于org.apache.cassandra.utils包,在下文中一共展示了CLibrary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: syncInternal
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
protected void syncInternal()
{
if (syncNeeded)
{
flushInternal();
syncDataOnlyInternal();
if (!directorySynced)
{
CLibrary.trySync(directoryFD);
directorySynced = true;
}
syncNeeded = false;
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:SequentialWriter.java示例2: close
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
@Override
public void close()
{
if (buffer == null)
return; // already closed
syncInternal();
buffer = null;
if (skipIOCache && bytesSinceCacheFlush > 0)
CLibrary.trySkipCache(fd, 0, 0);
try
{
out.close();
}
catch (IOException e)
{
throw new FSWriteError(e, getPath());
}
FileUtils.closeQuietly(metadata);
CLibrary.tryCloseFD(directoryFD);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:26,代码来源:SequentialWriter.java示例3: write
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
@Override
void write(int startMarker, int nextMarker)
{
// if there's room in the discard section to write an empty header,
// zero out the next sync marker so replayer can cleanly exit
if (nextMarker <= buffer.capacity() - SYNC_MARKER_SIZE)
{
buffer.putInt(nextMarker, 0);
buffer.putInt(nextMarker + 4, 0);
}
// write previous sync marker to point to next sync marker
// we don't chain the crcs here to ensure this method is idempotent if it fails
writeSyncMarker(buffer, startMarker, startMarker, nextMarker);
try {
SyncUtil.force((MappedByteBuffer) buffer);
}
catch (Exception e) // MappedByteBuffer.force() does not declare IOException but can actually throw it
{
throw new FSWriteError(e, getPath());
}
CLibrary.trySkipCache(fd, startMarker, nextMarker, logFile.getAbsolutePath());
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:MemoryMappedSegment.java示例4: CommitLogSegment
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
/**
* Constructs a new segment file.
*
* @param filePath if not null, recycles the existing file by renaming it and truncating it to CommitLog.SEGMENT_SIZE.
*/
CommitLogSegment(CommitLog commitLog)
{
this.commitLog = commitLog;
id = getNextId();
descriptor = new CommitLogDescriptor(id, commitLog.configuration.getCompressorClass());
logFile = new File(commitLog.location, descriptor.fileName());
try
{
channel = FileChannel.open(logFile.toPath(), StandardOpenOption.WRITE, StandardOpenOption.READ, StandardOpenOption.CREATE);
fd = CLibrary.getfd(channel);
}
catch (IOException e)
{
throw new FSWriteError(e, logFile);
}
buffer = createBuffer(commitLog);
// write the header
CommitLogDescriptor.writeHeader(buffer, descriptor);
endOfBuffer = buffer.capacity();
lastSyncedOffset = buffer.position();
allocatePosition.set(lastSyncedOffset + SYNC_MARKER_SIZE);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:30,代码来源:CommitLogSegment.java示例5: close
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
@Override
public void close()
{
if (buffer == null)
return; // already closed
syncInternal();
buffer = null;
try
{
out.close();
}
catch (IOException e)
{
throw new FSWriteError(e, getPath());
}
CLibrary.tryCloseFD(directoryFD);
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:22,代码来源:SequentialWriter.java示例6: createHardLink
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
public static void createHardLink(File from, File to)
{
if (to.exists())
throw new RuntimeException("Tried to create duplicate hard link to " + to);
if (!from.exists())
throw new RuntimeException("Tried to hard link to file that does not exist " + from);
try
{
CLibrary.createHardLink(from, to);
}
catch (IOException e)
{
throw new FSWriteError(e, to);
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:17,代码来源:FileUtils.java示例7: deallocate
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
public void deallocate()
{
buffer = null; // makes sure we don't use this after it's ostensibly closed
if (skipIOCache && bytesSinceCacheFlush > 0)
CLibrary.trySkipCache(fd, 0, 0);
try
{
super.close();
}
catch (IOException e)
{
throw new FSReadError(e, filePath);
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:17,代码来源:RandomAccessReader.java示例8: close
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
@Override
public void close()
{
if (buffer == null)
return; // already closed
syncInternal();
buffer = null;
if (skipIOCache && bytesSinceCacheFlush > 0)
CLibrary.trySkipCache(fd, 0, 0);
try
{
out.close();
}
catch (IOException e)
{
throw new FSWriteError(e, getPath());
}
CLibrary.tryCloseFD(directoryFD);
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:25,代码来源:SequentialWriter.java示例9: preheat
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
public void preheat(Map<DecoratedKey, RowIndexEntry> cachedKeys) throws IOException
{
RandomAccessFile f = new RandomAccessFile(getFilename(), "r");
try
{
int fd = CLibrary.getfd(f.getFD());
for (Map.Entry<DecoratedKey, RowIndexEntry> entry : cachedKeys.entrySet())
{
cacheKey(entry.getKey(), entry.getValue());
// add to the cache but don't do actual preheating if we have it disabled in the config
if (DatabaseDescriptor.shouldPreheatPageCache() && fd > 0)
CLibrary.preheatPage(fd, entry.getValue().position);
}
}
finally
{
FileUtils.closeQuietly(f);
}
}
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:23,代码来源:SSTableReader.java示例10: BufferedRandomAccessFile
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
public BufferedRandomAccessFile(File file, String mode, int bufferSize, boolean skipCache) throws IOException
{
super(file, mode);
this.skipCache = skipCache;
channel = super.getChannel();
filePath = file.getAbsolutePath();
// allocating required size of the buffer
if (bufferSize <= 0)
throw new IllegalArgumentException("bufferSize must be positive");
buffer = new byte[bufferSize];
reBuffer();
// if in read-only mode, caching file size
fileLength = (mode.equals("r")) ? this.channel.size() : -1;
fd = CLibrary.getfd(this.getFD());
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:20,代码来源:BufferedRandomAccessFile.java示例11: sync
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
/**
* Flush (flush()) whatever writes are pending, and block until the data has been persistently committed (fsync()).
*/
public void sync() throws IOException
{
if (syncNeeded)
{
flush();
channel.force(true); // true, because file length counts as
// "meta-data"
if (skipCache)
{
// clear entire file from page cache
CLibrary.trySkipCache(this.fd, 0, 0);
minBufferOffset = Long.MAX_VALUE;
bytesSinceCacheFlush = 0;
}
syncNeeded = false;
}
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:25,代码来源:BufferedRandomAccessFile.java示例12: close
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
public void close()
{
if (directoryDescriptor >= 0)
{
CLibrary.tryCloseFD(directoryDescriptor);
directoryDescriptor = -1;
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:9,代码来源:LogReplica.java示例13: tidy
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
public void tidy()
{
lookup.remove(desc);
if (readMeterSyncFuture != null)
readMeterSyncFuture.cancel(true);
if (isCompacted.get())
SystemKeyspace.clearSSTableReadMeter(desc.ksname, desc.cfname, desc.generation);
// don't ideally want to dropPageCache for the file until all instances have been released
CLibrary.trySkipCache(desc.filenameFor(Component.DATA), 0, 0);
CLibrary.trySkipCache(desc.filenameFor(Component.PRIMARY_INDEX), 0, 0);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:SSTableReader.java示例14: SSTableRewriter
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
public SSTableRewriter(ColumnFamilyStore cfs, Set<SSTableReader> rewriting, long maxAge, boolean isOffline)
{
this.rewriting = rewriting;
for (SSTableReader sstable : rewriting)
{
originalStarts.put(sstable.descriptor, sstable.first);
fileDescriptors.put(sstable.descriptor, CLibrary.getfd(sstable.getFilename()));
}
this.dataTracker = cfs.getDataTracker();
this.cfs = cfs;
this.maxAge = maxAge;
this.isOffline = isOffline;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:SSTableRewriter.java示例15: flushInternal
import org.apache.cassandra.utils.CLibrary; //导入依赖的package包/类
protected void flushInternal()
{
if (isDirty)
{
flushData();
if (trickleFsync)
{
bytesSinceTrickleFsync += validBufferBytes;
if (bytesSinceTrickleFsync >= trickleFsyncByteInterval)
{
syncDataOnlyInternal();
bytesSinceTrickleFsync = 0;
}
}
if (skipIOCache)
{
// we don't know when the data reaches disk since we aren't
// calling flush
// so we continue to clear pages we don't need from the first
// offset we see
// periodically we update this starting offset
bytesSinceCacheFlush += validBufferBytes;
if (bytesSinceCacheFlush >= RandomAccessReader.CACHE_FLUSH_INTERVAL_IN_BYTES)
{
CLibrary.trySkipCache(this.fd, ioCacheStartOffset, 0);
ioCacheStartOffset = bufferOffset;
bytesSinceCacheFlush = 0;
}
}
// Remember that we wrote, so we don't write it again on next flush().
resetBuffer();
isDirty = false;
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:40,代码来源:SequentialWriter.java本文标签属性:
示例:示例英文
代码:代码转换器
java:java面试题
CLibrary:clibrary中文图书馆