mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Yannick Lecaillez
08.42.2016 ede52c8f25aa2b7815e006cdfd6fe09f0766b548
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LdapResponseMessageWriter.java
@@ -20,7 +20,6 @@
import org.forgerock.opendj.ldap.spi.LdapMessages.LdapResponseMessage;
import org.glassfish.grizzly.CompletionHandler;
import org.glassfish.grizzly.Connection;
import org.glassfish.grizzly.WriteHandler;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
@@ -44,25 +43,14 @@
            return;
        }
        upstream = s;
        connection.notifyCanWrite(new WriteHandler() {
            @Override
            public void onWritePossible() throws Exception {
                final Subscription sub = upstream;
                if (sub != null) {
                    sub.request(1);
                }
            }
            @Override
            public void onError(final Throwable error) {
                LdapResponseMessageWriter.this.onError(error);
            }
        });
        // We're requesting two response to allow overlap between async I/O and response computation.
        // (allows to generate a response while we're waiting for the previous message to be written)
        upstream.request(2);
    }
    @Override
    public void onNext(final LdapResponseMessage message) {
        connection.write(message).addCompletionHandler(this);
        connection.write(message, this);
    }
    @Override