java/j2ee tips and blueprints
java/j2ee tips and blueprints
It is a very sad thing that nowadays
there is so little useless information.
Oscar Wilde
Why I haven’t tried JPA?
I have been implementing java for 4 years and what I have learned: “not all Java API’s are good” but there are some open/vendor APIs you should prefer.
more...
DistributableEventPublisher for Spring via JGroups
Messaging is really easy through a single JVM. For a distributed environments JMS is strongly recommended. but for smaller and simple projects here is and example implementation via JGroups.
Usage
DistributableEventPublisher distributableEventPublisher=….
distributableEventPublisher.castEvent(TEXT_MESSAGE/XML/Serializable);
requirements:
- springframework 2+
- JGroups 2.6.1
- JUnit (for test)
more...
for <distributable/> j2ee application
no matter what size is your application distributable should be always under consideration. otherwise it becomes a full pain full reimplementation of whole application. yes reimplementation is always good but for developers it is always painful and for customers it is always very but very expensive.
here is some key points
Model extends Objects implements java.io.Serializable
Your model objects and communication objects should be Serializable. Do not forget serialization is the most important feature. it necessary for caching,messaging,storing,…
API replacements
Every instance should be aware of its copies in cluster. so you may need some api replacements like
Map->DistributedHashtable : nice seamless implementation from JGroups.
Cache->Distributable cache: (eg:EhCache,OSCache)
Observer,Listener>JMS Queues : for whole notifications in the cluster.
Timer->Quartz distributable scheduler
more...
You can know the name of a bird in all the languages of the world, but when you're finished, you'll know absolutely nothing whatever about the bird... So let's look at the bird and see what it's doing -- that's what counts. I learned very early the difference between knowing the name of something and knowing something.
Richard Feynman