小编Emi*_*l D的帖子

如何终止已使其调用堆栈损坏的.NET线程?

我的应用程序中有一个线程正在运行可能导致调用堆栈损坏的代码(我的应用程序是dll的测试工具).

假设我有一种检测子线程是否行为不正常的方法,我该如何终止它?从我读到的,在行为不当的线程上调用Thread.Abort()将等同于在其中引发异常.我担心这不是一个好主意,只要线程的调用堆栈可能已损坏.任何建议?

c# multithreading

5
推荐指数
1
解决办法
223
查看次数

在C#中以Process.Kill()终止进程的退出代码

如果在我的C#应用​​程序中,我正在创建一个可以正常终止或者开始行为不端的子进程,在这种情况下我通过调用Process.Kill()来终止它.但是,我想知道进程是否已经退出通常.我知道我可以获得已终止进程的错误代码,但是什么是正常的退出代码以及什么意味着该进程被杀死了?

c# exit-code kill-process

5
推荐指数
2
解决办法
7277
查看次数

如果调用堆栈被破坏,那只会崩溃当前线程还是整个应用程序?

当谈到C#中的线程时,我是一个菜鸟,我不确定每个线程是否应该有自己的调用堆栈?基本上,如果我得到"运行时检查失败#0 - ESP的值不正确",那只会崩溃它发生的线程,还是整个程序?

c# assembly multithreading callstack

4
推荐指数
1
解决办法
179
查看次数

C#继承字段

这可能是一个愚蠢的问题,但在这里它.想象你有以下类:

public class C
{
}

public class D : C
{
     //A subclass of C
}

public class A
{
    C argument;     
}
Run Code Online (Sandbox Code Playgroud)

现在,我希望有一个继承自A的类B.这个类显然会继承"参数"字段,但我希望强制B中的"参数"字段为D类,而不是C.Since D继承自C,这不应该造成任何问题.那么,如何在c#中实现这一目标?

c# inheritance

4
推荐指数
1
解决办法
6167
查看次数

CXF Web 服务限制

我是 CXF 的新手,我想知道它是否有任何内置机制可以限制对 Web 服务的并发调用数量,从而解决 DoS 攻击的可能性?与 WCF 的此功能类似的东西?

http://www.danrigsby.com/blog/index.php/2008/02/20/how-to-throttle-a-wcf-service-help-prevent-dos-attacks-and-maintain-wcf-scalability/

java security web-services cxf

4
推荐指数
1
解决办法
2197
查看次数

如何在自定义ASP.NET控件中使用ScriptManagerProxy?

基本上,我已经创建了一个使用UpdatePanel的自定义控件,据我所知,我需要使用ScriptManagerProxy使其工作(因为每页应该只有一个ScriptManager,并且在我的.aspx页面中声明).那么,你如何使用这个野兽,只需添加:

<asp:ScriptManagerProxy ID="ScriptManagerProxy3" runat="server">
</asp:ScriptManagerProxy>
Run Code Online (Sandbox Code Playgroud)

在你的控制下,还是有更多的东西?任何人都可以发布链接到一个很好的教程/示例集?我试着谷歌搜索,但我找不到任何有用的东西......

c# asp.net asp.net-ajax scriptmanager

3
推荐指数
1
解决办法
7453
查看次数

在 Akka Streams 中,Sink.fold() 处理序列化了吗?

我开始使用 Akka 流;我正在尝试创建一个从 Web 服务读取数据然后将它们保存在 S3 中的流。我想知道,如果我使用 Sink.fold 方法(为了收集有关持久化元素的信息)定义一个 Sink 用于持久化,发送到接收器的元素是一个接一个地处理,还是并行处理?

这是一个基本问题,但我无法在文档中找到明确的答案。

scala akka-stream

3
推荐指数
1
解决办法
1187
查看次数

UpdatePanel重新加载整个页面

我正在构建一个asp.net cutom控件,里面有两个下拉列表:companyIdSelection和productFamilySelection.I在Page_Load填充companyIdSelection,并根据companyIdSelection中的选定项填充productFamilySelection.我使用UpdatePanels来实现这一点,但由于某种原因每次我更新companyIdSelection Page_Load被调用(据我所知,只有在重新加载整个页面时才会发生),该列表将再次重新加载并且用户选择的项目将丢失(所选项目永远是最顶尖的.)这是代码

    <asp:UpdatePanel ID="updateFamilies" 
                     runat="server" 
                     UpdateMode="Always">           
        <ContentTemplate>
            Company ID:<br>
            <br></br>
            <asp:DropDownList ID="companyIdSelection" 
                              runat="server" 
                              AutoPostBack="True" 
                              OnSelectedIndexChanged="companyIdSelection_SelectedIndexChanged">
            </asp:DropDownList>
            <br></br>
            Product Family:
            <br></br>
            <asp:DropDownList ID="productFamilySelection" runat="server" 
                              AutoPostBack="True" 
                              onselectedindexchanged="productFamilySelection_SelectedIndexChanged">
            </asp:DropDownList>
            <br>
        </ContentTemplate>                 
    </asp:UpdatePanel>

protected void Page_Load(object sender, EventArgs e)
{
    this.companyIdSelection.DataSource = companyIds(); //companyIds returns the object containing the initial data items
    this.companyIdSelection.DataBind();
}

protected void companyIdSelection_SelectedIndexChanged(object sender, EventArgs e)
{
    // Page_Load is called again for some reason before this method is called, so it 
    // resets the companyIdSelection
    EngDbService s = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net updatepanel

1
推荐指数
1
解决办法
7573
查看次数

在Java中运行多个线程

我有一个非常奇怪的问题.我正在进行一项任务,包括建立一个在2d"棋盘"上移动的数字模拟.每个图由实现Runnable接口的对象表示.问题是,当我尝试在不同的线程中运行每个对象时,如下所示:

    ArrayList< Thread > playerThreads = new ArrayList< Thread >();
    ArrayList< Player > players = p.getSpawnedPlayers(); // This method returns all Runnable objects
    for ( Player pl : players )
        playerThreads.add( new Thread( pl ) );

    for ( Thread pt : playerThreads )
    {
        pt.run();
    }
Run Code Online (Sandbox Code Playgroud)

出于某种原因,只有第一个线程开始.我很确定这一点,播放器类的run()方法如下所示:

public void run()
{
    System.out.println( "Player " + this.hashCode() + " starts moving..." );
    ...
}
Run Code Online (Sandbox Code Playgroud)

我只从单个对象获得输出.我进行了双重检查并确保两个ArrayLists都包含正确数量的对象.知道为什么会这样吗?

java multithreading runnable

1
推荐指数
1
解决办法
909
查看次数