dev@grizzly.java.net

NPE in RoundRobinConnectionDistributor.java:146

From: Farzad Panahi <farzad.panahi_at_gmail.com>
Date: Tue, 4 Aug 2015 18:25:16 -0700

Hi,

I am trying to figure out an issue
<http://stackoverflow.com/questions/31757377/tyrus-client-cannot-reconnect-on-server-restart-when-client-shared-container-is>
I have with Tyrus (which is using grizzly). Basically what is happening is
that Tyrus fails to reconnect to websocket server if server restarts. The
underlying issue from grizzly side is a NPE thrown at if (runners.length ==
1) { in RoundRobinConnectionDistributor.java:146

private final class SharedIterator implements Iterator {private final
AtomicInteger counter = new AtomicInteger();
@Overridepublic SelectorRunner next() {
    final SelectorRunner[] runners = getTransportSelectorRunners();
    if (runners.length == 1) {
        return runners[0];
    }

    return runners[(counter.getAndIncrement() & 0x7fffffff) % runners.length];}
@Overridepublic SelectorRunner nextService() {
    return next();}}

Looks like for some reason runners becomes null. Anyone has any idea when
and why selector runners may become null?

Cheers

Farzad