< prev index next >

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

Print this page

803                 @Override
804                 public long getBufferAddress(ByteBuffer bb) {
805                     return bb.address;
806                 }
807 
808                 @Override
809                 public UnmapperProxy unmapper(ByteBuffer bb) {
810                     if (bb instanceof MappedByteBuffer) {
811                         return ((MappedByteBuffer)bb).unmapper();
812                     } else {
813                         return null;
814                     }
815                 }
816 
817                 @Override
818                 public MemorySegmentProxy bufferSegment(Buffer buffer) {
819                     return buffer.segment;
820                 }
821 
822                 @Override
823                 public Scope.Handle acquireScope(Buffer buffer, boolean async) {
824                     var scope = buffer.scope();
825                     if (scope == null) {
826                         return null;
827                     }
828                     if (async && scope.ownerThread() != null) {
829                         throw new IllegalStateException("Confined scope not supported");
830                     }
831                     return scope.acquire();

832                 }
833 
834                 @Override
835                 public void force(FileDescriptor fd, long address, boolean isSync, long offset, long size) {
836                     MappedMemoryUtils.force(fd, address, isSync, offset, size);
837                 }
838 
839                 @Override
840                 public void load(long address, boolean isSync, long size) {
841                     MappedMemoryUtils.load(address, isSync, size);
842                 }
843 
844                 @Override
845                 public void unload(long address, boolean isSync, long size) {
846                     MappedMemoryUtils.unload(address, isSync, size);
847                 }
848 
849                 @Override
850                 public boolean isLoaded(long address, boolean isSync, long size) {
851                     return MappedMemoryUtils.isLoaded(address, isSync, size);

803                 @Override
804                 public long getBufferAddress(ByteBuffer bb) {
805                     return bb.address;
806                 }
807 
808                 @Override
809                 public UnmapperProxy unmapper(ByteBuffer bb) {
810                     if (bb instanceof MappedByteBuffer) {
811                         return ((MappedByteBuffer)bb).unmapper();
812                     } else {
813                         return null;
814                     }
815                 }
816 
817                 @Override
818                 public MemorySegmentProxy bufferSegment(Buffer buffer) {
819                     return buffer.segment;
820                 }
821 
822                 @Override
823                 public Runnable acquireScope(Buffer buffer, boolean async) {
824                     var scope = buffer.scope();
825                     if (scope == null) {
826                         return null;
827                     }
828                     if (async && scope.ownerThread() != null) {
829                         throw new IllegalStateException("Confined scope not supported");
830                     }
831                     scope.acquire0();
832                     return scope::release0;
833                 }
834 
835                 @Override
836                 public void force(FileDescriptor fd, long address, boolean isSync, long offset, long size) {
837                     MappedMemoryUtils.force(fd, address, isSync, offset, size);
838                 }
839 
840                 @Override
841                 public void load(long address, boolean isSync, long size) {
842                     MappedMemoryUtils.load(address, isSync, size);
843                 }
844 
845                 @Override
846                 public void unload(long address, boolean isSync, long size) {
847                     MappedMemoryUtils.unload(address, isSync, size);
848                 }
849 
850                 @Override
851                 public boolean isLoaded(long address, boolean isSync, long size) {
852                     return MappedMemoryUtils.isLoaded(address, isSync, size);
< prev index next >