protected void init(String file, long length, boolean clearFile) throws Exception { File f = new File(file); if ( f.exists() && clearFile ) { f.delete(); } this.file = f; if ( f.exists() ) { length = f.length(); } RandomAccessFile raf = new RandomAccessFile(f, "rw"); raf.setLength(length); // FIXME: see stackoverflow. does not work always FileChannel fileChannel = raf.getChannel(); this.fileChannel = raf.getChannel(); this.baseAdress = map0(fileChannel, imodeFor(FileChannel.MapMode.READ_WRITE), 0L, length); this.length = length; this.cleaner = Cleaner.create(this, new Unmapper(baseAdress, length, fileChannel)); }
public MMFBytez(String filePath, long length, boolean clearFile) throws Exception { super(0, 0); init( filePath, length, clearFile ); }
public void free() { checkThread(); mutationCount++; if ( alloc != null ) { alloc.freeAll(); alloc = null; } if ( memory instanceof MMFBytez ) { ((MMFBytez) memory).freeAndClose(); memory = null; } // index.free(); index = null; }
private void resetMem(String file, long sizeMemBytes) throws Exception { checkThread(); mutationCount++; memory = new MMFBytez(file,sizeMemBytes,false); customHeader = memory.slice(CORE_HEADER_LEN, CUSTOM_FILEHEADER_LEN); tmpValueBytez = new BytezByteSource(memory,0,0); }
System.out.println("resizing underlying "+mappedFile+" to "+required+" numElem:"+numElem); long tim = System.currentTimeMillis(); ((MMFBytez) memory).freeAndClose(); memory = null; try {
private void resetMem(String file, long sizeMemBytes) throws Exception { checkThread(); mutationCount++; memory = new MMFBytez(file,sizeMemBytes,false); customHeader = memory.slice(CORE_HEADER_LEN, CUSTOM_FILEHEADER_LEN); tmpValueBytez = new BytezByteSource(memory,0,0); }
protected void init(String file, long length, boolean clearFile) throws Exception { File f = new File(file); if ( f.exists() && clearFile ) { f.delete(); } this.file = f; if ( f.exists() ) { length = f.length(); } RandomAccessFile raf = new RandomAccessFile(f, "rw"); raf.setLength(length); // FIXME: see stackoverflow. does not work always FileChannel fileChannel = raf.getChannel(); this.fileChannel = raf.getChannel(); this.baseAdress = map0(fileChannel, imodeFor(FileChannel.MapMode.READ_WRITE), 0L, length); this.length = length; this.cleaner = Cleaner.create(this, new Unmapper(baseAdress, length, fileChannel)); }
public void free() { checkThread(); mutationCount++; if ( alloc != null ) { alloc.freeAll(); alloc = null; } if ( memory instanceof MMFBytez ) { ((MMFBytez) memory).freeAndClose(); memory = null; } // index.free(); index = null; }
public MMFBytez(String filePath, long length, boolean clearFile) throws Exception { super(0, 0); init( filePath, length, clearFile ); }
System.out.println("resizing underlying "+mappedFile+" to "+required+" numElem:"+numElem); long tim = System.currentTimeMillis(); ((MMFBytez) memory).freeAndClose(); memory = null; try {