Question: I have a normal HTTP page where in top header section I have a Sign in Link. On click of sign in link a twitter style Flyout sign in window appears, which should be a secured signin section. 

Can any one suggest me how could I achieve loading a HTTPS page or section in a HTTP page. 

Thanks

Answer: 
That is the whole concept of synchronization, if you are taking a lock on an object (or a class), none of the other threads can access any synchronized blocks.

Example 

```
Class A{

public void method1()
{
 synchronized(this)//Block 1 taking lock on Object
 {
  //do something
 }
}

public void method2()
{
 synchronized(this)//Block 2 taking lock on Object
 {
  //do something
 }
}
}

```

If one thread of an Object enters any of the synchronized blocks, all others threads **of the same object** will have to wait for that thread to come out of the synchronized block to enter any of the synchronized blocks. If there are N number of such blocks, only one thread of the Object can access only one block at a time. Please note my emphasis on **Threads of same Object**. The concept will not apply if we are dealing with threads from different objects. 

Let me also add that if you are taking a lock on **class**, the above concept will get expanded to any object of the class. So if instead of saying `synchronized(this)`, I would have used `synchronized(A.class)`, code will instruct JVM, that irrespective of the Object that thread belongs to, make it wait for other thread to finish the synchronized block execution.

Edit: Please understand that when you are taking a lock (by using synchronized keyword), you are not just taking lock on one block. You are taking lock on the object. That means you are telling JVM "hey, this thread is doing some **critical work** which might change the state of the object (or class), so don't let any other thread do any other **critical work**" . Critical work, here refers to all the code in synchronized blocks which take lock on that particular Object (or class), and not only in one synchronized block.
This is not absolutely true. If you are dealing with locks on different objects then multiple threads can execute those blocks.

```
   synchronized(obj1){
       //your code here
   }

   synchronized(obj2){
       //your code here
   }

```

In above case one thread can execute first and second can execute second block , the point is here threads are working with different locks.

Your statement is correct if threads are dealing with same `lock`.Every object is associated with only one lock in java if one thread has acquired the lock and executing then other thread has to wait until first thread release that `lock`.Lock can be acquired by `synchronized` block or method.