My Photo

Become a Fan

DailyMile

Google Ad Skyscraper

« JCA, a thread too far. | Main | XA and Oracle with WebSphere »

September 17, 2003

Comments

Nicholas

Do you mean J2SE timer ? Or J2EE timer ? The J2SE time is java.util.Timer. Not spectacular, but pretty harmless... should not be an issue in J2EE.

Billy

It's an issue. It's an implementation and doesn't let me provide the function. It makes it's own threads, it calls the expired timers on its own thread and doesn't give me a way to make the thread a managed one with the right J2EE context. It's a naked thread and hence busts in a managed environment.

Greg

One of the many negatives of EJBs. There are so many occasions where the inherent limitations of EJBs recently have made me question using them, even stateless session beans. You can't create threads, you can't (necessarily) open files, testing is complicated by the fact that it has to be "in container", entity beans are inefficient enough that you have to torque your object design if you choose to use them, etc.

About the only advantage (possibly) IMHO is the transactional features, but once you decide to create a "service" interface layer, it isn't like it is THAT hard to do the new UserTransaction, commit/rollback code.

Servlets with packages like hibernate and good separation of layers provide most of the benefit without all of the negatives.

Billy

Servlets are great except for that fact that the business logic gets trapped. You can expose it using XML-RPC or something like that but arguable EJBs offer a 'better' design and as always with 'better', it depends on the customer and application.

There are advantages to being in a container, servlets run in a container. The main inconvenience of EJBs versus servlets is rmic and there is a stub generator in most RPC mechanisms otherwise the application is doing marshalling.

As you can see from WAS, we're working hard to remove can't from the J2EE vocabulary.
As for CMP versus Hibernate, I don't think there is anything inherently faster in either approach, it's a question of the maturity of the underlying persistence manager. The benchmarks (jSpec, ECPerf) are quickly driving major performance gains in the CMP PMs from the vendors. I'd be surprised if they were significantly slower than any other PM implementation at this point.

CMPs are only slightly disadvantaged when compared with a Java Bean based PM like Hibernate. I don't think it's as big an issue as you indicate.

I'd like to see benchmarks modified to use various JDO implementations and some comparisons made between Oracle/BEA/WebSphere and Hibernate. I'd just be keen to make sure the sames rules apply to both, i.e. no silly caching, jSpecApp has rules about this.

Jeff Morton

IS the AlarmManager available in EE only? If so, are there any other alternatives to AlarmManager?

Billy

Yep, it's WAS-E only an they aren't any other alternatives.

John

I believe that you have used the wrong tool. J2SE = Java 2 Standard Edition. It is NOT designed to be used in a distributed or managed environment. So, I think you should not bash it that much. J2SE was designed for you to write two things:
1) Applications
2) Applets

Not Distributed, multi-users, Enterprise Level software.

That's why there is a timer in J2EE. Now, you've got the J2EE 1.4 timer, you are arguing about it cannot be used in J2SE. I mean, don't you use the right tool to do the right?

For example, you can certainly use a fork to drink soup, but is it proper?

Also, you can use a spoon to cut steak, but is it easy to do so?

You can use a knife to eat rice, you'll just cut yourself.

Everything has it own purpose. So, I disagree your claim.

I understand why you want to do this, you are trying to promote the new BEA/IBM spec for the new Timer Spec. That's what I think. I know you like your product, your work, but that does not mean the others' effort and products are useless, flawed. Please be considerate to others' work.

Hope you understand, this is not a flame, okay.

Thanks,
John

Billy

John,
You're advocating having N programming models for the same thing. Why do we need N models? 1 for J2SE Timers, another for persistent EJB based timers etc. It increases tooling costs, forces programmers to learn N ways to do the same thing etc. It's a flawed argument.

Billy

Francis

If I just want to use servlet to create a polling process, if J2SE Timer class can be used? As it create it own thread, any protential problem?

If I don't use Timer class, I can start a thread from servlet, thread will sleep fixed period time, then wake up....

Any difference with two approach ?

Thanks.

Billy

No,
The servlet spec would have you believe that they can use threads and Timers. But, the J2EE spec clarifies it and says that neither is porta ble. The problem is that when the Timer expires or the thread starts, the J2EE server can't put the correct environment on the thread. This means that when you call in to WAS that you'll likely see null pointer exceptions etc as WAS is written to expect this environment in TLS, for example.

Akash

Hi ,
I would like to use a time based event in my application which would ping a paricular server and persist the availability in a DB.
Which one would best suit me (Iam using a WAS 5.1 server.)
Does WSAD 5.1 provide a timer bean facility...? I doubt.

The comments to this entry are closed.