在调用wait()之前调用锁对象的notify()是否可以?(Is it okay to call notify() on a lock object before calling wait() on it?)
我在我的代码中使用wait()和notify(),并且有一种情况,在另一个线程的锁对象上实际调用等待之前,执行可以先到达notify()。 我在锁对象中创建了一个“isWaitCalled”标志,并且如果wait()没有被调用,就使用它跳过notify()调用。 这个标志“isWaitCalled”是多余的吗? 在等待其中一个场景之前调用notify()是否可以? 主题A:
synchronized (syncObject) { try { if (!syncObject.isLoadComplete) { syncObject.isWaitCalled = true; syncObject.wait(); } } catch (Exception ex) { } }
ThreadB:
synchronized (syncObject) { try { if (!syncObject.isLoadComplete) { syncObject.isLoadComplete =true; if (syncObject.isWaitCalled) { syncObject.notify(); } } } catch (Exception ex) { } }
I am using wait() and notify() in my code and there is a scenario where the execution can reach notify() first before a wait is actually called on the lock object on another thread. I created a flag "isWaitCalled" in the lock object and using it to skip notify() call if wait() is not called already. Is this flag "isWaitCalled" redundant? Is it okay if notify() is called before wait in one of the scenarios? Thread A:
synchronized (syncObject) { try { if (!syncObject.isLoadComplete) { syncObject.isWaitCalled = true; syncObject.wait(); } } catch (Exception ex) { } }
ThreadB:
synchronized (syncObject) { try { if (!syncObject.isLoadComplete) { syncObject.isLoadComplete =true; if (syncObject.isWaitCalled) { syncObject.notify(); } } } catch (Exception ex) { } }
原文:https://stackoverflow.com/questions/40432886
最满意答案
激活图像版本控制的第一件事是:
1)转到站点设置2)单击类型3)从下拉列表中选择图像4)选择自动版本控制
即便如此,我认为不会自动为ImageEditor更改执行版本控制。 ImageEditor只是设置图像的字段值,并且不会发出任何对象修改的事件,我认为这是plone版本控制所需要的。
FWIW,我是Products.ImageEditor的作者。 如果您愿意,可以提交问题的故障单: https : //github.com/collective/Products.ImageEditor/issues
First thing to activate version control for images is to:
1) go to site setup 2) click Types 3) Select Image from the drop down 4) select Automatic versioning
Even with that, I don't think versioning will not automatically be performed for ImageEditor changes. ImageEditor just sets the field value for the image and does not emit any object modified events which I assume is required for plone's versioning to kick in.
FWIW, I'm the author of Products.ImageEditor. You can submit a ticket for the issue if you'd like: https://github.com/collective/Products.ImageEditor/issues
相关问答
更多-
Plone 4.1应该很快就会看到一个候选版本(这将成为最终版本)。 没有已知的阻挡者了。 如果你开始在新网站上工作,一定要去做。 对于现有站点的升级,我会等待一段时间,直到最终版本发布。 Plone 4.1 should see a release candidate very soon (which will then become the final release). There's no known blockers left anymore. If you start working on a ...
-
Plone 4.1是否使用KSS?(Does Plone 4.1 use KSS? Can I disabled JS and CSS files associated with KSS safely?)[2023-07-21]
你可以禁用它们。 您将失去一些渐进式增强功能(例如拖动文件以在内容选项卡上重新排序),但该网站仍应可用。 或者你可以升级到Plone 4.3,它不再使用KSS。 You can disable them. You'll lose some progressive enhancement features (ability to drag files to reorder on the Contents tab, for example), but the site should still be usabl ... -
要创建更多plone网站,请转到: http://
: /manage 例如: http://localhost:8080/manage 您会在右上角的“添加Plone站点”中找到一个按钮。 To create more plone sites just go to: http:// : /manage for example: http://localhost:8080/manage There you'll find a button in ... -
如何使用Plone 4.1为上传的文件/图像添加版本控制?(How do I add version control to uploaded files / images using Plone 4.1?)[2022-06-23]
激活图像版本控制的第一件事是: 1)转到站点设置2)单击类型3)从下拉列表中选择图像4)选择自动版本控制 即便如此,我认为不会自动为ImageEditor更改执行版本控制。 ImageEditor只是设置图像的字段值,并且不会发出任何对象修改的事件,我认为这是plone版本控制所需要的。 FWIW,我是Products.ImageEditor的作者。 如果您愿意,可以提交问题的故障单: https : //github.com/collective/Products.ImageEditor/issues F ... -
来自加利福尼亚酒店的提示:“你可以随时查看,但你永远不能离开。” 你真的不想禁用所有下载,我相信你真的只想禁用所有用户的下载,但所有者。 没有实际用途可以将文件放入没有车辆的东西中,以便让它们退回... ...所以你需要用工作流来解决这个问题: 使用具有此行为状态的自定义工作流定义(“机密”)。 确保未在此状态的权限中从上面的文件夹继承“查看”权限,并选中“所有者”(如果您认为合适,可能还有“管理员”)具有“查看”权限。 将机密状态设置为文件的默认状态。 如果您不希望在站点范围内执行此操作,则可以使用站点部 ...
-
无法下载wkhtmltopdf for sendaspdf在Plone中添加(cant download wkhtmltopdf for sendaspdf add on in Plone)[2023-04-24]
按照https://github.com/vincent-psarga/collective.sendaspdf上的说明为我工作。 编辑 :啊,既然你已经发布了你的整个buildout.cfg我可以看到问题。 parts = section必须是[buildout]节的一部分。 它目前在[wkhtmltopdf_executable] 。 设置初始用户也是如此。 请注意,您已经包含了管理员密码,所以如果真的是密码,我现在就改变它! Following the instructions at https:// ... -
这似乎是由于Zope 2.13.8和ZTK 1.0.3条目被错误输入good-py。 它现在应该修复。 This appears to be due to the Zope 2.13.8 and ZTK 1.0.3 entries being incorrectly entered into good-py. It should be fixed now.
-
可以在Plone 4.1中“自动”分类文件夹的所有内容吗?(Can all contents of a folder be “automatically” be categorized in Plone 4.1?)[2022-05-28]
创建(或编辑)集合时,可以添加“位置”条件,并指定文件夹的路径。 保存后,该集合将仅显示该文件夹内的内容(并且除此标准外,还添加了作为该集合的过滤器添加的所有其他条件)。 When you create (or edit) the collection, you can add a Location criterion, and specify the path to the folder. After you save, the collection will only show content from ... -
在plone中存在与文件的修订数量一样多的副本吗?(Do as many copies as the number of revisions exist for a file in plone?)[2022-05-28]
内容对象由多个持久性记录组成。 对于包含文件系统上的二进制blob文件的图像和文件。 更改内容对象时, 只有受更改影响的持久性记录才会写入事务的一部分。 那时候没有清除旧记录,所以你确实得到了多份副本,是的。 因此,每次更改文件或图像的二进制内容时,都会使用该新数据创建新副本,并保留旧版本。 但是,如果您只更改标题或发布日期,则blob文件不会受到影响,您将不会得到其他未更改数据的额外副本。 您使用ZODB打包来删除旧的交易数据。 请注意,通过打包,您还可以删除撤消包已删除旧状态的更改的功能。 Conten ... -
您还可以通过http://docs.diazo.org/en/latest/deployment.html中列出的任何非Plone部署方法运行Diazo。 你将失去所有Plone TTW集成,但如果你可以手动构建和编译你的主题,那么你就完全没有了。 You can also run Diazo via any of the non-Plone deployment methods listed at http://docs.diazo.org/en/latest/deployment.html. You'l ...