摘要: Balking模式讲的是如果现在不合适执行这个操作,或者没必要执行这个操作,就停止处理,直接返回 自动保存功能的实现逻辑一般都是隔一定时间自动执行存盘操作,存盘操作的前提是文件做过修改,如果文件没有执行过修改操作,就需要快速放弃存盘操作 单次初始化 阅读全文
posted @ 2019-11-01 22:28 踏月而来 阅读(269) 评论(0) 推荐(0) 编辑
摘要: //设计为单例 public final class ActionContext { // 构造方法私有化 private ActionContext() { } // Holder类 private static class ContextHolder { private final static ActionContext actionContext = new ActionContext() 阅读全文
posted @ 2019-11-01 20:34 踏月而来 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Guarded Suspension 设计模式可以保证,当线程在访问某个对象时,发现条件不满足,就挂起等待条件满足时再次访问 public class GuardedSuspensionQueue { // 定义存放Integer类型的queue private final LinkedList queue = new LinkedList(); // 定义q... 阅读全文
posted @ 2019-11-01 17:40 踏月而来 阅读(185) 评论(0) 推荐(0) 编辑