Example #1
0
        private void OnShutdownEvent()
        {
            lock (request_lock)
                pending_request.Cleanup();

            try {
                ShutdownHook();
            } catch (Exception ex) {
                Logger.Log.Warn(ex, "Caught exception in shutdown hook");
            }
        }
Example #2
0
        public IndexerReceipt [] Flush(IndexerRequest request)
        {
            // If there isn't actually any work to do, just return
            // an empty array.
            if (request.IsEmpty)
            {
                return(new IndexerReceipt [0]);
            }

            // Iterate through the items in the IndexerRequest to
            // store the streams before passing them to the helper.
            foreach (Indexable indexable in request.Indexables)
            {
                if (indexable.Type == IndexableType.Add)
                {
                    indexable.StoreStream();
                }
            }

            RemoteIndexerRequest remote_request;

            remote_request = new RemoteIndexerRequest();
            remote_request.RemoteIndexName         = this.remote_index_name;
            remote_request.RemoteIndexMinorVersion = this.remote_index_minor_version;
            remote_request.Request = request;

            RemoteIndexerResponse response;

            response = SendRequest(remote_request);

            if (response == null)
            {
                Logger.Log.Error("Something terrible happened --- Flush failed");
                request.Cleanup();
                return(null);
            }

            last_item_count = response.ItemCount;

            return(response.Receipts);
        }
Example #3
0
		public IndexerReceipt [] Flush (IndexerRequest request)
		{
			// If there isn't actually any work to do, just return
			// an empty array.
			if (request.IsEmpty)
				return new IndexerReceipt [0];

			// Iterate through the items in the IndexerRequest to
			// store the streams before passing them to the helper.
			foreach (Indexable indexable in request.Indexables) {
				if (indexable.Type == IndexableType.Add)
					indexable.StoreStream ();
			}

			RemoteIndexerRequest remote_request;
			remote_request = new RemoteIndexerRequest ();
			remote_request.RemoteIndexName = this.remote_index_name;
			remote_request.RemoteIndexMinorVersion = this.remote_index_minor_version;
			remote_request.Request = request;
			
			RemoteIndexerResponse response;
			response = SendRequest (remote_request);

			if (response == null) {
				Logger.Log.Error ("Something terrible happened --- Flush failed");
				request.Cleanup ();
				return null;
			}
			
			last_item_count = response.ItemCount;

			return response.Receipts;
		}