Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Poobhathy Kannan

Ranch Hand
+ Follow
since May 26, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Poobhathy Kannan

Because, you can see from the error message, the JVM does a arrayCopy when it expands the StringBuilder. If the StirngBuilder needs to be expanded whenever you append a char, then JVM will do this array copy again and again which consumes a lot of memory. I think you need to change your way of reading with buffering. try using readLine(byte[] b,int off,int len) method of ServletInputStream.
10 years ago
i think sysout will be faster than logging in DEBUG level. but when your application goes to production, you will not log everything. if you do so you have to face a big performance issue. logger gives you much convenient ways implement logging.
10 years ago
Animesh, shouldn't your application deployed under webapps? .... webapps>MyApp>WEN-INF>classes
10 years ago
surya, it good to know how to find the class version.But I doubt that finding the class version in your class file will be helpful for resolving this issue and it is already in the error message given by ant and the class version is 50. you should use the component(sanjdk.jar) compiled with compiler compliance level 1.5, or as Rob suggested upgrade your JVM
10 years ago
Kri Shan, By stating in-memory caching, do you mean having a static instance variable of HashMap? if so, you might need to synchronize the part accessing/updating this Map. Or you can try using http://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/api/java/util/Collections.html#synchronizedMap(java.util.Map)

HashTable is synchronized and can be used in multi-thread environment but it is kind of getting old.

10 years ago
Nilk, May i know why do you need to get the WAR file path? So that can think of an alternatives...
10 years ago
Should not be any problem unless those ports are used by other programs. you can use up to 65535. you can do a "netstat -ona" on command prompt and check whether these ports are already being used
i would prefer to keep the parameters list inside the method as it would be thread safe in a multi thread environment. And i would suggest to load the quarries form a properties file,cache it and use it, so that you will not need to change the source code for any changes in query

Apart from 'parameters' list and query, i would also suggest to change the method signature to return List than ArrayList. Always better to have the return type as an interface unless you have any special reasons to return the concrete class.it hides the internal implementation and also flexible for any internal changes.
10 years ago
In your first example, you override the method m() of A. so when you call x.m(), the overridden method is called and it prints "B".

But in the second, you have a new method m1(). so when you call x.m(), the inherited method is called and prints 'A'.

And i doubt whether you can call it as " static inner class ". it is just a static variable refers to a Anonymous inner class
10 years ago
it's not clear what you mentioned by "database updates will rollback, when database update fails". I don't think that data will just be rolled back if there is a update failure unless a system exception or an ApplicationException( with rollback=true) is thrown. I assume that you use CMT as you mentioned about REQUIRED Tx attribute.

I think this post would give you a better inside https://coderanch.com/t/444151/java-EJB-SCBCD/certification/MDB-Message-Redelivery-discard
you can try this if you haven't yet http://www.compoundtheory.com/javaloader/docs/
10 years ago
i think you should have used ServletContext#getInitParameter method
10 years ago
I would prefer servlet filter as it would be a controller for all servlets
10 years ago
What i can think of is jar file or the classes loaded at runtime. It may still refer to the old classes. As you have changed the code, please check whether only the modified classes are loaded at runtime
10 years ago