public void writeDirect(final ByteBuffer bytes, final boolean sync, final IOAsyncTask callback) { if (callback == null) { throw new NullPointerException("callback parameter need to be set"); } try { internalWrite(bytes, sync, callback); } catch (Exception e) { callback.onError(HornetQExceptionType.GENERIC_EXCEPTION.getCode(), e.getMessage()); } }
public void run() { long sequence = nextWritingSequence.getAndIncrement(); try { Native.write(AsynchronousFileImpl.this, handler, sequence, position, size, directByteBuffer, aioCallback); } catch (HornetQException e) { callbackError(aioCallback, sequence, directByteBuffer, e.getType().getCode(), e.getMessage()); } catch (RuntimeException e) { callbackError(aioCallback, sequence, directByteBuffer, HornetQExceptionType.INTERNAL_ERROR.getCode(), e.getMessage()); } } });
public void writeDirect(final ByteBuffer bytes, final boolean sync, final IOAsyncTask callback) { if (callback == null) { throw new NullPointerException("callback parameter need to be set"); } try { internalWrite(bytes, sync, callback); } catch (Exception e) { callback.onError(HornetQExceptionType.GENERIC_EXCEPTION.getCode(), e.getMessage()); } }
public void run() { long sequence = nextWritingSequence.getAndIncrement(); try { Native.write(AsynchronousFileImpl.this, handler, sequence, position, size, directByteBuffer, aioCallback); } catch (HornetQException e) { callbackError(aioCallback, sequence, directByteBuffer, e.getType().getCode(), e.getMessage()); } catch (RuntimeException e) { callbackError(aioCallback, sequence, directByteBuffer, HornetQExceptionType.INTERNAL_ERROR.getCode(), e.getMessage()); } } });
task.onError(HornetQExceptionType.INTERNAL_ERROR.getCode(), "It wasn't possible to complete IO operation - " + e.getMessage());
public void run() { try { try { doInternalWrite(bytes, sync, callback); } catch (IOException e) { HornetQJournalLogger.LOGGER.errorSubmittingWrite(e); factory.onIOError(new HornetQIOErrorException(e.getMessage(), e), e.getMessage(), NIOSequentialFile.this); callback.onError(HornetQExceptionType.IO_ERROR.getCode(), e.getMessage()); } catch (Throwable e) { HornetQJournalLogger.LOGGER.errorSubmittingWrite(e); callback.onError(HornetQExceptionType.IO_ERROR.getCode(), e.getMessage()); } } finally { maxIOSemaphore.release(); } } });
public void run() { try { try { doInternalWrite(bytes, sync, callback); } catch (IOException e) { HornetQJournalLogger.LOGGER.errorSubmittingWrite(e); factory.onIOError(new HornetQIOErrorException(e.getMessage(), e), e.getMessage(), NIOSequentialFile.this); callback.onError(HornetQExceptionType.IO_ERROR.getCode(), e.getMessage()); } catch (Throwable e) { HornetQJournalLogger.LOGGER.errorSubmittingWrite(e); callback.onError(HornetQExceptionType.IO_ERROR.getCode(), e.getMessage()); } } finally { maxIOSemaphore.release(); } } });
ctx.onError(HornetQExceptionType.IO_ERROR.getCode(), e.getMessage());
public synchronized int read(final ByteBuffer bytes, final IOAsyncTask callback) throws IOException, HornetQIllegalStateException { try { if (channel == null) { throw new HornetQIllegalStateException("File " + this.getFileName() + " has a null channel"); } int bytesRead = channel.read(bytes); if (callback != null) { callback.done(); } bytes.flip(); return bytesRead; } catch (IOException e) { if (callback != null) { callback.onError(HornetQExceptionType.IO_ERROR.getCode(), e.getLocalizedMessage()); } factory.onIOError(new HornetQIOErrorException(e.getMessage(), e), e.getMessage(), this); throw e; } }
@Override public void encodeRest(final HornetQBuffer buffer) { buffer.writeInt(exception.getType().getCode()); buffer.writeNullableString(exception.getMessage()); }
public synchronized int read(final ByteBuffer bytes, final IOAsyncTask callback) throws IOException, HornetQIllegalStateException { try { if (channel == null) { throw new HornetQIllegalStateException("File " + this.getFileName() + " has a null channel"); } int bytesRead = channel.read(bytes); if (callback != null) { callback.done(); } bytes.flip(); return bytesRead; } catch (IOException e) { if (callback != null) { callback.onError(HornetQExceptionType.IO_ERROR.getCode(), e.getLocalizedMessage()); } factory.onIOError(new HornetQIOErrorException(e.getMessage(), e), e.getMessage(), this); throw e; } }
public void fill(final long position, final int blocks, final long size, final byte fillChar) throws HornetQException { checkOpened(); try { Native.fill(handler, position, blocks, size, fillChar); } catch (HornetQException e) { fireExceptionListener(e.getType().getCode(), e.getMessage()); throw e; } }
callback.onError(HornetQExceptionType.IO_ERROR.getCode(), "File not opened");
callback.onError(HornetQExceptionType.IO_ERROR.getCode(), "File not opened");
public void writeInternal(long positionToWrite, long size, ByteBuffer bytes) throws HornetQException { try { Native.writeInternal(handler, positionToWrite, size, bytes); } catch (HornetQException e) { fireExceptionListener(e.getType().getCode(), e.getMessage()); throw e; } if (bufferCallback != null) { bufferCallback.bufferDone(bytes); } }
public void fill(final long position, final int blocks, final long size, final byte fillChar) throws HornetQException { checkOpened(); try { Native.fill(handler, position, blocks, size, fillChar); } catch (HornetQException e) { fireExceptionListener(e.getType().getCode(), e.getMessage()); throw e; } }
public void writeInternal(long positionToWrite, long size, ByteBuffer bytes) throws HornetQException { try { Native.writeInternal(handler, positionToWrite, size, bytes); } catch (HornetQException e) { fireExceptionListener(e.getType().getCode(), e.getMessage()); throw e; } if (bufferCallback != null) { bufferCallback.bufferDone(bytes); } }