public void cachePackage(final byte[] body) throws Exception { checkOpen(); cachedChannel.position(cachedChannel.size()); cachedChannel.write(ByteBuffer.wrap(body)); close(); }
private synchronized void readCache(final long position) { try { if (position < readCachePositionStart || position > readCachePositionEnd) { checkOpen(); if (position > cachedChannel.size()) { throw new ArrayIndexOutOfBoundsException("position > " + cachedChannel.size()); } readCachePositionStart = position / bufferSize * bufferSize; cachedChannel.position(readCachePositionStart); if (readCache == null) { readCache = ByteBuffer.allocate(bufferSize); } readCache.clear(); readCachePositionEnd = readCachePositionStart + cachedChannel.read(readCache) - 1; } } catch (Exception e) { ActiveMQClientLogger.LOGGER.errorReadingCache(e); throw new RuntimeException(e.getMessage(), e); } finally { close(); } }
public void cachePackage(final byte[] body) throws Exception { checkOpen(); cachedChannel.position(cachedChannel.size()); cachedChannel.write(ByteBuffer.wrap(body)); close(); }
private synchronized void readCache(final long position) { try { if (position < readCachePositionStart || position > readCachePositionEnd) { checkOpen(); if (position > cachedChannel.size()) { throw new ArrayIndexOutOfBoundsException("position > " + cachedChannel.size()); } readCachePositionStart = position / bufferSize * bufferSize; cachedChannel.position(readCachePositionStart); if (readCache == null) { readCache = ByteBuffer.allocate(bufferSize); } readCache.clear(); readCachePositionEnd = readCachePositionStart + cachedChannel.read(readCache) - 1; } } catch (Exception e) { ActiveMQClientLogger.LOGGER.errorReadingCache(e); throw new RuntimeException(e.getMessage(), e); } finally { close(); } }
private synchronized void readCache(final long position) { try { if (position < readCachePositionStart || position > readCachePositionEnd) { checkOpen(); if (position > cachedChannel.size()) { throw new ArrayIndexOutOfBoundsException("position > " + cachedChannel.size()); } readCachePositionStart = position / bufferSize * bufferSize; cachedChannel.position(readCachePositionStart); if (readCache == null) { readCache = ByteBuffer.allocate(bufferSize); } readCache.clear(); readCachePositionEnd = readCachePositionStart + cachedChannel.read(readCache) - 1; } } catch (Exception e) { ActiveMQClientLogger.LOGGER.errorReadingCache(e); throw new RuntimeException(e.getMessage(), e); } finally { close(); } }
private synchronized void readCache(final long position) { try { if (position < readCachePositionStart || position > readCachePositionEnd) { final FileChannel cachedChannel = checkOpen(); if (position > cachedChannel.size()) { throw new ArrayIndexOutOfBoundsException("position > " + cachedChannel.size()); } readCachePositionStart = position / bufferSize * bufferSize; cachedChannel.position(readCachePositionStart); if (readCache == null) { readCache = ByteBuffer.allocate(bufferSize); } readCache.clear(); readCachePositionEnd = readCachePositionStart + cachedChannel.read(readCache) - 1; } } catch (Exception e) { ActiveMQClientLogger.LOGGER.errorReadingCache(e); throw new RuntimeException(e.getMessage(), e); } finally { close(); } }
private synchronized void readCache(final long position) { try { if (position < readCachePositionStart || position > readCachePositionEnd) { checkOpen(); if (position > cachedChannel.size()) { throw new ArrayIndexOutOfBoundsException("position > " + cachedChannel.size()); } readCachePositionStart = position / bufferSize * bufferSize; cachedChannel.position(readCachePositionStart); if (readCache == null) { readCache = ByteBuffer.allocate(bufferSize); } readCache.clear(); readCachePositionEnd = readCachePositionStart + cachedChannel.read(readCache) - 1; } } catch (Exception e) { ActiveMQClientLogger.LOGGER.errorReadingCache(e); throw new RuntimeException(e.getMessage(), e); } finally { close(); } }
private synchronized void readCache(final long position) { try { if (position < readCachePositionStart || position > readCachePositionEnd) { final FileChannel cachedChannel = checkOpen(); if (position > cachedChannel.size()) { throw new ArrayIndexOutOfBoundsException("position > " + cachedChannel.size()); } readCachePositionStart = position / bufferSize * bufferSize; cachedChannel.position(readCachePositionStart); if (readCache == null) { readCache = ByteBuffer.allocate(bufferSize); } readCache.clear(); readCachePositionEnd = readCachePositionStart + cachedChannel.read(readCache) - 1; } } catch (Exception e) { ActiveMQClientLogger.LOGGER.errorReadingCache(e); throw new RuntimeException(e.getMessage(), e); } finally { close(); } }
private synchronized void readCache(final long position) { try { if (position < readCachePositionStart || position > readCachePositionEnd) { final FileChannel cachedChannel = checkOpen(); if (position > cachedChannel.size()) { throw new ArrayIndexOutOfBoundsException("position > " + cachedChannel.size()); } readCachePositionStart = position / bufferSize * bufferSize; cachedChannel.position(readCachePositionStart); if (readCache == null) { readCache = ByteBuffer.allocate(bufferSize); } readCache.clear(); readCachePositionEnd = readCachePositionStart + cachedChannel.read(readCache) - 1; } } catch (Exception e) { ActiveMQClientLogger.LOGGER.errorReadingCache(e); throw new RuntimeException(e.getMessage(), e); } finally { close(); } }
public void cachePackage(final byte[] body) throws Exception { checkOpen(); cachedChannel.position(cachedChannel.size()); cachedChannel.write(ByteBuffer.wrap(body)); close(); }
public void cachePackage(final byte[] body) throws Exception { checkOpen(); cachedChannel.position(cachedChannel.size()); cachedChannel.write(ByteBuffer.wrap(body)); close(); }
public void cachePackage(final byte[] body) throws Exception { final FileChannel cachedChannel = checkOpen(); cachedChannel.position(cachedChannel.size()); cachedChannel.write(ByteBuffer.wrap(body)); close(); }
public void cachePackage(final byte[] body) throws Exception { final FileChannel cachedChannel = checkOpen(); cachedChannel.position(cachedChannel.size()); cachedChannel.write(ByteBuffer.wrap(body)); close(); }
public void cachePackage(final byte[] body) throws Exception { final FileChannel cachedChannel = checkOpen(); cachedChannel.position(cachedChannel.size()); cachedChannel.write(ByteBuffer.wrap(body)); close(); }