chander shivdasani

Ranch Hand
+ Follow
since Oct 09, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by chander shivdasani

Ya, i agree to Deepak. Its mainly by trial error.
One thing to look is how often does JVM do GC. Make sure its not spending most of its time doing GC.
12 years ago
If you have an access to your department cluster, look at Hadoop.
12 years ago
ConcurrentHashMap is the way to go.

Prior to Java 5, the only way to concurrently access a HashMap was to synchronize the entire map. In case of high contention, this solution would fail as most of the threads would be waiting for other thread to release the lock on Map. Java 5 brings ConcurrentHashMap, in which only a part of the Map is locked, such that many threads can access different parts simultaneously. This optimization is possible, since HashMap stores their data in buckets. This optimization is known as lock striping.

12 years ago
Your best bet would be to use a profiler to see if you have any memory leaks. Another thing is to analyze your GC log file to see what your average heap usage is. If, Full GC is happening every 2 mins, it hints that you might have insufficient heap size. Try to increase it by a GB or two.
Can you run the "top" command along side and make sure that swap space is not being used. A swap space is nothing but a portion of Hard Disk which JVM uses as a backup memory when you dont have enough RAM. Accessing pages on hard disk can increase your pause times by several magnitudes. The chances of this happening is very less, but there is no harm in confirming.

12 years ago
I wanted to get started on analyzing my java code for performance tuning. Can anyone recommend me any books/links/blogs that can help me get started on this topic.
12 years ago
There seem to be multiple ways of doing I/O in Java. How does one decide which one to use.
For example:

I can accept user's input through stdin in the following two ways:



Version 2:



I'm pretty sure there might be other ways to read the input as well. Are there any guidelines which i can follow when selecting which method to use?
12 years ago
How does one keep themselves abreast with the new developments that occur in Java. Every time a new Java version comes up, within days there are books published that provide introduction to these new concepts. How does a author stay in touch with these new features? Are there any online communities that provide a list of features that will be released in a newer version of Java?
12 years ago
I've been a core java programmer all this while and wanted to know good books/links for getting started with j2ee. Something that can provide me with a top level view of where all the components fit in. There are just way too many acronyms floating around like servlets, jsp etc.

12 years ago
Let me try to explain you what the first method does:




Try to understand this method clearly. The best way is to use pen and paper and try to do it yourself.

Try doing the same with the second method and see if you are able to understand.
[edit]Add new lines CR[/edit]
12 years ago
I'm not really sure what you're being asked to do in your assignment. Is correcting the code part of your assignment? Because, if you're professor has given you this code and simply asked you to execute it, then there is a bug in his code.



12 years ago
Look at your function signature:



It says your function will return a char Array

When calling your function from main, you are storing the method's return value in a char Array

However, what you're really returning is a single character (char first) and not a character array. Which is what you're compiler is complaining.

12 years ago
In that case, your main method should look something like this:


12 years ago
There you go:




You defined your method inside main. Which is why your IDE was throwing exceptions. I think you should spend some time reading this: http://download.oracle.com/javase/tutorial/java/
12 years ago
Did you enclose your main method within a class?

If you are so new to java, i would recommend using a notepad or any other text editor. Type what you feel the answer is and compile your code. Check for compilation errors. I dont want to give you an exact answer as that would defeat the purpose of your assignment. Try doing what i have said and paste the compilation errors that you're getting. Also, paste what code you have written.

12 years ago
Even i would say that its a JVM crash, hence a bug in JVM.

Important thing is, how often do you see this crash? If you have a setup that causes this crash 100% of the time, your best bet would be to file a bugreport and have them check it


12 years ago