private static NameValueCollection GetProps(SchedulerType type) { switch (type) { case SchedulerType.InMemory: return(new NameValueCollection { { "quartz.serializer.type", "binary" }, { "quartz.scheduler.instanceName", Guid.NewGuid().ToString() }, { "quartz.jobStore.type", "Quartz.Simpl.RAMJobStore, Quartz" }, { "quartz.threadPool.threadCount", _threadCount.ToString() } }); case SchedulerType.SqlServer: return(new NameValueCollection { { "quartz.serializer.type", "binary" }, { "quartz.scheduler.instanceName", Guid.NewGuid().ToString() }, { "quartz.jobStore.type", "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" }, { "quartz.jobStore.driverDelegateType", "Quartz.Impl.AdoJobStore.StdAdoDelegate" }, { "quartz.jobStore.tablePrefix", "QRTZ_" }, { "quartz.jobStore.dataSource", "default" }, { "quartz.dataSource.default.connectionString", _connectionString }, { "quartz.dataSource.default.provider", "SqlServer" }, { "quartz.jobStore.useProperties", "true" }, { "quartz.jobStore.lockHandler.type", "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" }, { "quartz.threadPool.threadCount", _threadCount.ToString() } }); default: throw new ArgumentException(type.ToString()); } }
private void Insert() { try { var schedulerType = new SchedulerType { Name = txtName.Text.Trim(), DisplayName = txtDisplayName.Text.Trim() }; if (!string.IsNullOrEmpty(txtDescription.Text)) { schedulerType.Description = txtDescription.Text.Trim(); } int status; if (int.TryParse(cbxSchedulerTypeStatus.SelectedItem.Value, out status)) { schedulerType.Status = (SchedulerTypeStatus)status; } schedulerType.Status = (SchedulerTypeStatus)status; SchedulerTypeServices.Create(schedulerType); wdTimeSheetRule.Hide(); } catch (Exception ex) { Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(ex.Message)); } }
/// <summary> /// Retrieves a given <see cref="TestScheduler"/> (and instantiates it, if required). /// </summary> /// <param name="type"> /// The type of the test scheduler. /// </param> /// <returns> /// An instance of the <see cref="TestScheduler"/> reserved for the usage as a scheduler of a <param name="type">specified type</param>. /// </returns> private TestScheduler RetrieveTestScheduler(SchedulerType type) { var index = (int)type; var retrieveTestScheduler = this.testSchedulers[index] ?? (this.testSchedulers[index] = new TestScheduler()); return(retrieveTestScheduler); }
/// <summary> /// pnl : 整個課表的 container /// schType : 課表類型 /// /// </summary> /// <param name="pnl"></param> /// <param name="schType"></param> public DecScheduler(DevComponents.DotNetBar.PanelEx pnl, SchedulerType schType) { this.pnlContainer = pnl; this.schType = schType; this.cells = new Dictionary<string, DevComponents.DotNetBar.PanelEx>(); this.decPeriods = new Dictionary<string, DecPeriod>(); this.headerCells = new Dictionary<string, DevComponents.DotNetBar.PanelEx>(); }
public Scheduler(long id, SchedulerType type, long franchiseId, TimeSpan interval, DateTime?startedAt, DateTime?lastRun) { Id = id; Type = type; FranchiseId = franchiseId; Interval = interval; StartedAt = startedAt; }
public void HandleStartEvent(string schedulerName, SchedulerType schedulerType, IntervalType intervalType, int interval, RepeatInterval repeatInterval = RepeatInterval.None, int repeatIntervalValue = 0) { ProcessTask(schedulerName); var delay = TimerHelper.Getinterval(intervalType, interval); var scheduler = _schedulerFactory.New(schedulerName, delay); AddEventHandler(scheduler, intervalType, repeatInterval, repeatIntervalValue); }
private Scheduler GetScheduler(string id, SchedulerType type, double interval) { return(new Scheduler { Id = id, Type = type, Timer = TimerHelper.GetTimer(interval) }); }
private Scheduler GetScheduler(string id, SchedulerType type, Timer timer) { return(new Scheduler { Id = id, Type = type, Timer = timer }); }
public static IScheduler Create(SchedulerType schedulerType) { switch (schedulerType) { case SchedulerType.RoundRobin: return new RoundRobinScheduler(); case SchedulerType.Priority: return null; default: throw new InvalidOperationException("Scheduler type cannot be created by factory"); } }
/// <summary> /// Create instance of write scheduler. /// </summary> /// <param name="schedulerType"></param> /// <returns></returns> static public IWriteScheduler CreateWriteScheduler(SchedulerType schedulerType) { // Create instance of scheduler: if (SchedulerType.Priority == schedulerType) { return(new Priority()); } else if (SchedulerType.RoundRobin == schedulerType) { return(new RoundRobin()); } throw new ArgumentException(String.Format("Invalid scheduler type \"{0}\"", schedulerType)); }
public static IScheduler Create(SchedulerType schedulerType) { switch (schedulerType) { case SchedulerType.RoundRobin: return(new RoundRobinScheduler()); case SchedulerType.Priority: return(null); default: throw new InvalidOperationException("Scheduler type cannot be created by factory"); } }
/// <summary> /// Creates the scheduler object. /// </summary> /// <param name="schedulerId">The scheduler identifier.</param> private void CreateSchedulerObject(SchedulerType schedulerId) { switch (schedulerId) { case SchedulerType.PullData: PullDataScheduler = new SchedulerViewModel (1, "PullData", "This scheduler is responsible to pull the data from cloud/ecommerce", TimeSpan.FromMinutes(1)); break; case SchedulerType.GetIds: GetIdsScheduler = new SchedulerViewModel (2, "GetIds", "This scheduler is responsible to get the modified ids from ERP to connector queue", TimeSpan.FromMinutes(1)); break; case SchedulerType.PushData: PushDataScheduler = new SchedulerViewModel (3, "PushData", "This scheduler is responsible to push the data from Connector queue to cloud/ecommerce", TimeSpan.FromMinutes(1)); break; case SchedulerType.PullResponse: PullResponseScheduler = new SchedulerViewModel (4, "PullResponse", "This scheduler is responsible to pull the responses from cloud/ecommerce", TimeSpan.FromMinutes(1)); break; case SchedulerType.CleanUp: CleanupScheduler = new SchedulerViewModel (5, "Cleanup", "This scheduler is responsible to clean up the data in the connector database and log files", new TimeSpan(1, 0, 0, 0)); break; } }
/// <summary> /// Run test program. /// </summary> /// <param name="program"></param> static void Run(SchedulerType schedulerType, string deviceFolder, int fileCount, int taskCount) { // Report program options Console.WriteLine("[{0}] pi scheduler type = {1}", DateTime.Now.ToFileTime(), schedulerType); Console.WriteLine("[{0}] pi device folder = {1}", DateTime.Now.ToFileTime(), deviceFolder); Console.WriteLine("[{0}] pi file count = {1}", DateTime.Now.ToFileTime(), fileCount); Console.WriteLine("[{0}] pm {1}kb", DateTime.Now.ToFileTime(), GC.GetTotalMemory(true) / 1024); FileGenerator fileGenerator = GetFileGenerator(); IWriteScheduler writeScheduler = CreateWriteScheduler(schedulerType); foreach (IDevice device in GetDevices(new DirectoryInfo(deviceFolder))) { Console.WriteLine("[{0}] pi register device {1}", DateTime.Now.ToFileTime(), device.Id); writeScheduler.Register(device); } // Test using sequential writes. Console.WriteLine("[{0}] pm {1}kb", DateTime.Now.ToFileTime(), GC.GetTotalMemory(true) / 1024); DisplayScheduler(writeScheduler); foreach (Tuple <string, byte[]> current in fileGenerator.GetFiles(fileCount)) { writeScheduler.Write(current.Item1, current.Item2); DisplayScheduler(writeScheduler); } Console.WriteLine("[{0}] pm {1}kb", DateTime.Now.ToFileTime(), GC.GetTotalMemory(true) / 1024); // Test using concurrent writes. Task[] tasks = new Task[taskCount]; for (int i = 0; i < tasks.Length; i++) { tasks[i] = new Task(() => { foreach (Tuple <string, byte[]> current in fileGenerator.GetFiles(fileCount)) { writeScheduler.Write(current.Item1, current.Item2); DisplayScheduler(writeScheduler); } }); tasks[i].Start(); } Task.WaitAll(tasks); }
public Domain() { Position = new Point(); Nodes = new List <Node>(); Type = DomainType.CSMA; BaseAddress = "10.0.0.0"; Model = MobilityModel.RandomWalk; XMin = -50; XMax = 50; YMin = -50; YMax = 50; DataRate = "10Mbps"; Delay = "40ms"; Standard = WifiStandard.IEEE80211a; Mode = WifiMode.Infrastructure; Scheduler = SchedulerType.Simple; if (CSMABackgroundBrush == null) { CSMABackgroundBrush = new SolidBrush(Color.FromArgb(064, 048, 128, 048)); } if (IEEE81211BackgroundBrush == null) { IEEE81211BackgroundBrush = new SolidBrush(Color.FromArgb(064, 064, 000, 128)); } if (LTEBackgroundBrush == null) { LTEBackgroundBrush = new SolidBrush(Color.FromArgb(064, 048, 048, 128)); } if (WimaxBackgroundBrush == null) { WimaxBackgroundBrush = new SolidBrush(Color.FromArgb(064, 128, 048, 048)); } if (TextBrush == null) { TextBrush = Brushes.Black; } }
public static async void AddQuartz(this IServiceCollection services, SchedulerType type, int threadCount, string connectionString = null) { _connectionString = connectionString; _threadCount = threadCount; NameValueCollection props = GetProps(type); var factory = new StdSchedulerFactory(props); var scheduler = await factory.GetScheduler(); services.AddSingleton <ISchedulerService, SchedulerService>(); services.AddSingleton(scheduler); var jobFactory = new IoCJobFactory(services.BuildServiceProvider()); scheduler.JobFactory = jobFactory; }
public Scheduler New(string id, SchedulerType schedulerType, IntervalType intervalType = IntervalType.Minutely, int interval = 1) { var delayInterval = TimerHelper.Getinterval(intervalType, interval); return(GetScheduler(id, schedulerType, delayInterval)); }
/* Constructor */ public DecPeriod(DevComponents.DotNetBar.PanelEx pnl, int colIndex, int rowIndex, SchedulerType schType) { this._pnl = pnl; this._schType = schType; this._colIndex = colIndex; this._rowIndex = rowIndex; /* this.pnlCover = new Panel(); this.pnlCover.Size = new Size(this._pnl.Size.Width-2, this._pnl.Size.Height-2); this.pnlCover.Location = new Point(1, 1); this.pnlCover.Click += new EventHandler(_pnl_Click); this.pnlCover.MouseEnter += new EventHandler(_pnl_MouseEnter); this.pnlCover.MouseLeave += new EventHandler(_pnl_MouseLeave); this.pnlCover.BackColor = Color.Yellow; this.pnlCover.BringToFront(); this._pnl.Controls.Add(this.pnlCover); */ /* 註冊事件 */ this._pnl.Click += new EventHandler(_pnl_Click); this._pnl.MouseEnter += new EventHandler(_pnl_MouseEnter); this._pnl.MouseLeave += new EventHandler(_pnl_MouseLeave); /* picBox */ this.picBox = new PictureBox(); Size s = new Size(16, 16); Point pt = new Point(this._pnl.Width - s.Width - 6, this._pnl.Height - s.Height - 6); this.picBox.Size = s; this.picBox.Location = pt; //this.picBox.Image = Properties.Resources.busy; this.picBox.SizeMode = PictureBoxSizeMode.StretchImage; this.picBox.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; this._pnl.Controls.Add(this.picBox); this.picBox.Click += new EventHandler(picBox_Click); /* 建立 label */ this.dicLables = new Dictionary<string, Label>(); int initX = 6; int initY = 6; int labelHeight = 20; for (int i = 0; i < 3; i++) { Label lbl = new Label(); lbl.Name = string.Format("label{0}", (i + 1).ToString()); lbl.Visible = true; lbl.Text = "This is :" + i.ToString(); Point p = new Point(initX, initY + i * labelHeight); lbl.Location = p; if (i == 0) this.lbl1 = lbl; else if (i == 1) this.lbl2 = lbl; else if (i == 2) this.lbl3 = lbl; lbl.Click += new EventHandler(_pnl_Click); lbl.MouseEnter += new EventHandler(lbl_MouseEnter); lbl.MouseLeave += new EventHandler(lbl_MouseLeave); /* * */ this.dicLables.Add(lbl.Name, lbl); this._pnl.Controls.Add(lbl); } }
/// <summary> /// Load command line options and return executable. /// </summary> /// <param name="program"></param> /// <param name="args"></param> /// <returns></returns> static Action BuildCommand(SchedulerType schedulerType, string deviceFolder, int fileCount, int taskCount, string[] args) { List <string> errorList = new List <string>(); for (int i = 0; i < args.Length; i += 2) { int j = i + 1; switch (args[i].ToLower()) { case "-?": case "-h": case "--help": return(() => DisplayHelp()); case "-d": case "--devices": if (j > args.Length) { errorList.Add("Missing devive folder"); } else if (!Directory.Exists(args[j])) { errorList.Add(String.Format("Invalid device folder : '{0}'", args[j])); } else { deviceFolder = args[j]; } break; case "-c": case "--count": if (j > args.Length) { errorList.Add("Missing file value"); } else if (!int.TryParse(args[j], out fileCount)) { errorList.Add(String.Format("Invalid file count specified: '{0}'", args[j])); } break; case "-t": case "--type": if (j > args.Length) { errorList.Add("Missing value for test type "); } else if (!Enum.TryParse <SchedulerType>(args[j], out schedulerType)) { errorList.Add(String.Format("Invalid test type specified: '{0}'.", args[j])); } break; default: errorList.Add(String.Format("Invalid option {0}", args[i])); i = args.Length; break; } } if (0 < errorList.Count()) { return(() => { DisplayError(errorList.ToArray()); DisplayHelp(); }); } return(() => Run(schedulerType, deviceFolder, fileCount, taskCount)); }
public Scheduler New(string id, double intervalDelay, SchedulerType type = SchedulerType.Parent) { return(GetScheduler(id, type, intervalDelay)); }
public WdScheduler(SchedulerType type) : this() { SchedulerType = type; }
public Scheduler New(string id, Timer timer, SchedulerType type = SchedulerType.Parent) { return(GetScheduler(id, type, timer)); }
/// <summary> /// Retrieves a given <see cref="TestScheduler"/> (and instantiates it, if required). /// </summary> /// <param name="type"> /// The type of the test scheduler. /// </param> /// <returns> /// An instance of the <see cref="TestScheduler"/> reserved for the usage as a scheduler of a <param name="type">specified type</param>. /// </returns> private TestScheduler RetrieveTestScheduler(SchedulerType type) { var index = (int)type; var retrieveTestScheduler = this.testSchedulers[index] ?? (this.testSchedulers[index] = new TestScheduler()); return retrieveTestScheduler; }
public SchedulersViewModel(SchedulerType schedulerId) { currentSchedulerId = schedulerId; CreateSchedulerObject(schedulerId); }
public WdScheduler(SchedulerType type, Expression <Func <bool> > condition) : this() { SchedulerType = type; StopCondition = condition; }
private void AdjustScheduleType() { if (this.mediumConfigurationList.Count == 0) { this.type = SchedulerType.Invalid; } else if (this.mediumConfigurationList.Count == 1) { switch (this.mediumConfigurationList[0].Type) { case CacheMediumType.File: this.type = SchedulerType.FileScheduler; break; case CacheMediumType.RAM: this.type = SchedulerType.RAMScheduler; break; default: throw new NotSupportedException(); } } else if (this.mediumConfigurationList.Count == 1) { this.type = SchedulerType.RAMFileScheduler; } else { throw new NotSupportedException(); } }
public SchedulerConfiguration() { this.type = SchedulerType.Invalid; this.mediumConfigurationList = new List<MediumConfiguration>(); }
/// <summary> /// Actor设置 /// </summary> /// <param name="maxQueueCount">限制最大队列的数量</param> /// <param name="sleepTime">多少毫秒秒没有订单沉睡</param> public ActorOptionAttribute(long maxQueueCount = 0, int ideltime = 5000, SchedulerType schedulerType = SchedulerType.None) { MaxQueueCount = maxQueueCount; Ideltime = ideltime; SchedulerType = schedulerType; }
/// <summary> /// Constructor /// </summary> /// <param name="masterNodeName">Master node name</param> /// <param name="schedulerType">Scheduler type</param> public SchedulerEndpoint(string masterNodeName, SchedulerType schedulerType) { MasterNodeName = masterNodeName; SchedulerType = schedulerType; }