private synchronized void closeFiles() { try { if (mvStore != null) { mvStore.closeImmediately(); } if (pageStore != null) { pageStore.close(); pageStore = null; } } catch (DbException e) { trace.error(e, "close"); } }
/** * Open the file and read the header. */ public synchronized void open() { try { metaRootPageId.put(META_TABLE_ID, PAGE_ID_META_ROOT); if (FileUtils.exists(fileName)) { long length = FileUtils.size(fileName); if (length < MIN_PAGE_COUNT * PAGE_SIZE_MIN) { if (database.isReadOnly()) { throw DbException.get( ErrorCode.FILE_CORRUPTED_1, fileName + " length: " + length); } // the database was not fully created openNew(); } else { openExisting(); } } else { openNew(); } } catch (DbException e) { close(); throw e; } }
pageStore.close(); } catch (DbException e) {
private void readStaticHeader() { file.seek(FileStore.HEADER_LENGTH); Data page = Data.create(database, new byte[PAGE_SIZE_MIN - FileStore.HEADER_LENGTH]); file.readFully(page.getBytes(), 0, PAGE_SIZE_MIN - FileStore.HEADER_LENGTH); readCount++; setPageSize(page.readInt()); int writeVersion = page.readByte(); int readVersion = page.readByte(); if (readVersion > READ_VERSION) { throw DbException.get( ErrorCode.FILE_VERSION_ERROR_1, fileName); } if (writeVersion > WRITE_VERSION) { close(); database.setReadOnly(true); accessMode = "r"; file = database.openFile(fileName, accessMode, true); } }
private synchronized void closeFiles() { try { if (mvStore != null) { mvStore.closeImmediately(); } if (pageStore != null) { pageStore.close(); pageStore = null; } } catch (DbException e) { trace.error(e, "close"); } }
private synchronized void closeFiles() { try { if (mvStore != null) { mvStore.closeImmediately(); } if (pageStore != null) { pageStore.close(); pageStore = null; } } catch (DbException e) { trace.error(e, "close"); } }
/** * Open the file and read the header. */ public synchronized void open() { try { metaRootPageId.put(META_TABLE_ID, PAGE_ID_META_ROOT); if (FileUtils.exists(fileName)) { long length = FileUtils.size(fileName); if (length < MIN_PAGE_COUNT * PAGE_SIZE_MIN) { if (database.isReadOnly()) { throw DbException.get( ErrorCode.FILE_CORRUPTED_1, fileName + " length: " + length); } // the database was not fully created openNew(); } else { openExisting(); } } else { openNew(); } } catch (DbException e) { close(); throw e; } }
/** * Open the file and read the header. */ public synchronized void open() { try { metaRootPageId.put(META_TABLE_ID, PAGE_ID_META_ROOT); if (FileUtils.exists(fileName)) { long length = FileUtils.size(fileName); if (length < MIN_PAGE_COUNT * PAGE_SIZE_MIN) { if (database.isReadOnly()) { throw DbException.get( ErrorCode.FILE_CORRUPTED_1, fileName + " length: " + length); } // the database was not fully created openNew(); } else { openExisting(); } } else { openNew(); } } catch (DbException e) { close(); throw e; } }
private void readStaticHeader() { file.seek(FileStore.HEADER_LENGTH); Data page = Data.create(database, new byte[PAGE_SIZE_MIN - FileStore.HEADER_LENGTH]); file.readFully(page.getBytes(), 0, PAGE_SIZE_MIN - FileStore.HEADER_LENGTH); readCount++; setPageSize(page.readInt()); int writeVersion = page.readByte(); int readVersion = page.readByte(); if (readVersion > READ_VERSION) { throw DbException.get( ErrorCode.FILE_VERSION_ERROR_1, fileName); } if (writeVersion > WRITE_VERSION) { close(); database.setReadOnly(true); accessMode = "r"; file = database.openFile(fileName, accessMode, true); } }
private void readStaticHeader() { file.seek(FileStore.HEADER_LENGTH); Data page = Data.create(database, new byte[PAGE_SIZE_MIN - FileStore.HEADER_LENGTH]); file.readFully(page.getBytes(), 0, PAGE_SIZE_MIN - FileStore.HEADER_LENGTH); readCount++; setPageSize(page.readInt()); int writeVersion = page.readByte(); int readVersion = page.readByte(); if (readVersion > READ_VERSION) { throw DbException.get( ErrorCode.FILE_VERSION_ERROR_1, fileName); } if (writeVersion > WRITE_VERSION) { close(); database.setReadOnly(true); accessMode = "r"; file = database.openFile(fileName, accessMode, true); } }
pageStore.close(); } catch (DbException e) {
pageStore.close(); } catch (DbException e) {