Skip to content
This repository has been archived by the owner on Apr 15, 2018. It is now read-only.

Fixes #58, unit tests fail on windows. #59

Merged
merged 1 commit into from Jan 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -639,6 +639,7 @@ public void close() {
*/
public void delete() {
try {
close();
Files.delete(file.toPath());
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
Expand Up @@ -112,11 +112,17 @@ public Bytes flush() {
return this;
}

@Override
public void close() {
((MappedMemory) memory).close();
}

/**
* Deletes the underlying file.
*/
public void delete() {
try {
close();
Files.delete(file.toPath());
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
Expand Up @@ -84,4 +84,9 @@ public void free() {
((MappedMemoryAllocator) allocator).release();
}

public void close() {
free();
((MappedMemoryAllocator) allocator).close();
}

}
Expand Up @@ -107,16 +107,20 @@ public MappedMemory reallocate(MappedMemory memory, long size) {
return newMemory;
}

public void close() {
try {
file.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}

/**
* Releases a reference from the allocator.
*/
void release() {
if (referenceCount.decrementAndGet() == 0) {
try {
file.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
close();
}
}

Expand Down