// expected because the old active will be unable to flush the
        // end-of-segment op since it is fenced
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        /// <exception cref="Org.Apache.Hadoop.Hdfs.Inotify.MissingEventsException"/>
        public virtual void TestReadEventsWithTimeout()
        {
            Configuration    conf    = new HdfsConfiguration();
            MiniQJMHACluster cluster = new MiniQJMHACluster.Builder(conf).Build();

            try
            {
                cluster.GetDfsCluster().WaitActive();
                cluster.GetDfsCluster().TransitionToActive(0);
                DFSClient client = new DFSClient(cluster.GetDfsCluster().GetNameNode(0).GetNameNodeAddress
                                                     (), conf);
                DFSInotifyEventInputStream eis = client.GetInotifyEventStream();
                ScheduledExecutorService   ex  = Executors.NewSingleThreadScheduledExecutor();
                ex.Schedule(new _Runnable_463(client), 1, TimeUnit.Seconds);
                // test will fail
                // a very generous wait period -- the edit will definitely have been
                // processed by the time this is up
                EventBatch batch = eis.Poll(5, TimeUnit.Seconds);
                NUnit.Framework.Assert.IsNotNull(batch);
                NUnit.Framework.Assert.AreEqual(1, batch.GetEvents().Length);
                NUnit.Framework.Assert.IsTrue(batch.GetEvents()[0].GetEventType() == Event.EventType
                                              .Create);
                NUnit.Framework.Assert.AreEqual("/dir", ((Event.CreateEvent)batch.GetEvents()[0])
                                                .GetPath());
            }
            finally
            {
                cluster.Shutdown();
            }
        }
Ejemplo n.º 2
0
 private void ScheduleWithDelay(int suggestedDelay)
 {
     Log.V(Log.TagSync, "%s: scheduleWithDelay called with delay: %d ms", this, suggestedDelay
           );
     if (scheduled && (suggestedDelay < scheduledDelay))
     {
         Log.V(Log.TagSync, "%s: already scheduled and: %d < %d --> unscheduling", this, suggestedDelay
               , scheduledDelay);
         Unschedule();
     }
     if (!scheduled)
     {
         Log.V(Log.TagSync, "not already scheduled");
         scheduled      = true;
         scheduledDelay = suggestedDelay;
         Log.V(Log.TagSync, "workExecutor.schedule() with delay: %d ms", suggestedDelay);
         flushFuture = workExecutor.Schedule(processNowRunnable, suggestedDelay, TimeUnit.
                                             Milliseconds);
     }
 }
Ejemplo n.º 3
0
 private void ScheduleWithDelay(int suggestedDelay)
 {
     Log.D(Database.Tag, "scheduleWithDelay called with delay: " + suggestedDelay + " ms"
           );
     if (scheduled && (suggestedDelay < scheduledDelay))
     {
         Log.D(Database.Tag, "already scheduled and : " + suggestedDelay + " < " + scheduledDelay
               + " --> unscheduling");
         Unschedule();
     }
     if (!scheduled)
     {
         Log.D(Database.Tag, "not already scheduled");
         scheduled      = true;
         scheduledDelay = suggestedDelay;
         Log.D(Database.Tag, "workExecutor.schedule() with delay: " + suggestedDelay + " ms"
               );
         flushFuture = workExecutor.Schedule(processNowRunnable, suggestedDelay, TimeUnit.
                                             Milliseconds);
     }
 }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
//ORIGINAL LINE: public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
            public virtual ScheduledFuture <?> Schedule(Runnable command, long delay, TimeUnit unit)
            {
                return(e.Schedule(command, delay, unit));
            }