Skip to content

Commit

Permalink
Merge acf93c4 into bcc87ff
Browse files Browse the repository at this point in the history
  • Loading branch information
leerho committed Aug 16, 2021
2 parents bcc87ff + acf93c4 commit 6652f05
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public void checkMonitorDirectStats() throws Exception {
int bytes = 1024;
long curAllocations = BaseState.getCurrentDirectMemoryAllocations();
long curAllocated = BaseState.getCurrentDirectMemoryAllocated();
System.err.println(curAllocations + " should be zero!");
if (curAllocations != 0) { System.err.println(curAllocations + " should be zero!"); }
WritableHandle wh1 = WritableMemory.allocateDirect(bytes);
WritableHandle wh2 = WritableMemory.allocateDirect(bytes);
assertEquals(BaseState.getCurrentDirectMemoryAllocations(), 2L + curAllocations);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,19 @@ void putBooleanArray(boolean[] srcArray, int srcOffsetBooleans,

//OTHER WRITABLE API METHODS
/**
* For ByteBuffer and Direct Memory backed resources only. Heap and Map backed resources will return null.
* Gets the MemoryRequestServer object used by dynamic Memory-backed objects
* to request additional memory. To customize the actions of the MemoryRequestServer,
* extend the MemoryRequestServer interfact and
* set using {@link WritableMemory#allocateDirect(long, ByteOrder, MemoryRequestServer)}.
* If not explicity set, this returns the {@link DefaultMemoryRequestServer}.
* @return the MemoryRequestServer object (if direct memory) or null.
* WritableBuffer enables this for ByteBuffer backed resources. To enable for Heap and Direct Memory
* resources, use the WritableMemory to configure and then call asWritableBuffer().
* Map backed resources will always return null.
* Gets the MemoryRequestServer object, if set, for the above resources to request additional memory.
* The user must customize the actions of the MemoryRequestServer by
* extending the MemoryRequestServer interface and set using the following method:
* <ul>
* <li>{@link WritableMemory#writableWrap(ByteBuffer, ByteOrder, MemoryRequestServer)}</li>
* </ul>
* Simple implementation examples include the DefaultMemoryRequestServer in the main tree, as well as
* the ExampleMemoryRequestServerTest and the use with ByteBuffer documented in the DruidIssue11544Test
* in the test tree.
* @return the MemoryRequestServer object or null.
*/
public MemoryRequestServer getMemoryRequestServer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,18 @@ static WritableMemory writableWrap(double[] array) {

//OTHER WRITABLE API METHODS
/**
* For ByteBuffer and Direct Memory backed resources only. Heap and Map backed resources will return null.
* Gets the MemoryRequestServer object used by dynamic Memory-backed objects
* to request additional memory. To customize the actions of the MemoryRequestServer,
* extend the MemoryRequestServer interface and
* set using {@link WritableMemory#allocateDirect(long, ByteOrder, MemoryRequestServer)}.
* WritableMemory enables this for ByteBuffer, Heap and Direct Memory backed resources.
* Map backed resources will always return null.
* Gets the MemoryRequestServer object, if set, for the above resources to request additional memory.
* The user must customize the actions of the MemoryRequestServer by
* extending the MemoryRequestServer interface and set using one of these methods:
* <ul><li>{@link WritableMemory#allocateDirect(long, ByteOrder, MemoryRequestServer)}</li>
* <li>{@link WritableMemory#allocate(int, ByteOrder, MemoryRequestServer)}</li>
* <li>{@link WritableMemory#writableWrap(ByteBuffer, ByteOrder, MemoryRequestServer)}</li>
* </ul>
* Simple implementation examples include the DefaultMemoryRequestServer in the main tree, as well as
* the ExampleMemoryRequestServerTest and the use with ByteBuffer documented in the DruidIssue11544Test
* in the test tree.
* @return the MemoryRequestServer object or null.
*/
MemoryRequestServer getMemoryRequestServer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ public final long getCumulativeOffset(final long offsetBytes) {
return cumBaseOffset_ + offsetBytes;
}

//made public in WritableMemoryImpl and WritableBufferImpl, only implemented in Direct Leafs
//Documented in WritableMemory and WritableBuffer interfaces.
//Implemented in the Leaf nodes; Required here by toHex(...).
abstract MemoryRequestServer getMemoryRequestServer();

//Overridden by ByteBuffer, Direct and Map leafs
Expand Down

0 comments on commit 6652f05

Please sign in to comment.