1. Generally speaking, a failed method invocation should leave the object in the state that it was in prior to the invocation. A method with this property is said to be failure atomic.
2. The simplest way to achieve failure atomicity is to design immutable objects. If an operation fails, it may prevent a new object from getting created, but it will never leave an existing object in an inconsistent state.
3. For methods that operate on mutable objects, the most common way to achieve failure atomicity is to check parameters for validity before performing the operation. A closely related approach to achieving failure atomicity is to order the computation so that any part that may fail takes place before any part that modifies the object.
4. A third and far less common approach to achieving failure atomicity is to write recovery code that intercepts a failure that occurs in the midst of an operation and causes the object to roll back its state to the point before the operation began. This approach is used mainly for durable (disk-based) data structures.
5. A final approach to achieving failure atomicity is to perform the operation on a temporary copy of the object and to replace the contents of the object with the temporary copy once the operation is complete.( Collections.sort dumps its input list into an array prior to sorting to reduce the cost of accessing elements in the inner loop of the sort.)
6. It would be wrong to assume that an object was still usable after catching a ConcurrentModificationException.
7. As a rule, errors (as opposed to exceptions) are unrecoverable, and methods need not even attempt to preserve failure atomicity when throwing errors.
8. As a rule, any generated exception that is part of a method’s specification should leave the object in the same state it was in prior to the method invocation. Where this rule is violated, the API documentation should clearly indicate what state the object will be left in.
相关推荐
Item 76: Strive for failure atomicity Item 77: Don’t ignore exceptions 11 Concurrency Item 78: Synchronize access to shared mutable data Item 79: Avoid excessive synchronization Item 80: Prefer ...
努力的博客 欢迎使用Strive博客背后的代码! ( )
StriveTherapy网站
努力 Strive是的Haskell客户端。列出运动员的K / QOM / CR 朋友和追随者列出运动员朋友列出运动员关注者列出以下两个活动创建活动检索活动更新活动删除活动列出运动员活动列出相关活动列出朋友的活动列出活动区列出...
Strive_AI_Tasks 在这里,我将介绍Strive学校AI工程计划的练习解决方案。 该存储库将随着新的每日解决方案以及每周或什至每月一次不断更新,这是整个计划的持续时间所需要的。
要求安装了 (带有npm软件包管理器) $ npm install -g gulp (Mac用户可能需要sudo)安装通过Composer安装: composer require trive/theme-frontend-strive或将此存储到Magento_root / strive-gulp文件夹中的...
Ease of Use - We strive to make the developer's life easier. Complex parameter configurations are removed from Asprise OCR SDK. You only have to supply the image document. Asprise OCR can ...
软件使用版本:Quartus II 13.0+Modelsim_Altera10.1d 工程使用例程:tcd1209+ad9945,verilog HDL设计 仿真选择:时序仿真 撰写人:Strive_JP
在控制台操作的计算器,有增加修改删除,我上班后一次面试做的 好久没有做基础的了
努力 用于动态工作流的分布式调度程序。 基于 Google Omega 调度器设计。 要求: 特征: 基于主机的代理来跟踪任务 使集群保持在适当状态的反熵 支持在 Docker 中以及直接在主机上运行任务 Cpu、内存、端口、卷...
JAVASCRIPT 从无到有的Javascript-STRIVE SCHOOL
主要以js做的计算器,主要功能很简单 带jquery,对你很有用的
软件使用版本:Quartus II 13.0+Modelsim_Altera10.1d 工程使用例程:tcd1209+ad9945,verilog HDL设计 ...撰写人:Strive_JP 参考资料:《ModelSim高级使用进阶_1_do文件和批处理文件使用_Camp》
课程作业库这是在volve.school AI工程课程中完成的任务的集合。 [TOC] [第2周:?]
在家工作该资料库包含Strive School完成的所有工作
努力在接下来的8个月里,我将尽一切努力,努力工作以实现自己的目标,并且永不放弃,感谢您对我的项目的关注!!!
This volume introduces machine learning techniques that are particularly powerful and effective for modeling multimedia data and common tasks of multimedia content analysis. It systematically covers ...
He believes that developers should strive for readable code that delivers constant value to their customers. Pair programming and mentorship are his primary tools to promote a test-driven development...
因为版权原因,ojdbc6在maven是不能添加的,需要下好ojdbc6后通过命令mvn install:install-file -Dfile=你的jar包路径 -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=6.0 -Dpackaging=jar -DgeneratePom=true...
Strive_School 这个资料库包括讲座幻灯片练习和我的绝大部分作品