本文整理汇总了Java中org.apache.cassandra.io.FSError类的典型用法代码示例。如果您正苦于以下问题:Java FSError类的具体用法?Java FSError怎么用?Java FSError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FSError类属于org.apache.cassandra.io包,在下文中一共展示了FSError类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: inspectThrowable
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
/**
* Certain Throwables and Exceptions represent "Die" conditions for the server.
* This recursively checks the input Throwable's cause hierarchy until null.
* @param t
* The Throwable to check for server-stop conditions
*/
public static void inspectThrowable(Throwable t)
{
boolean isUnstable = false;
if (t instanceof OutOfMemoryError)
{
isUnstable = true;
HeapUtils.generateHeapDump();
}
if (DatabaseDescriptor.getDiskFailurePolicy() == Config.DiskFailurePolicy.die)
if (t instanceof FSError || t instanceof CorruptSSTableException)
isUnstable = true;
// Check for file handle exhaustion
if (t instanceof FileNotFoundException || t instanceof SocketException)
if (t.getMessage().contains("Too many open files"))
isUnstable = true;
if (isUnstable)
killer.killCurrentJVM(t);
if (t.getCause() != null)
inspectThrowable(t.getCause());
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:31,代码来源:JVMStabilityInspector.java
示例2: inspectThrowable
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
/**
* Certain Throwables and Exceptions represent "Die" conditions for the server.
* @param t
* The Throwable to check for server-stop conditions
*/
public static void inspectThrowable(Throwable t)
{
boolean isUnstable = false;
if (t instanceof OutOfMemoryError)
isUnstable = true;
if (DatabaseDescriptor.getDiskFailurePolicy() == Config.DiskFailurePolicy.die)
if (t instanceof FSError || t instanceof CorruptSSTableException)
isUnstable = true;
// Check for file handle exhaustion
if (t instanceof FileNotFoundException || t instanceof SocketException)
if (t.getMessage().contains("Too many open files"))
isUnstable = true;
if (isUnstable)
killer.killCurrentJVM(t);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:JVMStabilityInspector.java
示例3: doVerb
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public void doVerb(MessageIn<Truncation> message, int id)
{
Truncation t = message.payload;
Tracing.trace("Applying truncation of {}.{}", t.keyspace, t.columnFamily);
try
{
ColumnFamilyStore cfs = Keyspace.open(t.keyspace).getColumnFamilyStore(t.columnFamily);
cfs.truncateBlocking();
}
catch (Exception e)
{
logger.error("Error in truncation", e);
respondError(t, message);
if (FSError.findNested(e) != null)
throw FSError.findNested(e);
}
Tracing.trace("Enqueuing response to truncate operation to {}", message.from);
TruncateResponse response = new TruncateResponse(t.keyspace, t.columnFamily, true);
logger.trace("{} applied. Enqueuing response to {}@{} ", new Object[]{ t, id, message.from });
MessagingService.instance().sendReply(response.createMessage(), id, message.from);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:TruncateVerbHandler.java
示例4: handleFSError
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public static void handleFSError(FSError e)
{
JVMStabilityInspector.inspectThrowable(e);
switch (DatabaseDescriptor.getDiskFailurePolicy())
{
case stop_paranoid:
case stop:
StorageService.instance.stopTransports();
break;
case best_effort:
// for both read and write errors mark the path as unwritable.
BlacklistedDirectories.maybeMarkUnwritable(e.path);
if (e instanceof FSReadError)
{
File directory = BlacklistedDirectories.maybeMarkUnreadable(e.path);
if (directory != null)
Keyspace.removeUnreadableSSTables(directory);
}
break;
case ignore:
// already logged, so left nothing to do
break;
default:
throw new IllegalStateException();
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:FileUtils.java
示例5: Directories
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
private Directories(String keyspacename, String cfname, String directoryName)
{
this.keyspacename = keyspacename;
this.cfname = cfname;
this.sstableDirectories = new File[dataFileLocations.length];
for (int i = 0; i < dataFileLocations.length; ++i)
sstableDirectories[i] = new File(dataFileLocations[i].location, join(keyspacename, directoryName));
if (!StorageService.instance.isClientMode())
{
for (File dir : sstableDirectories)
{
try
{
FileUtils.createDirectory(dir);
}
catch (FSError e)
{
// don't just let the default exception handler do this, we need the create loop to continue
logger.error("Failed to create {} directory", dir);
FileUtils.handleFSError(e);
}
}
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:26,代码来源:Directories.java
示例6: handleFSError
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public static void handleFSError(FSError e)
{
switch (DatabaseDescriptor.getDiskFailurePolicy())
{
case stop_paranoid:
case stop:
StorageService.instance.stopTransports();
break;
case best_effort:
// for both read and write errors mark the path as unwritable.
BlacklistedDirectories.maybeMarkUnwritable(e.path);
if (e instanceof FSReadError)
{
File directory = BlacklistedDirectories.maybeMarkUnreadable(e.path);
if (directory != null)
Keyspace.removeUnreadableSSTables(directory);
}
break;
case ignore:
// already logged, so left nothing to do
break;
default:
throw new IllegalStateException();
}
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:26,代码来源:FileUtils.java
示例7: doVerb
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public void doVerb(MessageIn<Truncation> message, String id)
{
Truncation t = message.payload;
Tracing.trace("Applying truncation of {}.{}", t.keyspace, t.columnFamily);
try
{
ColumnFamilyStore cfs = Table.open(t.keyspace).getColumnFamilyStore(t.columnFamily);
cfs.truncate().get();
}
catch (Exception e)
{
logger.error("Error in truncation", e);
respondError(t, message);
if (FSError.findNested(e) != null)
throw FSError.findNested(e);
}
MetadataLog.announce(t.keyspace + "." + t.columnFamily, Metadata.TruncateColumnFamily_Tag, t.client, "");
Tracing.trace("Enqueuing response to truncate operation to {}", message.from);
TruncateResponse response = new TruncateResponse(t.keyspace, t.columnFamily, true);
logger.trace("{} applied. Enqueuing response to {}@{} ", new Object[]{ t, id, message.from });
MessagingService.instance().sendReply(response.createMessage(), id, message.from);
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:27,代码来源:TruncateVerbHandler.java
示例8: Directories
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
private Directories(String tablename, String cfname, String directoryName)
{
this.tablename = tablename;
this.cfname = cfname;
this.sstableDirectories = new File[dataFileLocations.length];
for (int i = 0; i < dataFileLocations.length; ++i)
sstableDirectories[i] = new File(dataFileLocations[i].location, join(tablename, directoryName));
if (!StorageService.instance.isClientMode())
{
for (File dir : sstableDirectories)
{
try
{
FileUtils.createDirectory(dir);
}
catch (FSError e)
{
// don't just let the default exception handler do this, we need the create loop to continue
logger.error("Failed to create {} directory", dir);
FileUtils.handleFSError(e);
}
}
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:26,代码来源:Directories.java
示例9: doVerb
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public void doVerb(MessageIn<Truncation> message, String id)
{
Truncation t = message.payload;
Tracing.trace("Applying truncation of {}.{}", t.keyspace, t.columnFamily);
try
{
ColumnFamilyStore cfs = Table.open(t.keyspace).getColumnFamilyStore(t.columnFamily);
cfs.truncate().get();
}
catch (Exception e)
{
logger.error("Error in truncation", e);
respondError(t, message);
if (FSError.findNested(e) != null)
throw FSError.findNested(e);
}
Tracing.trace("Enqueuing response to truncate operation to {}", message.from);
TruncateResponse response = new TruncateResponse(t.keyspace, t.columnFamily, true);
logger.trace("{} applied. Enqueuing response to {}@{} ", new Object[]{ t, id, message.from });
MessagingService.instance().sendReply(response.createMessage(), id, message.from);
}
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:24,代码来源:TruncateVerbHandler.java
示例10: close
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public void close()
{
try
{
if (currentKey != null)
writeRow(currentKey, columnFamily);
writer.close();
}
catch (FSError e)
{
writer.abort();
throw e;
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:SSTableSimpleWriter.java
示例11: close
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public void close()
{
try
{
if (currentKey != null)
writeRow(currentKey, columnFamily);
writer.closeAndOpenReader();
}
catch (FSError e)
{
writer.abort();
throw e;
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:15,代码来源:SSTableSimpleWriter.java
示例12: handleFSError
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public static void handleFSError(FSError e)
{
switch (DatabaseDescriptor.getDiskFailurePolicy())
{
case stop:
if (StorageService.instance.isInitialized())
{
logger.error("Stopping gossiper");
StorageService.instance.stopGossiping();
}
if (StorageService.instance.isRPCServerRunning())
{
logger.error("Stopping RPC server");
StorageService.instance.stopRPCServer();
}
if (StorageService.instance.isNativeTransportRunning())
{
logger.error("Stopping native transport");
StorageService.instance.stopNativeTransport();
}
break;
case best_effort:
// for both read and write errors mark the path as unwritable.
BlacklistedDirectories.maybeMarkUnwritable(e.path);
if (e instanceof FSReadError)
{
File directory = BlacklistedDirectories.maybeMarkUnreadable(e.path);
if (directory != null)
Keyspace.removeUnreadableSSTables(directory);
}
break;
case ignore:
// already logged, so left nothing to do
break;
default:
throw new IllegalStateException();
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:41,代码来源:FileUtils.java
示例13: handleFSError
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
@Override
public void handleFSError(FSError e)
{
if (!StorageService.instance.isSetupCompleted())
handleStartupFSError(e);
JVMStabilityInspector.inspectThrowable(e);
switch (DatabaseDescriptor.getDiskFailurePolicy())
{
case stop_paranoid:
case stop:
StorageService.instance.stopTransports();
break;
case best_effort:
// for both read and write errors mark the path as unwritable.
BlacklistedDirectories.maybeMarkUnwritable(e.path);
if (e instanceof FSReadError)
{
File directory = BlacklistedDirectories.maybeMarkUnreadable(e.path);
if (directory != null)
Keyspace.removeUnreadableSSTables(directory);
}
break;
case ignore:
// already logged, so left nothing to do
break;
default:
throw new IllegalStateException();
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:31,代码来源:DefaultFSErrorHandler.java
示例14: handleFSError
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public static void handleFSError(FSError e)
{
switch (DatabaseDescriptor.getDiskFailurePolicy())
{
case stop:
if (StorageService.instance.isInitialized())
{
logger.error("Stopping gossiper");
StorageService.instance.stopGossiping();
}
if (StorageService.instance.isRPCServerRunning())
{
logger.error("Stopping RPC server");
StorageService.instance.stopRPCServer();
}
if (StorageService.instance.isNativeTransportRunning())
{
logger.error("Stopping native transport");
StorageService.instance.stopNativeTransport();
}
break;
case best_effort:
// for both read and write errors mark the path as unwritable.
BlacklistedDirectories.maybeMarkUnwritable(e.path);
if (e instanceof FSReadError)
{
File directory = BlacklistedDirectories.maybeMarkUnreadable(e.path);
if (directory != null)
Table.removeUnreadableSSTables(directory);
}
break;
case ignore:
// already logged, so left nothing to do
break;
default:
throw new IllegalStateException();
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:41,代码来源:FileUtils.java
示例15: handleFSError
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public static void handleFSError(FSError e)
{
fsErrorHandler.get().ifPresent(handler -> handler.handleFSError(e));
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:FileUtils.java
示例16: Directories
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
/**
* Create Directories of given ColumnFamily.
* SSTable directories are created under data_directories defined in cassandra.yaml if not exist at this time.
*
* @param metadata metadata of ColumnFamily
*/
public Directories(CFMetaData metadata)
{
this.metadata = metadata;
if (StorageService.instance.isClientMode())
{
dataPaths = null;
return;
}
String cfId = ByteBufferUtil.bytesToHex(ByteBufferUtil.bytes(metadata.cfId));
int idx = metadata.cfName.indexOf(SECONDARY_INDEX_NAME_SEPARATOR);
// secondary indicies go in the same directory as the base cf
String directoryName = idx > 0 ? metadata.cfName.substring(0, idx) + "-" + cfId : metadata.cfName + "-" + cfId;
this.dataPaths = new File[dataDirectories.length];
// If upgraded from version less than 2.1, use existing directories
for (int i = 0; i < dataDirectories.length; ++i)
{
// check if old SSTable directory exists
dataPaths[i] = new File(dataDirectories[i].location,
join(metadata.ksName,
idx > 0 ? metadata.cfName.substring(0, idx) : metadata.cfName));
}
boolean olderDirectoryExists = Iterables.any(Arrays.asList(dataPaths), new Predicate<File>()
{
public boolean apply(File file)
{
return file.exists();
}
});
if (!olderDirectoryExists)
{
// use 2.1-style path names
for (int i = 0; i < dataDirectories.length; ++i)
dataPaths[i] = new File(dataDirectories[i].location, join(metadata.ksName, directoryName));
}
for (File dir : dataPaths)
{
try
{
FileUtils.createDirectory(dir);
}
catch (FSError e)
{
// don't just let the default exception handler do this, we need the create loop to continue
logger.error("Failed to create {} directory", dir);
FileUtils.handleFSError(e);
}
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:58,代码来源:Directories.java
示例17: handleFSError
import org.apache.cassandra.io.FSError; //导入依赖的package包/类
public static void handleFSError(FSError e)
{
FSErrorHandler handler = fsErrorHandler.get();
if (handler != null)
handler.handleFSError(e);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:7,代码来源:FileUtils.java
注:本文中的org.apache.cassandra.io.FSError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论