Terracotta acquires Ehcache


Terracotta has entered into an agreement with Greg Luck, the copyright owner and primary developer on the Ehcache project. Ehcache is of course the most popular open source Java cache library. The agreement means that Greg Luck will join Terracotta, the Ehcache copyright will transfer from Greg to Terracotta, and Terracotta will take over hosting Ehcache.

Before going any further about where we’re headed, I want to answer some possible first questions you might have:

Open source – Ehcache is open source. Terracotta is open source. No change.
License – Ehcache currently uses the Apache 2.0 license. No change.
Hosting – Hosting will move from SourceForge to the Terracotta Forge. The exact details of this are still in progress but Terracotta will take over the hosting of source code (svn), mailing lists, issue tracking, forums, etc.
Greg Luck – Greg will continue to be heavily involved in the direction of Ehcache.
Existing functionality – Ehcache will continue to be, by default, a non-clustered cache with exactly the same usage patterns it has today. No change in basic usage.

Full story : Terracotta acquires Ehcache

What is difference between static and init block in java


The static block is only loaded when the class object is created by the JVM for the 1st time whereas init {} block is loaded every time class object is created. Also first the static block is loaded then the init block.

public class LoadingBlocks {

static{
System.out.println("Inside static");
}

{
System.out.println("Inside init");
}
public static void main(String args[]){
new LoadingBlocks();
new LoadingBlocks();
new LoadingBlocks();
}
}

Output:

Inside static
Inside init
Inside init
Inside init

VMWare acquires SpringSource


Another emerging open source company acquired. In their press release vmware announced that it had acquired SpringSource for some some reasons.

Over last 5 yrs Springsource has emerged as one of the leaders in providing framework and support to develop enterprise applications. OVer short span of time its had provided one of the stable framework for developing applications.

This news has come as a surprise at least to me and a disappointment.

More details are here VMWare acquires SpringSource

Implementing Set using arrays


it is part of my assignement.. 

public class Set<T> {

      private T arrayElement[];

      int size =0;

      public Set(){

            this.arrayElement = null;

      }

      public Set(T[] element){

            arrayElement = element;

            size = arrayElement.length;

      }

      /**

       *add element to set. A check is made to identify whether element is present or not.

       *If not the element can be inserted.

       * @param element

       */

      public void addElement(T element){

            if(!contains(element)){

            if(size == arrayElement.length){

                  incrementArray();

            }

            arrayElement[size++] = element;

            }

      }

     

      /**

       * to check is element is present or not.

       * @param elem

       * @return boolean

       */

      public boolean contains(T elem){

 

            if (elem == null) {

                for (int i = 0; i < size; i++)

                  if (arrayElement[i]==null)

                      return true;

            } else {

                for (int i = 0; i < size; i++)

                  if (elem.equals(arrayElement[i]))

                      return true;

            }

            return false;

         

      }

     

      /**

       * return the size of set.

       * @return int

       */

      public int size(){

            if(arrayElement != null){

                  return arrayElement.length;

            }else

                  return 0;

      }

     

      public void clear(){

            arrayElement = null;

      }

     

      public String toString(){

            if(arrayElement == null  || arrayElement.length ==0 ){

                  return“[EMPTY]”;

            }else{

                  String toStr=”[“;

                  for(int i=0;i<arrayElement.length;i++){

                        toStr+=arrayElement[i]+”,”;

                  }

                  toStr+=”]”;

                  return toStr;

            }

      }

     

      /**

       * to check whether set is empty or not

       * @return

       */

      public boolean isEmpty(){

            if(arrayElement == null || arrayElement.length ==0 )

            return true;

            else

                  return false;

      }

     

      /**

       * this function is used to increment the size of an array

       *

       */

      private void incrementArray(){

            T[] temparray = arrayElement;

            int tempsize=size+5;

             arrayElement =(T[]) new Object[tempsize];

             System.arraycopy(temparray, 0, arrayElement, 0, size);

             

      }

}//Set class ends