Package org.gradle.messaging.remote.internal.hub.protocol

Examples of org.gradle.messaging.remote.internal.hub.protocol.InterHubMessage


    private void flush() {
        // TODO - need to do a better job of routing messages when there are multiple endpoints. This is just going to forward all queued messages to the first
        // waiting endpoint, even if there are multiple waiting to do work
        EndPointQueue selected = waiting.isEmpty() ? null : waiting.get(0);
        while (!queue.isEmpty()) {
            InterHubMessage message = queue.get(0);
            switch (message.getDelivery()) {
                case Stateful:
                case AllHandlers:
                    if (endpoints.isEmpty()) {
                        return;
                    }
                    if (message.getDelivery() == InterHubMessage.Delivery.Stateful) {
                        initializer.onStatefulMessage(message);
                    }
                    for (EndPointQueue endpoint : endpoints) {
                        endpoint.dispatch(message);
                    }
                    queue.remove(0);
                    waiting.clear();
                    continue;
                case SingleHandler:
                    if (selected == null) {
                        return;
                    }
                    queue.remove(0);
                    waiting.remove(selected);
                    selected.dispatch(message);
                    break;
                default:
                    throw new IllegalArgumentException("Unknown delivery type: " + message.getDelivery());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.gradle.messaging.remote.internal.hub.protocol.InterHubMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.