use of alluxio.client.file.options.CreateFileOptions in project SSM by Intel-bigdata.
the class AlluxioStatesUpdateService method checkAndMarkRunning.
private FileOutStream checkAndMarkRunning(FileSystem fs) throws IOException {
AlluxioURI moverIdPath = new AlluxioURI(ALLUXIO_MOVER_ID_PATH);
try {
if (fs.exists(moverIdPath)) {
// Alluxio does not support append operation (ALLUXIO-25), here just delete it
fs.delete(moverIdPath, DeleteOptions.defaults().setRecursive(true));
}
CreateFileOptions options = CreateFileOptions.defaults().setWriteType(WriteType.MUST_CACHE);
FileOutStream fos = fs.createFile(moverIdPath, options);
fos.write(InetAddress.getLocalHost().getHostName().getBytes());
fos.flush();
return fos;
} catch (IOException | AlluxioException e) {
LOG.error("Unable to lock alluxio 'mover', please stop alluxio 'mover' first.");
throw new IOException(e.getMessage());
}
}
use of alluxio.client.file.options.CreateFileOptions in project SSM by Intel-bigdata.
the class TestAlluxioNamespaceFetcher method createFile.
private void createFile(String path) {
CreateFileOptions options = CreateFileOptions.defaults().setWriteType(WriteType.MUST_CACHE);
FileOutStream fos = null;
try {
fos = fs.createFile(new AlluxioURI(path), options);
fos.write(new byte[] { 1 });
} catch (IOException | AlluxioException e) {
e.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
Aggregations