本文整理汇总了Java中org.apache.cassandra.utils.FBUtilities.isWindows方法的典型用法代码示例。如果您正苦于以下问题:Java FBUtilities.isWindows方法的具体用法?Java FBUtilities.isWindows怎么用?Java FBUtilities.isWindows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.utils.FBUtilities
的用法示例。
在下文中一共展示了FBUtilities.isWindows方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forceRepairAsync
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public int forceRepairAsync(String keyspace, RepairParallelism parallelismDegree, Collection<String> dataCenters, Collection<String> hosts, Collection<Range<Token>> ranges, boolean fullRepair, String... columnFamilies)
{
if (ranges.isEmpty() || Keyspace.open(keyspace).getReplicationStrategy().getReplicationFactor() < 2)
return 0;
int cmd = nextRepairCommand.incrementAndGet();
if (ranges.size() > 0)
{
if (FBUtilities.isWindows() && parallelismDegree != RepairParallelism.PARALLEL)
{
logger.warn("Snapshot-based repair is not yet supported on Windows. Reverting to parallel repair.");
parallelismDegree = RepairParallelism.PARALLEL;
}
new Thread(createRepairTask(cmd, keyspace, ranges, parallelismDegree, dataCenters, hosts, fullRepair, columnFamilies)).start();
}
return cmd;
}
示例2: RepairOption
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public RepairOption(RepairParallelism parallelism, boolean primaryRange, boolean incremental, boolean trace, int jobThreads, Collection<Range<Token>> ranges, boolean isSubrangeRepair)
{
if (FBUtilities.isWindows() &&
(DatabaseDescriptor.getDiskAccessMode() != Config.DiskAccessMode.standard || DatabaseDescriptor.getIndexAccessMode() != Config.DiskAccessMode.standard) &&
parallelism == RepairParallelism.SEQUENTIAL)
{
logger.warn("Sequential repair disabled when memory-mapped I/O is configured on Windows. Reverting to parallel.");
this.parallelism = RepairParallelism.PARALLEL;
}
else
this.parallelism = parallelism;
this.primaryRange = primaryRange;
this.incremental = incremental;
this.trace = trace;
this.jobThreads = jobThreads;
this.ranges.addAll(ranges);
this.isSubrangeRepair = isSubrangeRepair;
}
示例3: clearSnapshot
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public static void clearSnapshot(String snapshotName, List<File> snapshotDirectories)
{
// If snapshotName is empty or null, we will delete the entire snapshot directory
String tag = snapshotName == null ? "" : snapshotName;
for (File dir : snapshotDirectories)
{
File snapshotDir = new File(dir, join(SNAPSHOT_SUBDIR, tag));
if (snapshotDir.exists())
{
logger.trace("Removing snapshot directory {}", snapshotDir);
try
{
FileUtils.deleteRecursive(snapshotDir);
}
catch (FSWriteError e)
{
if (FBUtilities.isWindows())
SnapshotDeletingTask.addFailedSnapshot(snapshotDir);
else
throw e;
}
}
}
}
示例4: defineSchema
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
@BeforeClass
public static void defineSchema() throws ConfigurationException
{
if (FBUtilities.isWindows())
{
standardMode = DatabaseDescriptor.getDiskAccessMode();
indexMode = DatabaseDescriptor.getIndexAccessMode();
DatabaseDescriptor.setDiskAccessMode(Config.DiskAccessMode.standard);
DatabaseDescriptor.setIndexAccessMode(Config.DiskAccessMode.standard);
}
SchemaLoader.prepareServer();
SchemaLoader.createKeyspace(KEYSPACE,
KeyspaceParams.simple(1),
SchemaLoader.standardCFMD(KEYSPACE, CF),
SchemaLoader.standardCFMD(KEYSPACE, CF_SMALL_MAX_VALUE));
maxValueSize = DatabaseDescriptor.getMaxValueSize();
DatabaseDescriptor.setMaxValueSize(1024 * 1024); // set max value size to 1MB
}
示例5: rewriteSSTableMetadata
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
String filePath = descriptor.tmpFilenameFor(Component.STATS);
try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
{
serialize(currentComponents, out, descriptor.version);
out.flush();
}
// we cant move a file on top of another file in windows:
if (FBUtilities.isWindows)
FileUtils.delete(descriptor.filenameFor(Component.STATS));
FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));
}
示例6: rewriteSSTableMetadata
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
Descriptor tmpDescriptor = descriptor.asType(Descriptor.Type.TEMP);
try (DataOutputStreamAndChannel out = new DataOutputStreamAndChannel(new FileOutputStream(tmpDescriptor.filenameFor(Component.STATS))))
{
serialize(currentComponents, out);
out.flush();
}
// we cant move a file on top of another file in windows:
if (FBUtilities.isWindows())
FileUtils.delete(descriptor.filenameFor(Component.STATS));
FileUtils.renameWithConfirm(tmpDescriptor.filenameFor(Component.STATS), descriptor.filenameFor(Component.STATS));
}
示例7: rewriteSSTableMetadata
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
String filePath = descriptor.tmpFilenameFor(Component.STATS);
try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
{
serialize(currentComponents, out, descriptor.version);
out.flush();
}
// we cant move a file on top of another file in windows:
if (FBUtilities.isWindows())
FileUtils.delete(descriptor.filenameFor(Component.STATS));
FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));
}
示例8: assertDeletedOrDeferred
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
private void assertDeletedOrDeferred(int expectedCount)
{
if (FBUtilities.isWindows())
assertEquals(expectedCount, getDeferredDeletionCount());
else
assertTrue(getSystemSnapshotFiles().isEmpty());
}
示例9: getSSTablePreempiveOpenIntervalInMB
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public static int getSSTablePreempiveOpenIntervalInMB()
{
return FBUtilities.isWindows ? -1 : conf.sstable_preemptive_open_interval_in_mb;
}
示例10: getSSTablePreempiveOpenIntervalInMB
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
public static int getSSTablePreempiveOpenIntervalInMB()
{
return FBUtilities.isWindows() ? -1 : conf.sstable_preemptive_open_interval_in_mb;
}
示例11: testParseOptions
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
@Test
public void testParseOptions()
{
IPartitioner partitioner = Murmur3Partitioner.instance;
Token.TokenFactory tokenFactory = partitioner.getTokenFactory();
// parse with empty options
RepairOption option = RepairOption.parse(new HashMap<String, String>(), partitioner);
if (FBUtilities.isWindows() && (DatabaseDescriptor.getDiskAccessMode() != Config.DiskAccessMode.standard || DatabaseDescriptor.getIndexAccessMode() != Config.DiskAccessMode.standard))
assertTrue(option.getParallelism() == RepairParallelism.PARALLEL);
else
assertTrue(option.getParallelism() == RepairParallelism.SEQUENTIAL);
assertFalse(option.isPrimaryRange());
assertFalse(option.isIncremental());
// parse everything
Map<String, String> options = new HashMap<>();
options.put(RepairOption.PARALLELISM_KEY, "parallel");
options.put(RepairOption.PRIMARY_RANGE_KEY, "false");
options.put(RepairOption.INCREMENTAL_KEY, "false");
options.put(RepairOption.RANGES_KEY, "0:10,11:20,21:30");
options.put(RepairOption.COLUMNFAMILIES_KEY, "cf1,cf2,cf3");
options.put(RepairOption.DATACENTERS_KEY, "dc1,dc2,dc3");
options.put(RepairOption.HOSTS_KEY, "127.0.0.1,127.0.0.2,127.0.0.3");
option = RepairOption.parse(options, partitioner);
assertTrue(option.getParallelism() == RepairParallelism.PARALLEL);
assertFalse(option.isPrimaryRange());
assertFalse(option.isIncremental());
Set<Range<Token>> expectedRanges = new HashSet<>(3);
expectedRanges.add(new Range<>(tokenFactory.fromString("0"), tokenFactory.fromString("10")));
expectedRanges.add(new Range<>(tokenFactory.fromString("11"), tokenFactory.fromString("20")));
expectedRanges.add(new Range<>(tokenFactory.fromString("21"), tokenFactory.fromString("30")));
assertEquals(expectedRanges, option.getRanges());
Set<String> expectedCFs = new HashSet<>(3);
expectedCFs.add("cf1");
expectedCFs.add("cf2");
expectedCFs.add("cf3");
assertEquals(expectedCFs, option.getColumnFamilies());
Set<String> expectedDCs = new HashSet<>(3);
expectedDCs.add("dc1");
expectedDCs.add("dc2");
expectedDCs.add("dc3");
assertEquals(expectedDCs, option.getDataCenters());
Set<String> expectedHosts = new HashSet<>(3);
expectedHosts.add("127.0.0.1");
expectedHosts.add("127.0.0.2");
expectedHosts.add("127.0.0.3");
assertEquals(expectedHosts, option.getHosts());
}
示例12: prepSnapshotTracker
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
@BeforeClass
public static void prepSnapshotTracker()
{
if (FBUtilities.isWindows())
WindowsFailedSnapshotTracker.deleteOldSnapshots();
}