Ejemplo n.º 1
0
            public override void Run()
            {
                try
                {
                    long count = 0;
                    long miss  = 0;
                    long hit   = 0;
                    int  limit = objs.Length;

                    while (true)
                    {
                        CloneableObject obj = objs[(int)((count / 2) % limit)];
                        object          v   = c.Get(obj);
                        if (v == null)
                        {
                            c.Put(new CloneableObject(obj), obj);
                            miss++;
                        }
                        else
                        {
                            Assert.True(obj == v);
                            hit++;
                        }
                        if ((++count % 10000) == 0)
                        {
                            if (DateTime.Now.CompareTo(endTime) > 0)
                            {
                                break;
                            }
                        }
                    }

                    outerInstance.AddResults(miss, hit);
                }
                catch (Exception t)
                {
                    failed = true;
                    throw new Exception(t.Message, t);
                }
            }
Ejemplo n.º 2
0
            public override void Run()
            {
                try
                {
                    long count = 0;
                    long miss  = 0;
                    long hit   = 0;
                    int  limit = objs.Length;

                    while (true)
                    {
                        CloneableObject obj = objs[(int)((count / 2) % limit)];
                        object          v   = c.Get(obj);
                        if (v == null)
                        {
                            c.Put(new CloneableObject(obj), obj);
                            miss++;
                        }
                        else
                        {
                            Assert.True(obj == v);
                            hit++;
                        }
                        if ((++count % 10000) == 0)
                        {
                            if (J2N.Time.NanoTime() / J2N.Time.MillisecondsPerNanosecond > endTime) // LUCENENET: Use NanoTime() rather than CurrentTimeMilliseconds() for more accurate/reliable results
                            {
                                break;
                            }
                        }
                    }

                    outerInstance.AddResults(miss, hit);
                }
                catch (Exception t) when(t.IsThrowable())
                {
                    failed = true;
                    throw RuntimeException.Create(t);
                }
            }