Package com.persistit.exception

Examples of com.persistit.exception.PersistitIOException


        while (bb.remaining() > 0) {
            int count;
            try {
                count = fc.read(bb, fileAddr);
            } catch (final IOException ioe) {
                throw new PersistitIOException(ioe);
            }
            if (count < 0) {
                final File file = addressToFile(address);
                throw new CorruptJournalException(String.format("End of file at %s:%d(%,d)", file, fileAddr, address));
            }
View Full Code Here


        synchronized (this) {
            try {
                closeAllChannels();
            } catch (final IOException ioe) {
                throw new PersistitIOException(ioe);
            } finally {
                _handleToTreeMap.clear();
                _handleToVolumeMap.clear();
                _volumeToHandleMap.clear();
                _treeToHandleMap.clear();
View Full Code Here

                    _persistit.getIOMeter().chargeFlushJournal(written, address);
                    return _writeBufferAddress;
                }
            } catch (final IOException e) {
                throw new PersistitIOException("Writing to file " + addressToFile(address), e);
            }
        }
        return Long.MAX_VALUE;
    }
View Full Code Here

            if (address != Long.MAX_VALUE) {
                final FileChannel channel = getFileChannel(address);
                channel.force(false);
            }
        } catch (final IOException e) {
            throw new PersistitIOException("Writing to file " + addressToFile(address), e);
        }
    }
View Full Code Here

                if (matches) {
                    channel.truncate(length);
                }
                channel.force(true);
            } catch (final IOException ioe) {
                throw new PersistitIOException(ioe);
            }
            _currentAddress = ((_currentAddress / _blockSize) + 1) * _blockSize;
            _writeBuffer.clear();
            _writeBufferAddress = _currentAddress;
            _isNewEpoch = false;
View Full Code Here

        if (channel == null) {
            try {
                channel = new MediatedFileChannel(addressToFile(address), "rw");
                _journalFileChannels.put(generation, channel);
            } catch (final IOException ioe) {
                throw new PersistitIOException(ioe);
            }
        }
        return channel;
    }
View Full Code Here

            _channel = new MediatedFileChannel(getPath(), "rw");
            lockChannel();
            truncate();
            _opened = true;
        } catch (final IOException ioe) {
            throw new PersistitIOException(ioe);
        } finally {
            if (!_opened) {
                try {
                    closeChannel();
                } catch (final IOException e) {
View Full Code Here

            flushMetaData();
            _opened = true;

        } catch (final IOException ioe) {
            throw new PersistitIOException(ioe);
        } finally {
            if (_headBuffer != null) {
                if (!_opened) {
                    _headBuffer.clearFixed();
                    _headBuffer.clearValid();
View Full Code Here

    @Override
    void force() throws PersistitIOException {
        try {
            _channel.force(true);
        } catch (final IOException ioe) {
            throw new PersistitIOException(ioe);
        }
    }
View Full Code Here

                int read = 0;
                while (read < buffer.getBufferSize()) {
                    final long position = page * _volume.getStructure().getPageSize() + bb.position();
                    final int bytesRead = _channel.read(bb, position);
                    if (bytesRead <= 0) {
                        throw new PersistitIOException("Unable to read bytes at position " + position + " in " + this);
                    }
                    read += bytesRead;
                }
                _persistit.getIOMeter().chargeReadPageFromVolume(this._volume, buffer.getPageAddress(),
                        buffer.getBufferSize(), buffer.getIndex());
                _volume.getStatistics().bumpReadCounter();

            } catch (final IOException ioe) {
                _persistit.getAlertMonitor().post(
                        new Event(AlertLevel.ERROR, _persistit.getLogBase().readException, ioe, _volume, page,
                                buffer.getIndex()), AlertMonitor.READ_PAGE_CATEGORY);
                throw new PersistitIOException(ioe);
            }
        } finally {
            release();
        }
    }
View Full Code Here

TOP

Related Classes of com.persistit.exception.PersistitIOException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.