예제 #1
0
파일: StreamWriter.cs 프로젝트: xyuan/Dryad
        public async void Start()
        {
            try
            {
                error = await Open();

                if (error != null)
                {
                    errorType = ErrorType.Open;
                }
            }
            catch (Exception e)
            {
                log.LogError("Got exception opening stream " + e.ToString());
                error     = e.Message;
                errorType = ErrorType.Open;
            }

            log.LogInformation("About to await writes");

            await WriteAll();

            log.LogInformation("Writes done: setting finish");

            finished.RunSynchronously();
        }
예제 #2
0
        public void WaitForDrain()
        {
            try
            {
                finished.Wait();
            }
            catch (Exception e)
            {
                log.LogError("Caught exception from reader " + e.ToString());
            }

            log.LogInformation("Reader " + this.Source.AbsoluteUri + " finished");

            finished = null;
        }
예제 #3
0
 public static IManagedWriter OpenWriter(string path, int numberOfWriters, IWriterClient client, IDrLogging logger)
 {
     try
     {
         HttpClient.Initialize(logger);
         var uri = new Uri(path);
         return(writers[uri.Scheme](uri, numberOfWriters, client, logger));
     }
     catch (Exception e)
     {
         DryadLogger l = new DryadLogger(logger);
         l.LogError("Caught exception opening writer " + e.ToString());
         return(null);
     }
 }
예제 #4
0
 public static IManagedWriter OpenWriter(string path, int numberOfWriters, IWriterClient client, IDrLogging logger)
 {
     try
     {
         HttpClient.Initialize(logger);
         var uri = new Uri(path);
         return writers[uri.Scheme](uri, numberOfWriters, client, logger);
     }
     catch (Exception e)
     {
         DryadLogger l = new DryadLogger(logger);
         l.LogError("Caught exception opening writer " + e.ToString());
         return null;
     }
 }