Skip to content

Commit

Permalink
Fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
Baunsgaard committed Aug 8, 2023
1 parent bd550f8 commit ac25fa7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import org.apache.commons.lang3.concurrent.ConcurrentUtils;

public class DoubleBufferingOutputStream extends FilterOutputStream {
protected ExecutorService _pool = Executors.newSingleThreadExecutor();
protected Future<?>[] _locks;
protected byte[][] _buff;
private int _pos;
Expand Down Expand Up @@ -66,7 +69,7 @@ public void write(byte[] b, int off, int len)
System.arraycopy(b, off, _buff[_pos], 0, len);

//submit write request
_locks[_pos] = CommonThreadPool.getDynamicPool().submit(new WriteTask(_buff[_pos], len));
_locks[_pos] = _pool.submit(new WriteTask(_buff[_pos], len));
_pos = (_pos+1) % _buff.length;
}
}
Expand Down Expand Up @@ -100,6 +103,7 @@ public void flush() throws IOException {

@Override
public void close() throws IOException {
_pool.shutdown();
super.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ public void testParamservMinimumVersion() {

private void runDMLTest(String testname, boolean exceptionExpected, Class<?> exceptionClass, String errmsg) {
TestConfiguration config = getTestConfiguration(testname);
setOutputBuffering(true);
loadTestConfiguration(config);
programArgs = new String[] { "-explain" };
fullDMLScriptName = HOME + testname + ".dml";
runTest(true, exceptionExpected, exceptionClass, errmsg, -1);
setOutputBuffering(false);
}
}

0 comments on commit ac25fa7

Please sign in to comment.