All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eightkdata.mongowp.mongoserver.api.safe.impl.GroupedCommandsExecutor Maven / Gradle / Ivy

The newest version!

package com.eightkdata.mongowp.mongoserver.api.safe.impl;

import com.eightkdata.mongowp.mongoserver.api.safe.*;
import com.eightkdata.mongowp.mongoserver.protocol.exceptions.CommandNotSupportedException;
import com.eightkdata.mongowp.mongoserver.protocol.exceptions.MongoException;
import com.google.common.collect.ImmutableList;
import javax.annotation.Nonnull;

/**
 *
 */
public class GroupedCommandsExecutor implements CommandsExecutor {

    private final ImmutableList subExecutors;

    public GroupedCommandsExecutor(ImmutableList subExecutors) {
        this.subExecutors = subExecutors;
    }

    @Override
    public  CommandReply execute(
            @Nonnull Command command,
            @Nonnull CommandRequest request)
            throws MongoException, CommandNotSupportedException {
        for (CommandsExecutor subExecutor : subExecutors) {
            try {
                return subExecutor.execute(command, request);
            } catch (CommandNotSupportedException ex) {
            }
        }
        throw new CommandNotSupportedException(command.getCommandName());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy