пятница, 21 декабря 2007 г.

Java-question on HashSet

Assume the following code:

Set set = new HashSet();
set.add(set);
set.add(set);

What will be the result of compiling and executing it?

вторник, 4 сентября 2007 г.

How to connect through a proxy in Java

The problem of such connection is rised quite often.
Here is one of the solutions and it seems to work.

четверг, 23 августа 2007 г.

Java-question

Is it possible to override method and make it abstract?

пятница, 8 июня 2007 г.

The "Double-Checked Locking is Broken" Declaration

Double-Checked Locking is widely cited and used as an efficient method for implementing lazy initialization in a multithreaded environment.

Unfortunately, it will not work reliably in a platform independent way when implemented in Java. When implemented in other languages, such as C++, it depends on the memory model of the processor, the reorderings performed by the compiler and the interaction between the compiler and the synchronization library. Since none of these are specified in a language such as C++, little can be said about the situations in which it will work. Explicit memory barriers can be used to make it work in C++, but these barriers are not available in Java.

See the full version here:
The "Double-Checked Locking is Broken" Declaration