@Override public Future<V> syncUninterruptibly() { PlatformDependent.throwException(cause); return this; }
@Override public Future<V> sync() { PlatformDependent.throwException(cause); return this; }
@Override public ChannelFuture syncUninterruptibly() { PlatformDependent.throwException(cause); return this; } }
@Override public ChannelFuture sync() { PlatformDependent.throwException(cause); return this; }
@Override public ChannelFuture syncUninterruptibly() { PlatformDependent.throwException(cause); return this; } }
/** * Converts the specified byte value into a hexadecimal integer and appends it to the specified buffer. */ public static <T extends Appendable> T byteToHexString(T buf, int value) { try { buf.append(byteToHexString(value)); } catch (IOException e) { PlatformDependent.throwException(e); } return buf; }
@Override public long convertToTimeMillis(CharSequence value) { Date date = DateFormatter.parseHttpDate(value); if (date == null) { PlatformDependent.throwException(new ParseException("header can't be parsed into a Date: " + value, 0)); return 0; } return date.getTime(); }
private void rethrowIfFailed() { Throwable cause = cause(); if (cause == null) { return; } PlatformDependent.throwException(cause); }
/** * Converts the specified byte value into a 2-digit hexadecimal integer and appends it to the specified buffer. */ public static <T extends Appendable> T byteToHexStringPadded(T buf, int value) { try { buf.append(byteToHexStringPadded(value)); } catch (IOException e) { PlatformDependent.throwException(e); } return buf; }
/** * Register this {@code Channel} on its {@link EventLoop}. */ public void register() throws Exception { ChannelFuture future = loop.register(this); assert future.isDone(); Throwable cause = future.cause(); if (cause != null) { PlatformDependent.throwException(cause); } }
private void startThread() { if (state == ST_NOT_STARTED) { if (STATE_UPDATER.compareAndSet(this, ST_NOT_STARTED, ST_STARTED)) { try { doStartThread(); } catch (Throwable cause) { STATE_UPDATER.set(this, ST_NOT_STARTED); PlatformDependent.throwException(cause); } } } }
@Override public int forEachByteDesc(ByteProcessor processor) { ensureAccessible(); try { return forEachByteDesc0(writerIndex - 1, readerIndex, processor); } catch (Exception e) { PlatformDependent.throwException(e); return -1; } }
@Override public int forEachByte(ByteProcessor processor) { ensureAccessible(); try { return forEachByteAsc0(readerIndex, writerIndex, processor); } catch (Exception e) { PlatformDependent.throwException(e); return -1; } }
@Override public int forEachByte(int index, int length, ByteProcessor processor) { checkIndex(index, length); try { return forEachByteAsc0(index, index + length, processor); } catch (Exception e) { PlatformDependent.throwException(e); return -1; } }
@Override public int forEachByteDesc(int index, int length, ByteProcessor processor) { checkIndex(index, length); try { return forEachByteDesc0(index + length - 1, index, processor); } catch (Exception e) { PlatformDependent.throwException(e); return -1; } }
private V initialize(InternalThreadLocalMap threadLocalMap) { V v = null; try { v = initialValue(); } catch (Exception e) { PlatformDependent.throwException(e); } threadLocalMap.setIndexedVariable(index, v); addToVariablesToRemove(threadLocalMap, this); return v; }
ByteBuf decode(ByteBuf src, int off, int len, ByteBufAllocator allocator, Base64Dialect dialect) { dest = allocator.buffer(decodedBufferSize(len)).order(src.order()); // Upper limit on size of output decodabet = decodabet(dialect); try { src.forEachByte(off, len, this); return dest.slice(0, outBuffPosn); } catch (Throwable cause) { dest.release(); PlatformDependent.throwException(cause); return null; } }
/** * Allocate a new {@link ByteBuffer} with the given {@code capacity}. {@link ByteBuffer}s allocated with * this method <strong>MUST</strong> be deallocated via {@link #freeDirectNoCleaner(ByteBuffer)}. */ public static ByteBuffer allocateDirectNoCleaner(int capacity) { assert USE_DIRECT_BUFFER_NO_CLEANER; incrementMemoryCounter(capacity); try { return PlatformDependent0.allocateDirectNoCleaner(capacity); } catch (Throwable e) { decrementMemoryCounter(capacity); throwException(e); return null; } }
/** * Checks for the presence of an {@link Exception}. */ private ChannelFuture checkException(ChannelPromise promise) { Throwable t = lastException; if (t != null) { lastException = null; if (promise.isVoid()) { PlatformDependent.throwException(t); } return promise.setFailure(t); } return promise.setSuccess(); }
private boolean ensureThreadStarted(int oldState) { if (oldState == ST_NOT_STARTED) { try { doStartThread(); } catch (Throwable cause) { STATE_UPDATER.set(this, ST_TERMINATED); terminationFuture.tryFailure(cause); if (!(cause instanceof Exception)) { // Also rethrow as it may be an OOME for example PlatformDependent.throwException(cause); } return true; } } return false; }