This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Migration from Java 5/6 to Java7

 
Shyam Sunder V R
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
I am working for a client on migrating his applications from Java5/6 to Java7.I have already gone through the new features in Java7 like try-with resources,Switch with strings,etc.
My client's idea of migration is NOT TO change the code (as much as possible) during migration.Unfortunately that is not negotiable.Minor changes to code are ofcourse acceptable if it affects performance or if there is any deprication.
With this background in mind,I surfed through various resources on the web and could find only one glitch with JDK 1.7 in compariosn to JDK 1.6 (Not really sure if this is fixed in any of the new builds of java 7,if so please enlighten me on it)
It says that the hashmap is now designed to be force synchronised and would show performance issues in JDK 7 when compared to JDK 6.

I need your help from your experiences or migration projects of what are the aspects or code snippets that I need to validate in addition to compiling the code with JDK 7.Any help is appreciated.

 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API specs for HashMap.java here http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html
say that
Note that this implementation is not synchronized.
 
Shyam Sunder V R
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that really helps...Apart from that if someone could help in answering the other part of my question...

"I need your help from your experiences or migration projects of what are the aspects or code snippets that I need to validate in addition to compiling the code with JDK 7.Any help is appreciated"
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moves to Java 7 from 5 and 6 don't really require much (if anything at all). It's backwards compatible so if you are not allowed to make changes you can just start running the old code on on the new run time without affecting the logic. You can chose which parts you want to improve by using new language features based on their usefulness for your particular project.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oracle is always very careful to keep new Java versions compatible with older versions. You should be able to run your code on Java 7 without changing anything (you don't even need to recompile your code).

There might be some minor issues, which Oracle explains in detail here: Java SE 7 and JDK 7 Compatibility
 
diksha singh neel
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What appserver are you using?
 
Anurag Verma
Ranch Hand
Posts: 167
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
diksha singh neel wrote:What appserver are you using?


Is this question really required??
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18091
48
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't changed a thing since I went from Java 6 to Java 7, and I cannot actually recall coding anything specific to Java 6. Although some of the resources I tap into probably do so. If I'm not mistaken, Java 6 finally got annotations to be civilized.

I think you read the specs on HashMap wrong. A number of classes in their original implementations were synchronized, including Vector. When Sun began to seriously implement collections, the newer stuff was all non-synchronized, and a simple capability was supplied to make any particular instance of a collection be synchronized. The older, always-synchronized classes remain, however, and they continue to be synchronized, just discouraged in favor of the default-unsynchronized classes. Hence StringBuffer/StringBuilder, Vector/ArrayList, and so forth.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm probably late to the game, but isn't this the issue in question: http://stackoverflow.com/questions/14010906/given-that-hashmaps-in-jdk1-6-and-above-cause-problems-with-multi-threading-how ?

In short, creating lots of HashMaps in Java 7 no longer scales well.
 
adam bilyone
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tnx
 
Campbell Ritchie
Sheriff
Posts: 48635
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It said on that SO thread that JDK7u40 had fixed that problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic