Example usage for io.netty.util.internal PlatformDependent throwException

List of usage examples for io.netty.util.internal PlatformDependent throwException

Introduction

In this page you can find the example usage for io.netty.util.internal PlatformDependent throwException.

Prototype

public static void throwException(Throwable t) 

Source Link

Document

Raises an exception bypassing compiler checks for checked exceptions.

Usage

From source file:com.github.sinsinpub.pero.manual.proxyhandler.ProxyServer.java

License:Apache License

/**
 * Logs all recorded exceptions and raises the last one so that the caller can fail.
 *//*  ww  w .  ja v a  2  s .  c om*/
public final void checkExceptions() {
    Throwable t;
    for (;;) {
        t = recordedExceptions.poll();
        if (t == null) {
            break;
        }

        logger.warn("Unexpected exception:", t);
    }

    if (t != null) {
        PlatformDependent.throwException(t);
    }
}

From source file:com.google.devtools.build.lib.remote.blobstore.http.HttpBlobStore.java

License:Open Source License

private Channel acquireDownloadChannel() throws InterruptedException {
    try {/*from   w ww .j  ava 2  s  .c o m*/
        return downloadChannels.acquire().get();
    } catch (ExecutionException e) {
        PlatformDependent.throwException(e.getCause());
        return null;
    }
}

From source file:com.google.devtools.build.lib.remote.blobstore.http.HttpBlobStore.java

License:Open Source License

private Channel acquireUploadChannel() throws InterruptedException {
    try {//www .jav a2 s .  com
        return uploadChannels.acquire().get();
    } catch (ExecutionException e) {
        PlatformDependent.throwException(e.getCause());
        return null;
    }
}

From source file:com.linecorp.armeria.server.AbstractServerTest.java

License:Apache License

@Before
public void startServer() throws Exception {
    synchronized (lock) {
        if (server != null) {
            return;
        }/*from   w w  w  .  j a v a2 s.  co  m*/

        final ServerBuilder sb = new ServerBuilder();
        configureServer(sb);
        server = sb.build();

        try {
            server.start().sync();
        } catch (InterruptedException e) {
            PlatformDependent.throwException(e);
        }

        httpPort = server.activePorts().values().stream().filter(p1 -> p1.protocol() == SessionProtocol.HTTP)
                .findAny().flatMap(p -> Optional.of(p.localAddress().getPort())).orElse(-1);

        httpsPort = server.activePorts().values().stream().filter(p1 -> p1.protocol() == SessionProtocol.HTTPS)
                .findAny().flatMap(p -> Optional.of(p.localAddress().getPort())).orElse(-1);
    }
}

From source file:com.linecorp.armeria.test.AbstractServiceServer.java

License:Apache License

@SuppressWarnings("unchecked")
public <T extends AbstractServiceServer> T start() throws Exception {
    ServerBuilder sb = new ServerBuilder().port(0, SessionProtocol.HTTP);
    configureServer(sb);//from   w ww.ja v a  2  s .c om
    server = sb.build();

    try {
        server.start().get();
    } catch (InterruptedException e) {
        PlatformDependent.throwException(e);
    }
    return (T) this;
}

From source file:com.vela.iot.active.netty.http2.server.LastInboundHandler.java

License:Apache License

public void checkException() throws Exception {
    if (lastException == null) {
        return;/*from w w  w.j ava2  s.  com*/
    }
    Throwable t = lastException;
    lastException = null;
    PlatformDependent.throwException(t);
}

From source file:net.tomp2p.storage.AlternativeCompositeByteBuf.java

License:Apache License

private int forEachByteAsc0(int index, int length, ByteBufProcessor processor) {
    if (processor == null) {
        throw new NullPointerException("processor");
    }//w  w w .  ja  va 2  s .c o  m

    if (length == 0) {
        return -1;
    }

    final int endIndex = index + length;
    int i = index;
    try {
        do {
            if (processor.process(getByte(i))) {
                i++;
            } else {
                return i;
            }
        } while (i < endIndex);
    } catch (Exception e) {
        PlatformDependent.throwException(e);
    }

    return -1;
}

From source file:net.tomp2p.storage.AlternativeCompositeByteBuf.java

License:Apache License

private int forEachByteDesc0(int index, int length, ByteBufProcessor processor) {
    if (processor == null) {
        throw new NullPointerException("processor");
    }/* w  w w  .  j  a v a 2s .  com*/

    if (length == 0) {
        return -1;
    }

    int i = index + length - 1;
    try {
        do {
            if (processor.process(getByte(i))) {
                i--;
            } else {
                return i;
            }
        } while (i >= index);
    } catch (Exception e) {
        PlatformDependent.throwException(e);
    }

    return -1;
}

From source file:org.redisson.connection.FastFailedFuture.java

License:Apache License

@Override
public Future<V> sync() {
    PlatformDependent.throwException(cause);
    return this;
}

From source file:org.redisson.connection.FastFailedFuture.java

License:Apache License

@Override
public Future<V> syncUninterruptibly() {
    PlatformDependent.throwException(cause);
    return this;
}