jojochuang commented on code in PR #7073:
URL: https://github.com/apache/ozone/pull/7073#discussion_r1717347861
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java:
##########
@@ -200,24 +213,30 @@ public synchronized void write(int b) throws IOException {
@Override
public void write(byte[] b, int off, int len)
throws IOException {
- checkNotClosed();
- if (b == null) {
- throw new NullPointerException();
- }
- if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length)
- || ((off + len) < 0)) {
- throw new IndexOutOfBoundsException();
- }
- if (len == 0) {
- return;
- }
- synchronized (this) {
- handleWrite(b, off, len, false);
- writeOffset += len;
+ try {
+ getRequestSemaphore().acquire();
+ checkNotClosed();
+ if (b == null) {
+ throw new NullPointerException();
+ }
+ if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) >
b.length)
+ || ((off + len) < 0)) {
+ throw new IndexOutOfBoundsException();
+ }
+ if (len == 0) {
+ return;
+ }
+
+ synchronized (this) {
+ handleWrite(b, off, len, false);
+ writeOffset += len;
+ }
+ } finally {
+ getRequestSemaphore().release();
}
}
Review Comment:
```suggestion
@VisibleForTesting
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]