子瞻的技术空间

收雨集露,厚积薄发
 
 

常用链接

  • 我的随笔
  • 我的评论
  • 我的参与
  • 最新评论

留言簿

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔档案

  • 2012年3月 (1)
  • 2010年7月 (1)
  • 2010年1月 (1)
  • 2009年12月 (2)
  • 2009年10月 (1)

文章档案

  • 2012年3月 (1)
  • 2011年8月 (1)
  • 2010年7月 (1)
  • 2010年2月 (1)

搜索

  •  

最新评论

  • 1. re: JAVA 连接 Https Server, 用户认证后获取网页内容
  • 评论内容较长,点击标题查看
  • --clausewitzer
  • 2. re: ABC of Extensibility && Scalability
  • 对哦,不但可以成比例扩展,还可以成比例缩小,谢谢~@honeyjava
  • --柴子瞻
  • 3. re: ABC of Extensibility && Scalability
  • 后者叫可伸缩性
  • --honeyjava

阅读排行榜

  • 1. 解决MYSQL出现Can't create/write to file 'C:\WINDOWS\TEMP\#*.MYD' (Errcode: 17)一类问题(3051)
  • 2. ZZ java获得CPU使用率,系统内存,虚拟机内存等情况(不用JNI or Sigar)(1838)
  • 3. 弄清楚脏读、不可重复的读和虚读(941)
  • 4. ABC of Extensibility && Scalability(737)
  • 5. Static Import since 1.5(288)

评论排行榜

  • 1. ABC of Extensibility && Scalability(2)
  • 2. 弄清楚脏读、不可重复的读和虚读(0)
  • 3. ZZ java获得CPU使用率,系统内存,虚拟机内存等情况(不用JNI or Sigar)(0)
  • 4. 解决MYSQL出现Can't create/write to file 'C:\WINDOWS\TEMP\#*.MYD' (Errcode: 17)一类问题(0)
  • 5. Dump抓取(0)

Powered by: 博客园
模板提供:沪江博客
BlogJava | 首页 | 发新随笔 | 发新文章 | 联系 | 聚合 | 管理

2010年7月3日

Dump抓取
windbg目录,采用工具cdb生成dump文件:cdb -pv -pn 进程名 -c ".dump /m c:/文件名.dmp;q"。
例如:
cdb -pv -pn explorer.exe -c ".dump /m c:/explorer.dmp;q"
posted @ 2012-03-28 14:24 柴子瞻 阅读(217) | 评论 (0) | 编辑 收藏
 
Static Import since 1.5
In order to access static members, it is necessary to qualify references with the class they came from. For example, one must say:
double r = Math.cos(Math.PI * theta);
In order to get around this, people sometimes put static members into an interface and inherit from that interface. This is a bad idea. In fact, it's such a bad idea that there's a name for it: the Constant Interface Antipattern (see Effective Java Item 17). The problem is that a class's use of the static members of another class is a mere implementation detail. When a class implements an interface, it becomes part of the class's public API. Implementation details should not leak into public APIs.

The static import construct allows unqualified access to static members without inheriting from the type containing the static members. Instead, the program imports the members, either individually:

import static java.lang.Math.PI;
or en masse:
import static java.lang.Math.*;

Once the static members have been imported, they may be used without qualification:
double r = cos(PI * theta);
The static import declaration is analogous to the normal import declaration. Where the normal import declaration imports classes from packages, allowing them to be used without package qualification, the static import declaration imports static members from classes, allowing them to be used without class qualification.

So when should you use static import? Very sparingly! Only use it when you'd otherwise be tempted to declare local copies of constants, or to abuse inheritance (the Constant Interface Antipattern). In other words, use it when you require frequent access to static members from one or two classes. If you overuse the static import feature, it can make your program unreadable and unmaintainable, polluting its namespace with all the static members you import. Readers of your code (including you, a few months after you wrote it) will not know which class a static member comes from. Importing all of the static members from a class can be particularly harmful to readability; if you need only one or two members, import them individually. Used appropriately, static import can make your program more readable, by removing the boilerplate of repetition of class names.

posted @ 2010-07-03 21:12 柴子瞻 阅读(288) | 评论 (0) | 编辑 收藏