예제 #1
0
 internal void StartAccumulatorServer()
 {
     if (accumulatorServer == null)
     {
         accumulatorServer = new AccumulatorServer();
         int port = accumulatorServer.StartUpdateServer();
         SparkContextProxy.Accumulator(port);
     }
 }
예제 #2
0
        /// <summary>
        /// Create an L{Accumulator} with the given initial value, using a given
        /// L{AccumulatorParam} helper object to define how to add values of the
        /// data type if provided. Default AccumulatorParams are used for integers
        /// and floating-point numbers if you do not provide one. For other types,
        /// a custom AccumulatorParam can be used.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value"></param>
        /// <returns></returns>
        public Accumulator <T> Accumulator <T>(T value)
        {
            if (accumulatorServer == null)
            {
                accumulatorServer = new AccumulatorServer();
                int port = accumulatorServer.StartUpdateServer();

                SparkContextProxy.Accumulator(port);
            }
            return(new Accumulator <T>(nextAccumulatorId++, value));
        }