Sun LiWei

Ranch Hand
+ Follow
since Aug 10, 2002
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sun LiWei

CheckStyle only audits your code instead of formatting code. It's better than nothing. I use Eclipse all the time and the built-in formatter of Eclipse is not good enough for SCJD, I think.
I found that Check Style 4.0.91( )has a built-in configuration "SUN Checks" , Does anyone know whether it suitable for SCJD???
So,is the initiating order of a inner class is

3)the hidden reference to the outter class(maybe here)
2)instance variable(s)
3)the hidden reference to the outter class(also maybe here)
4)it's own constructor

This hidden reference is the thing i don't know before.when exactly this reference is initialized?
19 years ago

new Outer$Inner1:
new Outer$Inner2:
at Outer.access$100(
at Outer$Inner2.getBar(
at Outer$Inner1.<init>(
at Outer$Inner2.<init>(
at Outer.<init>(
at Outer.main(

I can't explain the null situation here.

why NullPointerExceptin is thrown??? why foo is null in Inner2 class?what is the initiating order of a java class ??
19 years ago
I have a thread which using DatagramSocket in the run() method:
MyThread extends Thread{
public void run(){
DatagramSocket socket=new DatagramSocket();
}catch(Exception e){
When I generate tens of threads with MyThread, most of the threads run without exception,but there're always some threads throw a SocketTimeoutException,the network is ok though,when i run one thread a time,no exception! I can't figure it out.Help me.
Maybe the following will make my quesion clear
two pc-servers,both have 1 GB memory and one P4 CPU,one is Linux and the other is Solaris 8(x86 version),both installed with resin 2.x and JDK 1.4.2, which one is more stable and faster when run a web application on resin?
[ July 17, 2003: Message edited by: Sun LiWei ]
20 years ago
Generally speaking,There's JDK on Linux,Windows And Solaris. And I wondered which is the best platform for JDK.It's seems that hotspot JVM can run better on Solaris than other two.But I am not sure of that
20 years ago
Did anyone know the performance of JDK 1.4.x on different operation systems,like Solaris,Linux,FreeBSD and Windows? It seems the muti-threads performance on Solaris is better than other systems?Is that right??
20 years ago
o ne of the policy of general database connection pool is creating new connection for every thread who request database connection by calling getConnection() method(normally,this method is synchronized.I wondered is there any synchronization problem if give the same connection object to mutiple threads.On the other words,is it safe if two thread use the same connection object concurrency?
[ June 16, 2003: Message edited by: Sun LiWei ]
in jdk 1.4,the isClosed() and isConnected() methods of Sokcet class does't detect whether the tcp connection is closed by remote host.
Only if the client socket invoke the s.close(),the two methods will show right result. It seems there's no way to know whether the tcp connection is closed by remote host.
21 years ago
There is a class ThreadLocal in jdk 1.2,I am still not understand this class after I read the jdk documents.It's maybe a silly question,but I am sucked.

in class T,the variable k is thread local variables,right?? every instance of T have its own copy of k.Did
sin(Math.PI/2) does not mean sin(90).
PI/2 != 90

it compiles in
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
[ October 28, 2002: Message edited by: Sun LiWei ]
No need for the answer now,I am using log4j now,it's powerful and easier to use
21 years ago
I found that the same logger only update logging message to the log file when using FileHandler.How can I make it append message into the file.For example:

no matter how many times when I execute the code,the logger with the same name only update the log file.How can I change the logger's behavior from update to append??
21 years ago