Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is J2EE capable of this (something like a win service)  RSS feed

 
Steve Buck
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been doing Java for a little time now. Played with RMI, sockets, threading and am comfortable using it as a language so I want to move onto bigger things.

I am looking to develop something (as described below) but I'm not sure if J2EE can do such things. I've had a basic primer on JSP and servlets to know they are NOT what I want.

Situation:
Many physical sites will have multiple clients at each site. Client software (applets) will interact with the server using some method--probably sockets. Basic business operations like creating and updating records (exact data is irrelevant here). Data is stored in a database and controlled by the server. The server at each site will need to both push and pull updates between sites on timed triggers.

I've read very basic information on J2EE but the things I hear repeatedly are: JSP, servlets and web services. I doubt web services would be good for what I want to do--the server service must be running continously and execute specific tasks on regular timed intervals (like data exchange between sites). As far as I know web services must be called on? They just start, run, and destroy?

I am familiar with .NET and had, at first, thought of just doing a windows service with desktop forms clients. This would be pretty damn easy with .NET but I'd like to give J2EE a try if it can do this or something very similar.

Forgive me if this is the wrong forum but it had "Other J2EE Technologies" so I figured this would be the place to ask about J2EE technical capabilities
[ November 24, 2004: Message edited by: Steve Buck ]
 
Steve Buck
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am wondering--are servlets capable of this? When I think "servlets" all I know about are HTTP servlets but surely the other servlets must exist?

Perhaps this is what I have been looking for all along--servlet like thing
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve,
Interesting question. This is definitely the right forum.

A big part of J2EE that you didn't mention is EJBs. I think they are something that will be useful for you. They are built on top of RMI and sockets and receive remote calls. They also provide transactional and security support. However, EJBs have the same limitation of web services in that they must be called.

You could have your applet poll the server periodically. Otherwise, you would have to write something more customized with RMI. The server could keep a reference to all the clients and push content to them when necessary.

And welcome to JavaRanch!
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, servlets do not have to be HTTPServlets. A Servlet is really just an interface. Servlets are also stateless though and cannot push content.
 
Steve Buck
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could have your applet poll the server periodically. Otherwise, you would have to write something more customized with RMI. The server could keep a reference to all the clients and push content to them when necessary.


Thanks for the feedback!

Though, I think both solution you provided sounds too much like "patchwork" Would the method with RMI be "clean" in your professional opinion? When I say I know some RMI, it is very limited knowledge of using simple method calls and RMIRegistry.

Darn...here I was hoping J2EE would have something like this like it has Servlet and JSP. I might have to use .NET (whoops... I think I said a bad word )
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve,
I favor the polling solution. Polling if fairly common and acceptable if you don't have too many clients. The RMI solution relies on a very close integration with the clients. But then so does the .NET solution.
 
Steve Buck
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hrm.

Problem with polling: I just don't like that "design". To me it just seems kind of shoddy, ya know?

As for the client count...each site will have anywhere from 25 to 50 concurrent clients.
[ November 30, 2004: Message edited by: Steve Buck ]
 
H Sivad
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Buck:
Hrm.

Problem with polling: I just don't like that "design". To me it just seems kind of shoddy, ya know?

As for the client count...each site will have anywhere from 25 to 50 concurrent clients.

[ November 30, 2004: Message edited by: Steve Buck ]


Look at Java Messaging Service as a possible solution, from what you say. No timed triggers needed. You put the update on a queue and it waits there until it's consumed. If you wish to update (synchronize) multiple servers with your records, you can use the pub/sub paradigm. When a client updates a record, the server would publish that message. Your other servers would subscribe to the topic, and update there state accordingly. If the servers are "durable subscribers", the message is retained until they come on line and consume them. so if a site is off line, they get the updates when they come on line.

Having worked with both J2EE and .NET, I don't really see any advantage to the .NET framework in this case. There are queues in .NET, but the JMS spec is more mature and better thought out (IMO).

H.
 
Steve Buck
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks! I'll definitely look more into Java Messaging Service. My knowledge of it is limited to very basic intro details of Message-Driven Bean.

I hope this sort of solution can work out properly. I'd really love to give J2EE a shot for this project. It would be a great learning experience.
 
Robert Hayes
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Steve,

For my current project I was trying to also keep EJB out of the picture, but MDBs were just too good to pass up. And I believe they are the easiest EJB to use.

The great thing about going JMS instead of RPC, for example, is that it's asynchronous and decouples your systems very nicely.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!