< prev index next >

src/java.base/share/classes/java/nio/Buffer.java

Print this page
@@ -818,19 +818,20 @@
                  public MemorySegmentProxy bufferSegment(Buffer buffer) {
                      return buffer.segment;
                  }
  
                  @Override
-                 public Scope.Handle acquireScope(Buffer buffer, boolean async) {
+                 public Runnable acquireScope(Buffer buffer, boolean async) {
                      var scope = buffer.scope();
                      if (scope == null) {
                          return null;
                      }
                      if (async && scope.ownerThread() != null) {
                          throw new IllegalStateException("Confined scope not supported");
                      }
-                     return scope.acquire();
+                     scope.acquire0();
+                     return scope::release0;
                  }
  
                  @Override
                  public void force(FileDescriptor fd, long address, boolean isSync, long offset, long size) {
                      MappedMemoryUtils.force(fd, address, isSync, offset, size);
< prev index next >