/// <summary>Starts the reloader thread.</summary>
 public void Init()
 {
     reloader = new Thread(this, "Truststore reloader thread");
     reloader.SetDaemon(true);
     running = true;
     reloader.Start();
 }
 internal MetricsSinkAdapter(string name, string description, MetricsSink sink, string
                             context, MetricsFilter sourceFilter, MetricsFilter recordFilter, MetricsFilter
                             metricFilter, int period, int queueCapacity, int retryDelay, float retryBackoff,
                             int retryCount)
 {
     this.name         = Preconditions.CheckNotNull(name, "name");
     this.description  = description;
     this.sink         = Preconditions.CheckNotNull(sink, "sink object");
     this.context      = context;
     this.sourceFilter = sourceFilter;
     this.recordFilter = recordFilter;
     this.metricFilter = metricFilter;
     this.period       = Contracts.CheckArg(period, period > 0, "period");
     firstRetryDelay   = Contracts.CheckArg(retryDelay, retryDelay > 0, "retry delay");
     this.retryBackoff = Contracts.CheckArg(retryBackoff, retryBackoff > 1, "retry backoff"
                                            );
     oobPutTimeout = (long)(firstRetryDelay * Math.Pow(retryBackoff, retryCount) * 1000
                            );
     this.retryCount = retryCount;
     this.queue      = new SinkQueue <MetricsBuffer>(Contracts.CheckArg(queueCapacity, queueCapacity
                                                                        > 0, "queue capacity"));
     latency = registry.NewRate("Sink_" + name, "Sink end to end latency", false);
     dropped = registry.NewCounter("Sink_" + name + "Dropped", "Dropped updates per sink"
                                   , 0);
     qsize      = registry.NewGauge("Sink_" + name + "Qsize", "Queue size", 0);
     sinkThread = new _Thread_86(this);
     sinkThread.SetName(name);
     sinkThread.SetDaemon(true);
 }
Beispiel #3
0
        private Thread ThreadFor(string threadName, IRunnable task)
        {
            Thread thread = new Thread(new _IRunnable_41(this, task), threadName);

            thread.SetDaemon(true);
            return(thread);
        }
 public CatchAllThread(ICodeBlock codeBlock)
 {
     _thread = new Thread(new _IRunnable_126(this), "NetworkSocketTestCase.CatchAllThread"
                          );
     _thread.SetDaemon(true);
     _codeBlock = codeBlock;
 }
Beispiel #5
0
		public Thread NewThread (IRunnable r)
		{
			Thread t = new Thread (r);
			t.SetDaemon (true);
			t.Start ();
			return t;
		}
        public Thread NewThread(IRunnable r)
        {
            Thread t = new Thread(r);

            t.SetDaemon(true);
            t.Start();
            return(t);
        }
Beispiel #7
0
 internal StreamPumper(Log log, string logPrefix, InputStream stream, StreamPumper.StreamType
                       type)
 {
     this.log       = log;
     this.logPrefix = logPrefix;
     this.stream    = stream;
     this.type      = type;
     thread         = new Thread(new _Runnable_53(this, logPrefix, type), logPrefix +
                                 ": StreamPumper for " + type);
     thread.SetDaemon(true);
 }
Beispiel #8
0
 /// <summary>Start the disk usage checking thread.</summary>
 public virtual void Start()
 {
     //only start the thread if the interval is sane
     if (refreshInterval > 0)
     {
         refreshUsed = new Thread(new DU.DURefreshThread(this), "refreshUsed-" + dirPath
                                  );
         refreshUsed.SetDaemon(true);
         refreshUsed.Start();
     }
 }
        /// <exception cref="System.Exception"></exception>
        public virtual void TestIsAliveInMultiThread()
        {
            IBlockingQueue4 barrier = new BlockingQueue();

            client = (ClientObjectContainer)OpenNewSession();
            client.MessageListener(new _IMessageListener_23(this, barrier));
            Thread workThread = new Thread(new _IRunnable_38(), "Quering");

            workThread.SetDaemon(true);
            workThread.Start();
            barrier.Next();
            client.IsAlive();
        }
 /// <exception cref="System.IO.IOException"/>
 public DomainSocketWatcher(int interruptCheckPeriodMs, string src)
 {
     watcherThread = new Thread(new _Runnable_451(this));
     if (loadingFailureReason != null)
     {
         throw new NotSupportedException(loadingFailureReason);
     }
     Preconditions.CheckArgument(interruptCheckPeriodMs > 0);
     this.interruptCheckPeriodMs = interruptCheckPeriodMs;
     notificationSockets         = DomainSocket.Socketpair();
     watcherThread.SetDaemon(true);
     watcherThread.SetName(src + " DomainSocketWatcher");
     watcherThread.SetUncaughtExceptionHandler(new _UncaughtExceptionHandler_252());
     watcherThread.Start();
 }
 /// <summary>Start a reconfiguration task to reload configuration in background.</summary>
 /// <exception cref="System.IO.IOException"/>
 public virtual void StartReconfigurationTask()
 {
     lock (reconfigLock)
     {
         if (!shouldRun)
         {
             string errorMessage = "The server is stopped.";
             Log.Warn(errorMessage);
             throw new IOException(errorMessage);
         }
         if (reconfigThread != null)
         {
             string errorMessage = "Another reconfiguration task is running.";
             Log.Warn(errorMessage);
             throw new IOException(errorMessage);
         }
         reconfigThread = new ReconfigurableBase.ReconfigurationThread(this);
         reconfigThread.SetDaemon(true);
         reconfigThread.SetName("Reconfiguration Task");
         reconfigThread.Start();
         startTime = Time.Now();
     }
 }
Beispiel #12
0
        /// <exception cref="WinrtCifs.Util.Transport.TransportException"></exception>
        public virtual void Connect(long timeout)
        {
            lock (this)
            {
                try
                {
                    switch (State)
                    {
                    case 0:
                    {
                        break;
                    }

                    case 3:
                    {
                        return;
                    }

                    case 4:
                    {
                        // already connected
                        State = 0;
                        throw new TransportException("Connection in error", Te);
                    }

                    default:
                    {
                        //TransportException te = new TransportException("Invalid state: " + state);
                        State = 0;
                        throw new TransportException("Invalid state: " + State);
                    }
                    }
                    State  = 1;
                    Te     = null;
                    Thread = new Thread(this);
                    Thread.SetDaemon(true);
                    lock (Thread)
                    {
                        Thread.Start();
                        Runtime.Wait(Thread, timeout);
                        switch (State)
                        {
                        case 1:
                        {
                            State  = 0;
                            Thread = null;
                            throw new TransportException("Connection timeout");
                        }

                        case 2:
                        {
                            if (Te != null)
                            {
                                State  = 4;
                                Thread = null;
                                throw Te;
                            }
                            State = 3;
                            return;
                        }
                        }
                    }
                }
                catch (Exception ie)
                {
                    State  = 0;
                    Thread = null;
                    throw new TransportException(ie);
                }
                finally
                {
                    if (State != 0 && State != 3 && State != 4)
                    {
                        if (Log.Level >= 1)
                        {
                            Log.WriteLine("Invalid state: " + State);
                        }
                        State  = 0;
                        Thread = null;
                    }
                }
            }
        }