class CheckConfigurationVersionAndExecuteCommand<T> implements RemoteCommand<T>, ComparableByContent<CheckConfigurationVersionAndExecuteCommand<?>> {

    private final RemoteCommand<T> targetCommand;
    private final long desiredConfigurationVersion;

    public CheckConfigurationVersionAndExecuteCommand(RemoteCommand<T> targetCommand, long desiredConfigurationVersion) {
        this.targetCommand = targetCommand;
        this.desiredConfigurationVersion = desiredConfigurationVersion;
    }

    @Override
    public boolean canBeMerged(RemoteCommand<?> another) {
        if (!(another instanceof CheckConfigurationVersionAndExecuteCommand)) {
            return false;
        }
        CheckConfigurationVersionAndExecuteCommand<?> anotherCmd = (CheckConfigurationVersionAndExecuteCommand<?>) another;
        return desiredConfigurationVersion == anotherCmd.desiredConfigurationVersion && targetCommand.canBeMerged(anotherCmd.targetCommand);
    }

    @Override
    public RemoteCommand<?> toMergedCommand() {
        return new CheckConfigurationVersionAndExecuteCommand<>(targetCommand.toMergedCommand(), desiredConfigurationVersion);
    }

    @Override
    public void mergeInto(RemoteCommand<?> mergedCommand) {
        targetCommand.mergeInto(((CheckConfigurationVersionAndExecuteCommand) mergedCommand).targetCommand);
    }

    @Override
    public boolean isMerged() {
        return targetCommand.isMerged();
    }

    @Override
    public int getMergedCommandsCount() {
        return targetCommand.getMergedCommandsCount();
    }

    @Override
    public CommandResult<?> unwrapOneResult(T result, int indice) {
        return targetCommand.unwrapOneResult(result, indice);
    }

    public RemoteCommand<T> getTargetCommand() {
        return targetCommand;
    }

    public long getDesiredConfigurationVersion() {
        return desiredConfigurationVersion;
    }

    @Override
    public CommandResult<T> execute(MutableBucketEntry mutableEntry, long currentTimeNanos) {<FILL_FUNCTION_BODY>}

    @Override
    public SerializationHandle<RemoteCommand<?>> getSerializationHandle() {
        return (SerializationHandle) SERIALIZATION_HANDLE;
    }

    public static final SerializationHandle<CheckConfigurationVersionAndExecuteCommand<?>> SERIALIZATION_HANDLE = new SerializationHandle<CheckConfigurationVersionAndExecuteCommand<?>>() {

        @Override
        public <I> CheckConfigurationVersionAndExecuteCommand<?> deserialize(DeserializationAdapter<I> adapter, I input) throws IOException {
            int formatNumber = adapter.readInt(input);
            Versions.check(formatNumber, v_8_1_0, v_8_1_0);

            RemoteCommand<?> targetCommand  = RemoteCommand.deserialize(adapter, input);
            long desiredConfigurationVersion = adapter.readLong(input);
            return new CheckConfigurationVersionAndExecuteCommand<>(targetCommand, desiredConfigurationVersion);
        }

        @Override
        public <O> void serialize(SerializationAdapter<O> adapter, O output, CheckConfigurationVersionAndExecuteCommand<?> command, Version backwardCompatibilityVersion, Scope scope) throws IOException {
            adapter.writeInt(output, v_8_1_0.getNumber());

            RemoteCommand.serialize(adapter, output, command.targetCommand, backwardCompatibilityVersion, scope);
            adapter.writeLong(output, command.desiredConfigurationVersion);
        }

        @Override
        public int getTypeId() {
            return 42;
        }

        @Override
        public Class<CheckConfigurationVersionAndExecuteCommand<?>> getSerializedType() {
            return (Class) CheckConfigurationVersionAndExecuteCommand.class;
        }

        @Override
        public CheckConfigurationVersionAndExecuteCommand<?> fromJsonCompatibleSnapshot(Map<String, Object> snapshot) throws IOException {
            int formatNumber = readIntValue(snapshot, "version");
            Versions.check(formatNumber, v_8_1_0, v_8_1_0);

            RemoteCommand<?> targetCommand = RemoteCommand.fromJsonCompatibleSnapshot((Map<String, Object>) snapshot.get("targetCommand"));
            long desiredConfigurationVersion = readLongValue(snapshot, "desiredConfigurationVersion");
            return new CheckConfigurationVersionAndExecuteCommand<>(targetCommand, desiredConfigurationVersion);
        }

        @Override
        public Map<String, Object> toJsonCompatibleSnapshot(CheckConfigurationVersionAndExecuteCommand<?> command, Version backwardCompatibilityVersion, Scope scope) throws IOException {
            Map<String, Object> result = new HashMap<>();
            result.put("version", v_8_1_0.getNumber());
            result.put("targetCommand", RemoteCommand.toJsonCompatibleSnapshot(command.targetCommand, backwardCompatibilityVersion, scope));
            result.put("desiredConfigurationVersion", command.desiredConfigurationVersion);
            return result;
        }

        @Override
        public String getTypeName() {
            return "CheckConfigurationVersionAndExecuteCommand";
        }
    };

    @Override
    public boolean equalsByContent(CheckConfigurationVersionAndExecuteCommand<?> other) {
        return ComparableByContent.equals(targetCommand, other.targetCommand);
    }

    @Override
    public boolean isImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync) {
        return targetCommand.isImmediateSyncRequired(unsynchronizedTokens, nanosSinceLastSync);
    }

    @Override
    public long estimateTokensToConsume() {
        return targetCommand.estimateTokensToConsume();
    }

    @Override
    public long getConsumedTokens(T result) {
        return targetCommand.getConsumedTokens(result);
    }

    @Override
    public Version getRequiredVersion() {
        return Versions.max(v_8_1_0, targetCommand.getRequiredVersion());
    }

}

        if (!mutableEntry.exists()) {
            return CommandResult.bucketNotFound();
        }

        RemoteBucketState state = mutableEntry.get();
        Long actualConfigurationVersion = state.getConfigurationVersion();
        if (actualConfigurationVersion == null || actualConfigurationVersion < desiredConfigurationVersion) {
            return CommandResult.configurationNeedToBeReplaced();
        }

        return targetCommand.execute(mutableEntry, currentTimeNanos);
    
<no_super_class>