12 2016 档案

摘要:一、定义 解释器模式(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 飞轩 阅读(160) 评论(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)
摘要:对于开发人员,我想大家对于Maven应该不会陌生吧,如何在一个Maven项目中对这个项目中所引用的第三方jar包有个直观的了解呢? 其实实现很简单,只需要借助于Maven的一条命令,如下所示: 需要说明的是执行这个命令需要在控制台中进入到pom文件所在的目录。 从上面的图片就可以直观的看到所引用的各 阅读全文
posted @ 2016-12-27 21:02 飞轩 阅读(5295) 评论(0) 推荐(0)
摘要:1、依赖如下: 将Jar包安装到本地仓库命令: mvn install:install file Dfile=D:\quartz terracotta bootstrap 2.2.2 SNAPSHOT.jar DgroupId=org.quartz scheduler.internal Dartif 阅读全文
posted @ 2016-12-27 20:46 飞轩 阅读(377) 评论(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 飞轩 阅读(248) 评论(0) 推荐(0)
摘要:一、定义 建造者模式(Builder Pattern)也叫生成器模式,其定义如下: Separate the construction fo a complex object from its representation so that the same comstruction process 阅读全文
posted @ 2016-12-19 15:54 飞轩 阅读(195) 评论(0) 推荐(0)
摘要:一、定义 模板方法模式(Template Method Pattern)的定义如下: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method le 阅读全文
posted @ 2016-12-19 13:54 飞轩 阅读(241) 评论(0) 推荐(0)
摘要:一、定义 抽象工厂模式(Abstract Factory Pattern)是一种比较常见的模式,其定义如下: Provide an interface for creating families of related or dependent objects without specifying t 阅读全文
posted @ 2016-12-19 11:28 飞轩 阅读(215) 评论(0) 推荐(0)
摘要:一、Class文件的装载过程 Class类型通常以文件的形式存在(当然,任何二进制流都可以是Class类型),只有被Java虚拟机装载的Class类型才能在程序中使用。系统状态Class类型可以分为加载、连接和初始化3个步骤。其中,连接又可分为验证、准备和解析3步。 1.1 类装载的条件 Class 阅读全文
posted @ 2016-12-19 10:36 飞轩 阅读(310) 评论(0) 推荐(0)
摘要:一、定义 Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation 阅读全文
posted @ 2016-12-18 21:23 飞轩 阅读(241) 评论(0) 推荐(0)
摘要:一、定义 单例模式(Singleton Pattern)是一个比较简单的模式,定义如下: Ensure a class has only one instance, and provide a global point of access to it.(确保某一个类职业一个实例,而且自行实例化并向整 阅读全文
posted @ 2016-12-18 19:52 飞轩 阅读(214) 评论(0) 推荐(0)
摘要:一、单一职责原则 Single Responsibility Principle,简称SRP。 单一职责原则的定义是:应该有且仅有一个原因引起类的变更。 二、里氏替换原则 Liskov Substitution Principle,LSP 定义1:如果每一个类型为S的对象o1,都有类型为T的对象o2 阅读全文
posted @ 2016-12-18 17:46 飞轩 阅读(206) 评论(0) 推荐(0)
摘要:一、锁在Java虚拟机中的实现与优化 1.1 偏向锁 偏向锁是JDK 1.6 提出的一种锁优化方式。其核心思想是,如果程序没有竞争,则取消之前已经取得锁的线程同步操作。也就说,若某一锁被线程获取后,便进入偏向模式,当线程再次请求这个锁时,无需进行相关的同步操作,从而节省了操作时间。如果在此之前有其他 阅读全文
posted @ 2016-12-17 09:35 飞轩 阅读(2080) 评论(0) 推荐(0)
摘要:什么是内存泄漏?所谓内存泄漏,就是由于疏忽或错误造成程序未能释放已经不再使用的内存的情况,他并不是说物理内存消失了,而是指由于不再使用的对象占据了内存不被释放,而导致可用内存不断减小,最终有可能导致内存溢出。 由于垃圾回收器的出现,与传统的C/C++相比,Java已经把内存泄漏的概率大大降低了,所以 阅读全文
posted @ 2016-12-14 22:51 飞轩 阅读(1699) 评论(0) 推荐(0)
摘要:一般来说,我们使用mybatis generator来生成mapper.xml文件时,会生成一些增删改查的文件,这些文件中需要传入一些参数,传参数的时候,我们会注意到,参数的大括号外面,有两种符号,一种是 ,一种是$。这两种符号有什么区别呢? 从上面的内容我们可以比较清楚的看到,一般 {}用于传递查 阅读全文
posted @ 2016-12-13 21:44 飞轩 阅读(6792) 评论(2) 推荐(1)
摘要:一、Linux下的性能监控工具 1.1 显式系统整体资源使用情况 top命令 top命令的输出可以分为两个部分:前半部分是系统统计信息,后半部分是进程信息。 在统计信息中,第一行是任务队列信息,他的结果等同于uptime命令。从左到右以此表示:系统当前时间、系统运行时间、当前登录用户数。最后的loa 阅读全文
posted @ 2016-12-11 22:46 飞轩 阅读(1604) 评论(0) 推荐(1)
摘要:1.与串行回收器相关的参数 XX:+UseSerialGC:在新生代和老年代使用串行收集器 XX:SurvivorRatio:设置eden区大小和survivor区大小的比例 XX:PretenureSizeThreshold:设置大对象直接进入老年代的阈值。当对象的大小超过这个值时,将直接在老年代 阅读全文
posted @ 2016-12-11 21:32 飞轩 阅读(3837) 评论(0) 推荐(0)
摘要:一、认识垃圾回收 谈到垃圾回收(Garbage Collection,简称GC),GC中的垃圾,特指存在于内存中的、不会再被使用的对象。对于内存空间的管理来说,识别和清理垃圾对象是至关重要的。 二、常用的垃圾回收算法 2.1 引用计数法(Reference Counting) 引用计数法是最经典也最 阅读全文
posted @ 2016-12-11 20:12 飞轩 阅读(387) 评论(0) 推荐(0)
摘要:一、跟踪调试参数 1.1 跟踪垃圾回收 读懂虚拟机日志 Java的一大特色就是支持自动的垃圾回收(GC),但是有时候,如果垃圾回收频繁出现,或者占用了太长的CPU时间,就不得不引起重视。此时,就需要一些跟踪参数来进一步甄别垃圾回收器的效率和效果。 最简单的一个GC参数是 XX:+PrintGC,使用 阅读全文
posted @ 2016-12-11 15:34 飞轩 阅读(5468) 评论(0) 推荐(1)
摘要:本文将介绍Java虚拟机的基本结构,各组成部分的作用,以及相互之间是如何协调的。而要了解这些,首先必须了解Java堆、Java栈、永久区和元数据区的基本概念。 一、Java虚拟机的架构 1.1 类加载子系统 类加载子系统负责从文件系统或者网络中加载Class信息,加载的类信息放在一块称为方法区的内存 阅读全文
posted @ 2016-12-11 12:24 飞轩 阅读(1573) 评论(2) 推荐(3)