check your java class locking and classloader concept.

try below code to test your concept of class Locking and classLoader. I will post the
reason of output next week till then you do your finding !!

public class VerifyClassLoadingOnClassLock {
    public static void main(String[] args) {

    private static void show() {
        synchronized (SharedQ.class) {
            System.out.println(" Method Show() executing from Main() .... ");

class SharedQ {  
    static {
        System.out.println(" Classloader is loading SharedQ ");

    public static void writeStream() {
        // some multiThread code here

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s