コード例 #1
0
        private MethodInfo InitTaskExecute(MapReduceTask task, out object dictMap)
        {
            IDictionary tmpdict;

            task.FindTypesMap(out miMap, out dictMap, out mapper);
            task.FindTypesReduce(out miRed, out tmpdict, out reducer);
            task.ReduceResult = tmpdict;

            MethodInfo miExecuteGeneric = task.GetType().GetMethod("ExecuteMapReduce", BindingFlags.NonPublic | BindingFlags.Instance);

            ParameterInfo[] mapParams       = mapper.GetType().GetMethod("Map").GetParameters();
            Type[]          collectorParams = mapParams[2].ParameterType.GetGenericArguments();

            ParameterInfo[] reduceParams = reducer.GetType().GetMethod("Reduce").GetParameters();


            MAPKEY          = mapParams[0].ParameterType;
            MAPVALUE        = mapParams[1].ParameterType;
            REDUCEKEY       = collectorParams[0];
            REDUCEVALUE     = collectorParams[1];
            REDUCEDNEWVALUE = reduceParams[2].ParameterType;

            MethodInfo miExecute = miExecuteGeneric.MakeGenericMethod(new[] { MAPKEY, MAPVALUE, REDUCEKEY, REDUCEVALUE, REDUCEDNEWVALUE });

            return(miExecute);
        }
コード例 #2
0
        private MethodInfo InitTaskExecute(MapReduceTask task, out object dictMap)
        {
            IDictionary tmpdict;

            task.FindTypesMap(out _miMap, out dictMap, out _mapper);
            task.FindTypesReduce(out _miRed, out tmpdict, out _reducer);
            task.ReduceResult = tmpdict;

            MethodInfo miExecuteGeneric = task.GetType().GetMethod("ExecuteMapReduce", BindingFlags.NonPublic | BindingFlags.Instance);

            ParameterInfo[] mapParams       = _mapper.GetType().GetMethod("Map").GetParameters();
            Type[]          collectorParams = mapParams[2].ParameterType.GetGenericArguments();

            ParameterInfo[] reduceParams = _reducer.GetType().GetMethod("Reduce").GetParameters();


            _mapkey          = mapParams[0].ParameterType;
            _mapvalue        = mapParams[1].ParameterType;
            _reducekey       = collectorParams[0];
            _reducevalue     = collectorParams[1];
            _reducednewvalue = reduceParams[2].ParameterType;

            MethodInfo miExecute = miExecuteGeneric.MakeGenericMethod(new[] { _mapkey, _mapvalue, _reducekey, _reducevalue, _reducednewvalue });

            return(miExecute);
        }