private IndexWriter CreateWriterNoTry(Directory d, Analyzer a) { var indexExists = IndexExists(); logger.Info("Creating index writer, indexExists=" + indexExists); var iw = new IndexWriter(d, a, create: !indexExists, mfl: IndexWriter.MaxFieldLength.UNLIMITED); iw.WriteLockTimeout = LockTimeout; return(iw); }
/// <summary>Builds a configuration and returns a new <see cref="NHibernate.ISessionFactory"/></summary> /// <returns>A new <see cref="NHibernate.ISessionFactory"/>.</returns> public ISessionFactory BuildSessionFactory() { logger.Info("Building Configuration"); var cfg = BuildConfiguration(); logger.Info("Building Session Factory"); var sf = cfg.BuildSessionFactory(); logger.Info("Built Session Factory"); return(sf); }
public void Initialize() { _logger.Info("Starting..."); Map = new World.Chunk(); Player = new Entity.Player(); Players = new Dictionary <long, Entity.Player>(); NetPeerConfiguration config = new NetPeerConfiguration(Properties.Resources.Title); config.ConnectionTimeout = 10; config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated); _client = new NetClient(config); _client.Start(); _logger.Info("Started."); }
public virtual void Clear() { logger.Info("Clearing index"); if (accessor.IndexExists()) { accessor.ClearLock(); using (var iw = accessor.GetWriter()) { if (iw.NumDocs() > 0) { iw.DeleteAll(); iw.PrepareCommit(); iw.Commit(); accessor.RecreateSearcher(); } } accessor.ClearLock(); } }
/// <summary>Executes the supplied command</summary> /// <param name="command">The command to execute.</param> /// <param name="context">The context passed to the command</param> public virtual void Execute(CommandBase <CommandContext> command, CommandContext context) { var args = new CommandProcessEventArgs { Command = command, Context = context }; if (CommandExecuting != null) { CommandExecuting.Invoke(this, args); } logger.Info(args.Command.Name + " processing " + args.Context); using (var tx = persister.Repository.BeginTransaction()) { try { args.Command.Process(args.Context); Utility.FindEmpty(args.Context.Content); tx.Commit(); if (CommandExecuted != null) { CommandExecuted.Invoke(this, args); } } catch (StopExecutionException) { tx.Rollback(); } catch (Exception ex) { tx.Rollback(); logger.Error(ex); throw; } finally { logger.Info(" -> " + args.Context); } } }
public void Initialize() { _logger.Info("Starting..."); _map = new World.Chunk(); _map.GenerateRandom(); _connections = new Dictionary <long, Networking.ServerConnection>(); NetPeerConfiguration config = new NetPeerConfiguration(Properties.Resources.Title); config.Port = 12345; config.EnableUPnP = true; config.ConnectionTimeout = 10; _server = new NetServer(config); _server.Start(); _thread = new Thread(ServerThread); _thread.Start(); _logger.Info("Started."); }
public override void StartComponents() { logger.Info("Start startable components"); container.AddFacility <StartableFacility>(); foreach (var startable in container.ResolveAll <IAutoStart>()) { startable.Start(); } container.Kernel.ComponentCreated += new ComponentInstanceDelegate(Kernel_ComponentCreated); }
/// <summary>Executes the scheduled actions that are scheduled for executions.</summary> public void ExecutActions() { if (!enabled) { return; } if (Debugger.IsAttached && !runWhileDebuggerAttached) { return; } for (int i = 0; i < actions.Count; i++) { ScheduledAction action = actions[i]; if (action.ShouldExecute()) { Action work = delegate { try { // Default to en-us unless specified explicitly, avoid exception on "auto" Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us"); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; var config = ((System.Web.Configuration.GlobalizationSection)System.Configuration.ConfigurationManager.GetSection("system.web/globalization")); if (!string.IsNullOrEmpty(config.Culture) && !config.Culture.Equals("auto")) { Thread.CurrentThread.CurrentCulture = new CultureInfo(config.Culture); } else if (!string.IsNullOrEmpty(config.UICulture) && !config.Culture.Equals("auto")) { Thread.CurrentThread.CurrentUICulture = new CultureInfo(config.UICulture); } } catch (Exception ex) { logger.Warn(ex); } try { logger.Info(">>> Scheduled Task " + action.GetType().Name); action.Engine = engine; action.Execute(); action.ErrorCount = 0; } catch (Exception ex) { action.ErrorCount++; action.OnError(ex); // wayne: call custom action error handler } finally { try { IClosable closable = action as IClosable; if (closable != null) { closable.Dispose(); } } catch (Exception ex) { errorHandler.Notify(ex); } logger.Info("<<< Scheduled Task Ended " + action.GetType().Name); } action.LastExecuted = Utility.CurrentTime(); action.IsExecuting = false; try { context.Close(); } catch (Exception ex) { errorHandler.Notify(ex); } }; action.IsExecuting = true; if (asyncActions) { worker.DoWork(work); } else { work(); } if (action.Repeat == Repeat.Once) { actions.RemoveAt(i); --i; } } } }