随笔分类 -  设计模式

摘要:一、序列图 二、源码分析 2.1 Sink Sink阶段所做的事情,就是根据一定的规则,对binlog数据进行一定的过滤。我们之前跟踪过parser过程的代码,发现在parser完成后,会把数据放到一个环形队列TransactionBuffer中,也就是这个方法: 我们具体看下add这个方法。 判断 阅读全文
posted @ 2018-05-25 15:01 飞轩 阅读(894) 评论(2) 推荐(1)
摘要:本文主要解析下canal server的启动过程,希望能有所收获。 一、序列图 1.1 启动 1.2 停止 二、源码分析 整个server启动的过程比较复杂,看图难以理解,需要辅以文字说明。 首先程序的入口在CanalLauncher的main方法中。 2.1 加载配置文件 从canal.prope 阅读全文
posted @ 2018-05-24 15:25 飞轩 阅读(5015) 评论(0) 推荐(0)
摘要:一、定义 桥梁模式(Bridge Pattern)也叫做桥接模式,是一个比较简单的模式,其定义如下: Decouple an abstraction from its implementation so that the two can vary independently.(将抽象和实现解耦,使得 阅读全文
posted @ 2017-01-03 11:31 飞轩 阅读(197) 评论(0) 推荐(0)
摘要:一、定义 享元模式(Flyweight Pattern)是池技术的重要实现方式,其定义如下:Use sharing to support large numbers of fine grained objects efficiently.(使用共享对象可有效地支持大量的细粒度的对象。) 享元模式的定 阅读全文
posted @ 2017-01-03 10:59 飞轩 阅读(164) 评论(0) 推荐(0)
摘要:一、定义 解释器模式(Interpreter Pattern)是一种按照规定语法进行解析的方案,在现在项目中使 用较少,其定义如下:Given a language, define a representation for its grammar along with an interpreter 阅读全文
posted @ 2016-12-29 23:08 飞轩 阅读(152) 评论(0) 推荐(0)
摘要:一、定义 定义如下: Allow an object to alter its behavior when its internal state changes.The object will appear to change its class.(当一个对象内在状态改变时允许其改变行为,这个对象看 阅读全文
posted @ 2016-12-29 22:51 飞轩 阅读(163) 评论(0) 推荐(0)
摘要:一、定义 访问者模式(Visitor Pattern)是一个相对简单的模式,其定义如下:Represent an operation to be performed on the elements of an object structure. Visitor lets you define a n 阅读全文
posted @ 2016-12-29 18:22 飞轩 阅读(159) 评论(0) 推荐(0)
摘要:一、定义 备忘录模式(Memento Pattern)提供了一种弥补真实世界缺陷的方法,让“后悔药”在程 序的世界中真实可行,其定义如下: Without violating encapsulation,capture and externalize an object's internal sta 阅读全文
posted @ 2016-12-29 07:56 飞轩 阅读(187) 评论(0) 推荐(0)
摘要:一、定义 门面模式(Facade Pattern)也叫做外观模式,是一种比较常用的封装模式,其定义如 下: Provide a unified interface to a set of interfaces in a subsystem.Facade defines a higher level 阅读全文
posted @ 2016-12-29 07:39 飞轩 阅读(344) 评论(0) 推荐(0)
摘要:一、定义 观察者模式(Observer Pattern)也叫做发布订阅模式(Publish/subscribe),它是一个在项 目中经常使用的模式,其定义如下: Define a one to many dependency between objects so that when one obje 阅读全文
posted @ 2016-12-28 07:50 飞轩 阅读(194) 评论(0) 推荐(0)
摘要:一、定义 组合模式(Composite Pattern)也叫合成模式,有时又叫做部分 整体模式(Part Whole), 主要是用来描述部分与整体的关系,其定义如下: Compose objects into tree structures to represent part whole hiera 阅读全文
posted @ 2016-12-28 07:32 飞轩 阅读(179) 评论(0) 推荐(0)
摘要:一、定义 迭代器模式(Iterator Pattern)目前已经是一个没落的模式,基本上没人会单独写一个迭代器,除非是产品性质的开发,其定义如下: Provide a way to access the elements of an aggregate object sequentially wit 阅读全文
posted @ 2016-12-27 22:53 飞轩 阅读(185) 评论(0) 推荐(0)
摘要:一、定义 适配器模式(Adapter Pattern)的定义如下: Convert the interface of a class into another interface clients expect.Adapter lets classes work together that could 阅读全文
posted @ 2016-12-27 22:35 飞轩 阅读(181) 评论(0) 推荐(0)
摘要:一、定义 策略模式(Strategy Pattern)是一种比较简单的模式,也叫做政策模式(Policy Pattern)。其定义如下: Define a family of algorithms,encapsulate each one,and make them interchangeable. 阅读全文
posted @ 2016-12-27 22:00 飞轩 阅读(224) 评论(0) 推荐(0)
摘要:一、定义 装饰模式(Decorator Pattern)是一种比较常见的模式,其定义如下:Attach additional responsibilities to an object dynamically keeping the same interface.Decorators provide 阅读全文
posted @ 2016-12-27 21:36 飞轩 阅读(439) 评论(0) 推荐(0)
摘要:一、定义 责任链模式定义如下: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.Chain the receivi 阅读全文
posted @ 2016-12-27 07:39 飞轩 阅读(330) 评论(0) 推荐(0)
摘要:一、定义 命令模式是一个高内聚的模式,其定义为:Encapsulate a request as an object,there by letting you parameterize clients with different requests,queue or log requests,and 阅读全文
posted @ 2016-12-20 16:36 飞轩 阅读(15016) 评论(0) 推荐(1)
摘要:一、定义 中介者模式的定义为:Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to 阅读全文
posted @ 2016-12-20 15:41 飞轩 阅读(437) 评论(0) 推荐(0)
摘要:一、定义 原型模式(Prototype Pattern)的简单程度仅次于单例模式和迭代器模式。 Specify the kinds of objects to create using a prototypical instance, and create new objects by copyin 阅读全文
posted @ 2016-12-19 22:32 飞轩 阅读(232) 评论(0) 推荐(0)
摘要:定义 代理模式(Proxy Pattern)是一个使用率非常高的模式,其定义如下: Provide a surrogate or placeholder for another object to control access to it.(为其他对象提供一种代理以控制对这个对象的访问。) 通用类图 阅读全文
posted @ 2016-12-19 17:23 飞轩 阅读(247) 评论(0) 推荐(0)