- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们一直在使用 Quartz.net 项目来控制我们的一项 Windows 服务中的计划任务。我们已经使用它一段时间了,没有任何问题,但我们最近注意到 .NET CLR LocksAndThreads 存在问题。
请参阅此用 C# 编写的示例命令行应用程序。
using System;
using Quartz;
using Quartz.Impl;
namespace QuartzMemTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Quartz Test");
Console.WriteLine("-----------");
Console.WriteLine(Environment.NewLine);
ScheduleHelper.ScheduleJob(typeof(MyTask), "MyJobName", "MyTriggerName", "0 0/01 * 1/1 * ? *");
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
public class ScheduleHelper
{
/// <summary>
/// Adds a job to the Quartz schedule
/// </summary>
/// <param name="job">The Job class which inherits from the Quartz.IJob interface</param>
/// <param name="jobName">A name to give to the job</param>
/// <param name="triggerName">A name to give to the trigger</param>
/// <param name="triggerCronExpression">CRON expression to determine the job run interval</param>
public static DateTime ScheduleJob(Type job, string jobName, string triggerName, string triggerCronExpression)
{
// Start the scheduler to run our ImportOpportunitiesJob
ISchedulerFactory schedFact = new StdSchedulerFactory();
IScheduler sched = schedFact.GetScheduler();
sched.Start();
// Create an instance of our job
JobDetail jobDetail = new JobDetail(jobName, null, job);
// Create a CRON trigger which determines the firing interval
CronTrigger trigger = new CronTrigger();
trigger.Name = triggerName;
trigger.StartTimeUtc = DateTime.UtcNow;
trigger.CronExpressionString = triggerCronExpression;
// Add job and trigger to the schedule
return sched.ScheduleJob(jobDetail, trigger);
}
}
public class MyTask : IStatefulJob
{
public void Execute(JobExecutionContext job)
{
Console.WriteLine("MyTask: Doing something....");
}
}
}
我们注意到,如果我们先启动性能监视器,然后运行上面的示例代码,我们可以看到 .NET CLR LocksAndThreads 突然开始增加,并持续增加,直到应用程序停止。我的一位同事在我们的一个实时服务器因资源耗尽而崩溃后首先注意到了这一点。
是 Quarts 导致了这个还是我在做什么蠢事?如果是 Quartz,我能做些什么来解决这个问题?
最佳答案
我们在我从事的一个 quartz.net 项目中遇到了类似的问题。我们发现,在某些情况下,线程池有时会泄漏资源并且无法正确清理自身。我最终实现了一个新的线程池,它具有更好的锁定和作业实际完成时间的通知。这为我们解决了这个问题。
关于c# - Quartz.net 导致 .NET CLR LocksAndThreads,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6734207/
我了解堆栈和堆的基本概念,但如果有任何一个可以解决以下困惑,那就太好了: 是否为整个应用程序流程或项目中开始的每个线程都创建了一个新堆栈? 是否为整个应用程序进程或项目中开始的每个线程都创建了一个新堆
我已经阅读了无数关于 C# 4.0 新特性的博客、帖子和 StackOverflow 问题。甚至新的 WPF 4.0 功能也开始公开发布。我找不到并且想知道的: 从 C#/WPF 开发人员的角度来看,
最近,我的 asp.net 应用程序崩溃了。我在 Windows 上获得了事件日志,两种类型的异常消息: Application: w3wp.exe Framework Version: v4.0.3
我了解当前状态的 CLR 绑定(bind)到 Windows 操作系统,并通过在内部使用 Win32 API 提供各种服务。 由于 .NET Core 是独立于平台的,这基本上意味着相同的 IL 代码
AFAIK,try 和 finally block 用于执行一段可能会抛出一些异常的代码,我们还添加了 catch block ,如果我们准备处理某种类型的异常和/或将它们排除在外,比如 FileIO
问题: 线程中的未处理异常进入 CLR来自非托管代码不会触发“正常”未处理的异常 CLR 处理。 在下面的代码中,使用 C++ 调用 CSSimpleObject.GetstringLength()
JVM/CLR 如何执行 JIT 编译的原生代码?是通过一些代码注入(inject)还是通过将代码复制到可执行内存?允许动态代码执行的系统调用是什么? 最佳答案 我可以在 CACAO VM 中解释我们
我从事的项目需要 .Net 与非托管代码的互操作性。几周前我开始使用 .Net,虽然我在 C/C++ 方面有很多经验,但我很惊讶 CLR 如何处理 P/Invoke。这是详细信息。我的同事写了这个函数
在哪里可以找到 ODP 到 CLR 类型映射的列表?在 Oracle 数据库上,NUMBER(9,0) 类型在 .NET 应用程序中作为 MS Oracle 驱动程序的 System.Decimal
我有一个 Ubuntu 12.04。我尝试在我的 python 代码中导入 clr,但出现此错误。 我浏览了链接。但这一切都是徒劳的。有没有办法检查“clr”存在?如何查看模块是否存在? 最佳答案 您
我提到了 this somewhat similar question在问这个之前,但无法解决我的问题 我正在查看一个包含许多解决方案的旧应用程序。问题发生在其中一个解决方案中(比如 S)。这是情况:
假设我有一个旧的应用程序,它将尝试加载外部程序集。 旧应用程序编译为 CLR 2。 新程序集编译为 CLR 4。 我希望能够在 CLR 4 中运行那个旧应用程序。我记得有一些 xml manifest
我可以编写、编译并成功运行以下 IL 程序,并将 .maxstack 大小设置为 1,该值太低,因为该程序在某个时间点堆栈上有两个值(即 2+2==4) 。该程序不会在 CLR 中崩溃,并以“Hell
.Core CLR 与 Mono CLR 有什么区别?那么微软为什么要维护不同的运行时环境呢? 最佳答案 两者都是 .NET Standard 的实现,但它们具有不同的实现细节。 Mono从历史上看,
我正在尝试使用以下配置创建一个 Visual C++ Win32 控制台应用程序:操作系统:Windows 7 Visual Studio :VS 2012公共(public)语言运行时支持:公共(p
// This is the main DLL file. #include "stdafx.h" #include "Tga2DCLI.h" //#include #include Tga2DC
我有两个项目的解决方案。第一个是基本类库项目,其中包含在多个服务端点 (DataContract.dll) 之间共享的类的定义。第二个是将使用共享程序集中定义的类的 SQL CLR 项目。在我的本地机
我尝试创建一个使用 Windows 窗体的 .NET 控制台应用程序来创建和保存屏幕截图。在创建新的控制台应用程序项目时,我尝试使用 COM 引用通过依赖项导入 System.Windows.Form
DOS 变成 Windows 的方式是一样的吗? 我们似乎最终支持和开发了 Microsoft 的三个平台,我不确定边界应该在哪里。 为什么不能将 CLR 的好处(例如类型安全、内存保护等)内置到 W
在 VC++ .Net 中,Clr/Safe (/clr:safe) 和 Clr/Pure (/clr:pure) 是什么意思? 最佳答案 来自doc : /clr:pure Produces a M
我是一名优秀的程序员,十分优秀!