com.squareup.tape.QueueFile Java Examples
The following examples show how to use
com.squareup.tape.QueueFile.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileBlobStore.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
private void createEmptyDeletionsIndex(final File deletionsIndex) throws IOException { // copy a fresh index on top of existing index to avoid problems // with removing or renaming open files on Windows Path tempFile = Files.createTempFile(DELETIONS_FILENAME, "tmp"); Files.delete(tempFile); try { new QueueFile(tempFile.toFile()).close(); try (RandomAccessFile raf = new RandomAccessFile(deletionsIndex, "rw")) { raf.setLength(0); raf.write(Files.readAllBytes(tempFile)); } } finally { Files.deleteIfExists(tempFile); } }
Example #2
Source File: FileFragmentQueue.java From datacollector with Apache License 2.0 | 6 votes |
@Override public List<Stage.ConfigIssue> init(Stage.Context context) { List<Stage.ConfigIssue> issues = new ArrayList<>(); try { file = File.createTempFile("sdc-fragments", ".queueFile"); if (!getFile().delete()) { issues.add(context.createConfigIssue("", "", Errors.FRAGMENT_CACHE_WRITER_00, getFile().getAbsolutePath())); } queueFile = new QueueFile(getFile()); queueFileSize = new AtomicLong(0); } catch (IOException ex) { issues.add(context.createConfigIssue("", "", Errors.FRAGMENT_CACHE_WRITER_01, ex.toString())); } lostFragments = new AtomicInteger(0); return issues; }
Example #3
Source File: FileBlobStoreTest.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
private void checkDeletionsIndex(boolean expectEmpty) throws IOException { QueueFile queueFile = new QueueFile(underTest.getAbsoluteBlobDir().resolve("test-deletions.index").toFile()); assertThat(queueFile.isEmpty(), is(expectEmpty)); queueFile.close(); }
Example #4
Source File: FileFragmentQueue.java From datacollector with Apache License 2.0 | 4 votes |
private QueueFile getQueueFile() { return queueFile; }
Example #5
Source File: FileBufferPersistWriter.java From streams with Apache License 2.0 | 4 votes |
@Override public void prepare(Object configurationObject) { mapper = new ObjectMapper(); File file = new File( config.getBuffer() ); try { queueFile = new QueueFile(file); } catch (IOException ex) { ex.printStackTrace(); } Preconditions.checkArgument(file.exists()); Preconditions.checkArgument(file.canWrite()); Objects.requireNonNull(queueFile); this.persistQueue = new ConcurrentLinkedQueue<>(); }