
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 super Arg, ? super Result> 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