在Eclipse上,& quot;首选项-& gt;一般-& gt;工作区-& gt;使用本机挂钩或轮询刷新做? [英] On Eclipse, what does "Preferences -> General -> Workspace -> Refresh using native hooks or polling" do?

查看:42
本文介绍了在Eclipse上,& quot;首选项-& gt;一般-& gt;工作区-& gt;使用本机挂钩或轮询刷新做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse中有此复选框:

There is this check box on Eclipse:

首选项->常规->工作区->使用本机钩子或轮询刷新

Preferences -> General -> Workspace -> Refresh using native hooks or polling

Eclipse文档说:


如果打开此选项,则工作区资源将与相应的
同步。文件系统
中的资源会自动使用本地刷新提供程序(在Windows上)或轮询
机制。

If this option is turned on then the workspace resources will be synchronized with their corresponding resources in the file system automatically using native refresh providers (on Windows) or a polling mechanism.

从文档和复选框描述可以看出,Eclipse使用了某种OS挂钩来获取有关文件更改的通知。似乎该功能已在Windows之外的其他操作系统上使用轮询进行了仿真。

From the documentation and the check box description suggest that there is some sort of OS hook that Eclipse uses to get notifications about file changes. And it seems that this feature is emulated on OSes other than Windows using polling.

我的问题是:


  1. 这真的是Eclipse在做什么吗?我想知道是否通过选中此选项来让我的线程不断检查文件系统。我的文件从外部进行更改,但是一天要进行4次更改,并且要使此功能对程序员来说很好看,轮询必须每分钟左右检查一次文件系统。

  2. 确实如此仅在Windows上工作?如果我在Linux上使用Eclipse,那是否一定意味着Eclipse会进入轮询模式?

  3. 最后,更重要的是,如果Eclipse做到了,它将如何做到? JNI?


推荐答案

是的,这确实是Eclipse所做的。对于Mac或Linux,它当前使用轮询。

Yes, this is really what Eclipse is doing. For Mac or Linux it currently uses polling.

有一个扩展点 org.eclipse.core.resources.refreshProviders 可用于提供刷新每个平台的代码,人们已经为Mac和Linux编写了测试插件,但它们不在产品中(请参阅 https://bugs.eclipse.org/bugs/show_bug.cgi?id=108697 https://bugs.eclipse.org/bugs/show_bug.cgi?id=237344

There is an extension point org.eclipse.core.resources.refreshProviders that can be used to provide the refresh code for each platform and people have written test plugins for Mac and Linux but they are not in the product (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=108697 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=237344 )

来源这是 org.eclipse.core.internal.refresh.MonitorManager PollingMonitor 进行轮询刷新。

Source for this is org.eclipse.core.internal.refresh.MonitorManager, PollingMonitor does the polling refresh.

org.eclipse.core.internal.resources.refresh.win32.Win32RefreshProvider 会通过JNI使用本机方法刷新Windows(在Windows专用插件中。)

org.eclipse.core.internal.resources.refresh.win32.Win32RefreshProvider does the Windows refresh using native methods via JNI (it is in a Windows only plugin).

org.eclipse.core.internal.resources.refresh.win32.Win32Monitor Win32Natives 包含核心代码。

这篇关于在Eclipse上,& quot;首选项-& gt;一般-& gt;工作区-& gt;使用本机挂钩或轮询刷新做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆