ITeye博客

java

共 80 篇文章

static nested class vs. inner class

http://articles.techrepublic.com.com/5100-10878_11-5815620.html

2010-11-03 22:37 · java

The 'static' keyword in java

1. When a variable is defined 'static', it's called a "class variable', that is, all the objects of that class own that variable. A class variable can be accessed with the class, without creating objects of the class. 2. When a method is defined 'static', it can be called with class without need to…

2010-11-03 22:36 · java

Explain final, finally, finalize

final is a keyword for class, methods, variable. A final class is a class which cannot be subclassed. A final method cannot be overrided. A final variable is not changable after it's initialized. finalize() method is used just before an object is destroyed and can be called just prior to garbage co…

2010-11-03 21:53 · java

ClassFormatError

Exception in thread "main" java.lang.ClassFormatError: poi.HelloWorldApp (unrecognized class file version) at java.lang.VMClassLoader.defineClass(libgcj.so.7rh) at java.lang.ClassLoader.defineClass(libgcj.so.7rh) at java .security.SecureClassLoader.defineClass(libgcj.so.7rh) at java.net.URLClassLoa…

2010-11-02 10:48 · java

GC信息的格式

[GC [<collector>: <starting occupancy1> -> <ending occupancy1>, <pause time1> secs] <starting occupancy3> -> <ending occupancy3>, <pause time3> secs] <collector> GC为minor收集过程中使用的垃圾收集器起的内部名称. <starting occupancy1> young generation 在进行垃圾收集前被对象使用的存储空间. <ending occupancy1> young generation 在进行垃圾收集后被对象使…

2010-10-28 16:36 · java

HBase中几个存在thread contention的地方

hbase code 0.26 从thread dump的结果看出来有几个地方是会导致线程BLOCKED。 "Thread-29" tid=38 daemon=false priority=5 state=BLOCKED at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegionInMeta at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion at org.apache.hadoop.hba…

2010-10-25 17:10 · java

Multithreaded Hash Table

Multithreaded Hash Table http://weblogs.java.net/blog/elevy/archive/2007/04/multithreaded_h_1.html

2010-10-21 15:26 · java

为什么wait()必须要在放synchronized里面?

假如你要调用某个对象的wait()方法,一般都要放在synchronized声明里面,why? 下面是答案。 Suppose d is the object we're using to invoke wait . When a thread invokes d.wait , it must own the intrinsic lock for d — otherwise an error is thrown. Invoking wait inside a synchronized method is a simple way to acquire the intrinsic lock. W…

2010-10-19 11:01 · java

How to print stack trace in your java code?

When debugging java code, sometimes it's important to know where you come from. So you can print current stack trace to help you. 1. new Exception().printStackTrace(); 2. Thread.currentThread().getStackTrace(); This returns an array of StackTraceElement that represents current stack of your program.

2010-10-15 10:08 · java

介绍overload与override区别的文章

http://hi.baidu.com/trackofyouth/blog/item/cc720f2d050c21e28b1399e0.html

2010-10-12 11:42 · java

Thread dump result of region server

"IPC Server handler 26 on 60020" tid=72 daemon=true priority=5 state=BLOCKED at org.apache.hadoop.hbase.regionserver.HLog.append at org.apache.hadoop.hbase.regionserver.HRegion.put at org.apache.hadoop.hbase.regionserver.HRegion.put at org.apache.hadoop.hbase.regionserver.HRegion.put at org.apache.…

2010-09-29 09:58 · java

State of a Thread

NEW - A thread that has not yet started is in this state. RUNNABLE - A thread executing in the Java virtual machine is in this state. BLOCKED - A thread that is blocked waiting for a monitor lock is in this state. WAITING - A thread that is waiting indefinitely for another thread to perform a parti…

2010-09-28 14:53 · java

Reading for ParNew (promotion failed) and (concurrent mode failure)

http://java-monitor.com/forum/showthread.php?t=645 Dear All, If you are struggling to understand the messages ParNew (promotion failed) and (concurrent mode failure), you might want to bone up on memory management and garbage collector internals. ParNew (promotion failed): This means that your old …

2010-09-19 11:22 · java

Reading for ParNew (promotion failed) and (concurrent mode failure)

http://java-monitor.com/forum/showthread.php?t=645 Dear All, If you are struggling to understand the messages ParNew (promotion failed) and (concurrent mode failure), you might want to bone up on memory management and garbage collector internals. ParNew (promotion failed): This means that your old …

2010-09-19 11:19 · java

java jvm GC 参数设置

1: heap size a: -Xmx 指定jvm的最大heap大小,如:-Xmx2g b: -Xms 指定jvm的最小heap大小,如:-Xms1g c: -Xmn 指定jvm中New Generation的大小,如:-Xmn256m d: -XX:PermSize 指定jvm中Perm Generation的最小值,如:-XX:PermSize=32m e: -XX:MaxPermSize 指定Perm Generation的最大值,如:-XX:MaxPermSize=64m f: -Xss 指定线程桟大小,如:-Xss128k g: -XX:NewRatio 指定jvm中Old Ge…

2010-09-19 10:54 · java

generate combinations

http://compprog.wordpress.com/2007/10/17/generating-combinations-1/ #include <iostream> #include <vector> using namespace std; void print(vector<char> chars, char array[], int k){ for(int j=0;j<k;j++) cout<<chars.at(array[j]); cout<<endl; } bool next(char array[], int n, int k){ int i=k-1; while(i>…

2010-09-07 22:52 · java

polymorphism and inheritance

Inheritance Inheritance is the capability of a class to use properties and methods of another class while adding its own functionalities.Java uses extends to set the relationship between a parent class and a child class.When extending a class, you can reuse the superclass construct with reserved wo…

2010-09-07 21:04 · java

5 things you didn't know about ... java.util.concurrent

http://www.ibm.com/developerworks/java/library/j-5things4.html?ca=drs-

2010-08-31 14:40 · java

Java synchronized methods

First, it is not possible for two invocations of synchronized methods on the same object to interleave. When one thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object block (suspend execution) until the first thread is done w…

2010-08-31 12:00 · java

java interrupt

See following tutorial from sun: An interrupt is an indication to a thread that it should stop what it is doing and do something else. It's up to the programmer to decide exactly how a thread responds to an interrupt, but it is very common for the thread to terminate. This is the usage emphasized i…

2010-08-31 11:37 · java