Dark Vachor

Greenhorn
+ Follow
since Oct 13, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Dark Vachor

Both Tomcat versions are buggy and slow to start, with wrong / misleading messages, are wrong stack traces on errors/exceptions. Both versions forces you to use their crappy and slow log4j package.
Anyway...
My choice would be the last version, as you'll probably have better support, and you'll likely have no configuration problems.
One thing handy in 5 is in the TOMCAT_HOME/conf/Catalina/localhost (why da f**** did they put an upper "C" ?) directory to receive contexts. But you do not have to use it.

Cheers !
20 years ago
Priya Sri,

You configured Tomcat to reload your app properly, the proof is that it reloaded one time. You say it doesn't reload the second time. Try a third time, or try to "touch" you servlet file. It *may* reload the app. Usually it doesn't, once it's stuck you'll have to relaunch the whole of it.
Apache software is no more the quality one is used to be. It's now very buggy, and bloated, and clunky. Probably as Apache inexperienced programmers believe to be the king of programmers, reinvente the wheel the wrong way, and refuse any critics because they re the bests. At least they should RTFM about Java classes (system libraries), and stop writing useless code. And they should stop make people have to use *their* crappy log4j logger.
20 years ago
Check your elements correctness and *ordering*.
It should solve ur problem.

It is sad apache software cannot help much with their error message. They are often inapropriate / wrong. And code intercepting exceptions and replacing them with their own exception should definitely be banned !
ASF loves reinventing the wheel, but they do it in a worng way : each cycle is more buggy and less performant than the previous one !
They should definitely stop doing all their stuff with their classes, and have a closer look at Java classes, the JRE system libraries. 3/4 of the code of httpclient, for instance, is useless, and moreover buggy.
What makes me also furious is that you have to have the crappy log4j library everywhere. It is slow and bloated. It's time to leave it.
20 years ago

I imagine that, just like Vector, Enumeration is used in way too many places to even think of deprecating it.


Enumeration is not that used... they could have deprecated it.
For example they deprecated Date:: getDate(), getDay(), getHours(), getMinutes(), and so on. This methods were often used in many programs !


Take a look at the dimensions of your loop!
If I reduce your code to 400.000 (!) iterations, it runs in <40ms on my machine. I think in many circumstances you wouldn't even notice that the program is spending time at all - even showing a simple output to the user is likely to take more time.


It's for testing. This way you see (when you keep the memory messages) the way the GC behaves.

Not of each, but of the important ones. It's the 90/10 rule at work: allmost every system is spending around 90% of its time in 10% of its code. That is, if you optimize the wrong 90%, you only get a 10% performance improvement, but if you find the bottlenecks, you get a significantly better performance for less effort. That is why profiling is so important before optimizing code.


Of course I agree.

1.5x on my sytem when using your code. And when you make your loop actually *do* something, it becomes even less.


The test does not refect reality, I think most people agree on that.
This is a test, and it tests only Enumeration vs Iterator.
20 years ago

If you have a problem integrating with other peoples code does that mean that you write your own dB drivers, JVM, and OS?


Of course I do not. Writing my own web framework or other framework stuff is no good idea to me. There are so many people out there willing to do it. And some do a good job. What I say is that if I choose a framework / tool, I need to evaluate it and be confident that thousands people used it and are satisfied with it, good documentation, mailing list, bug notification and report, etc. The tools must keep a simple and fonctional approch too. Tomcat and hibernate are good enough for me. Struts might be a good tool, bit it's too heavy to learn for my developers for the benefits we will pull out of it. Moreover it is not compatible with web sites editing tools to make great looking web sites.
20 years ago
BTW Ilja, thank you for making the program I posted more readable with good line wrapping.

One more point on the subject, Enumeration is still here in J2SE 1.5, if it was to be replaced by Iterator in all cases, shouldn't it be declared deprecated ?
20 years ago
Of course it is pretty fast. Do you mean Java is slow ? ;-)
If everyone doesn't care about doing stuff with means that are slow, programs are slow, and Java (!) is considered slow (they should say the JVM...). Because programs are a matter of creating objects and calling methods, we should take care of each object and each call.

Back to original subject, my benchmark shows that Enumeration is nearly x2 faster than Iterator...
20 years ago
Sorry I meant "Creating many Iterator or many Enumeration does NOT cost the same !"

Bu the way, keep in mind that many people think Java is slow. And they are right because too many programmers don't care with programming for good performances. Same for memory footprint.
Multi-threading is likely to be useful. Performance is always appreciated, and sometime performance requirement is an iten of a contract.
20 years ago


Multithreading problems are really hard to find, so I am willing to use all the help I can get. I think of that as rather professional behaviour



I think professional attitude is determining the best thing to do according to the risks of wrong usage of your classes. I have a very strong experience in multi-threading, and have no problem with it. That's probably while I feel tuning for performance is best ;-)


Conclusion: If you have a java-program - run it twice?



I did it, of course, I'm no greenhorn ;-) ... in reality

In fact you probably forgot the time to create the Iterator or Enumeration objects. Creating many Iterator or many Enumeration does cost the same !!!
Try a more intensive program like this :


(1000 collection of 4000 elements, loop 100 times on each => 4000000 elements, 400000000 element access)
Then just switch the Enumeration to an Iterator, and see by yourself :-)
Tip : use -Xmx256m at least.
My results :
Enumeration : 46852 ms
Iterator : 85546 ms

[edited the code so that it doesn't screw up the page layout because of overly long lines - Ilja]
[ October 14, 2004: Message edited by: Ilja Preuss ]
20 years ago
Why are you looking to struts plugin ?
You should switch to JSF. It's worth it.
20 years ago
Using the lastest version might leave you with bugs anyway.

Why don't you all use better software, tested and validated, instead of using all piece of crap you stumble on ? Many applications have problems with "not so tested" "frameworks".

Think of this :
A software that works is a software that uses good framework/libraries/tools on a working OS on working harware on working network.
If you do not qualify you tools/frameworks/libraries, you miss the point.
20 years ago
As I write this message there are 13 times the word "struts" in topics of the "Web Application Frameworks" section.
I count 4 times the word JSF in the place.

I wonder why JSF is not more adopted. There are guys saying JSF will not compete with struts. I think it is definitely worth a GOOD test, and will likely replace struts in most places.

So why are people adopting it so slowly ?
Any ideas on that ?
20 years ago
JSF
JavaServer Faces (JSF) is a framework for building web-based user interfaces in Java. Like Swing, it provides a set of standard widgets (buttons, hyperlinks, checkboxes, and so on), a model for creating custom widgets, a way to process client-generated events (like changing the value of a text box or clicking on a button), and excellent tool support. Since web-based applications, unlike their Swing cousins, must often appease multiple clients (desktop browsers, phones, PDAs, and so on), JSF has a powerful architecture for displaying components in different ways. It also has extensible facilities for validating input (like the length of a field) and converting objects to and from strings for display. Faces can also automatically keep your user interface components in sync with your business model objects.
JSF includes a powerful controller, and will support tools to enable RAD. JSF is the way to go in a post-Struts context.
There's a kick ass RAD tool that supports JSF : Sun's Java Studio Creator.
Craig McClanahan, author of Struts, contributor to JSF and Java Studio Creator once said an experienced developer with Creator may be up to 8 times more productive than a struts user.

I am going to use JSF for my next Web app.
20 years ago
Sorry guys

I ran my own tests which show that Enumeration is nearly twice faster than Iterator, and takes far less memory, enabling the GC to sleep more ;-)
I'm not really surprised of it, since Enumeration is quite basic and fits basic needs, while Iterator tries to see if there are concurrent modifications or so, and consequently takes more power.
SUN recommends usage of Iterator beacause :
- They sell hardware
- There are so many poor developers out there

Kind regards
20 years ago