Skip to content

Commit 11db9a6

Browse files
committed
ORC-361: Remove the single thread restriction on the MemoryManagerImpl.
Fixes #433 Signed-off-by: Owen O'Malley <omalley@apache.org>
1 parent 6d4b830 commit 11db9a6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

java/core/src/java/org/apache/orc/impl/MemoryManagerImpl.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* dynamic partitions, it is easy to end up with many writers in the same task.
3636
* By managing the size of each allocation, we try to cut down the size of each
3737
* allocation and keep the task from running out of memory.
38-
*
38+
*
3939
* This class is not thread safe, but is re-entrant - ensure creation and all
4040
* invocations are triggered from the same thread.
4141
*/
@@ -77,7 +77,7 @@ public MemoryManagerImpl(long poolSize) {
7777
* @param requestedAllocation the requested buffer size
7878
*/
7979
public synchronized void addWriter(Path path, long requestedAllocation,
80-
Callback callback) {
80+
Callback callback) throws IOException {
8181
WriterInfo oldVal = writerList.get(path);
8282
// this should always be null, but we handle the case where the memory
8383
// manager wasn't told that a writer wasn't still in use and the task
@@ -97,7 +97,7 @@ public synchronized void addWriter(Path path, long requestedAllocation,
9797
* Remove the given writer from the pool.
9898
* @param path the file that has been closed
9999
*/
100-
public synchronized void removeWriter(Path path) {
100+
public synchronized void removeWriter(Path path) throws IOException {
101101
WriterInfo val = writerList.get(path);
102102
if (val != null) {
103103
writerList.remove(path);
@@ -125,7 +125,15 @@ public double getAllocationScale() {
125125
}
126126

127127
@Override
128-
public void addedRow(int rows) {
128+
public void addedRow(int rows) throws IOException {
129+
// PASS
130+
}
131+
132+
/**
133+
* Obsolete method left for Hive, which extends this class.
134+
* @deprecated remove this method
135+
*/
136+
public void notifyWriters() throws IOException {
129137
// PASS
130138
}
131139

0 commit comments

Comments
 (0)