• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make clients receive updates

 
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


How to make clients receive updates automatically. The clients will be Swing desktop clients and the application will be a rmi application on the server accessible via net. there is no issue of firewall :0

Thanks,

Maki Jav
 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that something like Observer/observed ie Observer pattern pattern will be used?

Thank you,

Maki Jav
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are lots of ways for a client application to register with a server to receive messages. Java Message Service, JavaSpaces, even email. In Java one of the easiest approaches would be to use a HTTPserver and have the clients periodically query it for new data.

How big is a data update?
Can updates be plain text? XML? Some other file format?
Whats the maximum acceptable delay between an update being made available and all clients having the data?

Bill
 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you William Brogden for responding me. I am interested in RMI solution. The data will not be big.

I have made a observer/Observable paradigm classes. The idea is that I have a observable object which will keep on running on the server and I have various Observer instances. Any change in the Observable is notified to the Observers over rmi. I have compiled these classes using JDK1.4.


RemoteObservable.java
RemoteObservableImpl.java
RemoteObserver.java
RemoteObserverImpl.java

And after that I compiled them using:
rmic -d . RemoteObservable RemoteObservableImpl RemoteObserver RemoteObserverImpl

The package is adil.

Q. 1) Why am I getting RemoteObservableImpl_Skel.class and RemoteObserverImpl_Skel.class in addtion to RemoteObservableImpl_Stub.class and RemoteObserverImpl_Stub.class? I heard that newer compilers do not create skelton classes.

After starting rmiregistry I run RemoteObservableImpl using the following

java -Djava.security.policy=./java.policy adil.RemoteObservableImpl

Now the test in which I am getting problem.

The tester class is

class Tester.java



I am using this command:
java -classpath adil;. Tester


java.lang.ClassCastException: adil.RemoteObservableImpl_Stub
at Tester.main(Tester.java:25)

Q. 2) I am getting the above exception. Why am I getting a stub instead of RemoteObservableImpl Object from rmiregistry? And how to deal with it? How to use it?


Thank you,

Maki Jav

ps: William Brogden i have your book too.
[ December 30, 2007: Message edited by: Maki Jav ]
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alas, I can not help with those questions:

1. It has been a long time since I used RMI
2. I no longer have a JDK 1.4 anywhere, all my systems have Java 1.6 as the normal Java.

Maybe it is time for you to update to 1.6 also.

Bill
 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am successful in implementing Observer/Observable pattern atlast. it was a long standing desire!

I used three clients to test it from three different folders. The first client reflected it when
the second client logged on; the fist and second clients reflected it when the third client
logged on. The first client showed 3 messages, the second shwoed 2 and the last showed 1 message.


First client window
RemoteObservableImpl_Stub[RemoteStub [ref: [endpoint:[127.0.0.1:1045](remote),ob
jID:[e53108:117309386e9:-8000, 0]]]]
HELLO 1
RemoteObservableImpl_Stub[RemoteStub [ref: [endpoint:[127.0.0.1:1045](remote),ob
jID:[e53108:117309386e9:-8000, 0]]]]
HELLO 2
RemoteObservableImpl_Stub[RemoteStub [ref: [endpoint:[127.0.0.1:1045](remote),ob
jID:[e53108:117309386e9:-8000, 0]]]]
HELLO 3



Second client window
RemoteObservableImpl_Stub[RemoteStub [ref: [endpoint:[127.0.0.1:1045](remote),ob
jID:[e53108:117309386e9:-8000, 0]]]]
HELLO 2
RemoteObservableImpl_Stub[RemoteStub [ref: [endpoint:[127.0.0.1:1045](remote),ob
jID:[e53108:117309386e9:-8000, 0]]]]
HELLO 3



Third client window
RemoteObservableImpl_Stub[RemoteStub [ref: [endpoint:[127.0.0.1:1045](remote),ob
jID:[e53108:117309386e9:-8000, 0]]]]
HELLO 3

I was getting java.net.Connection Exception earlier in RemoteObservableImpl but then I turned
off the computer and now I am not getting any such exception.

So now the bare bones application is ready on which any command promt, Swing-based or other applications
can be built.

I now want to have help from you guys in improving this code. Maybe I am making some mistake/logical
error somewhere in my classes.

Tester code is above.

It needs correction:

 
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have been able to run rmiregistry and bind remote object locally and access that object via a Servlet from my account at myjavaserver.com
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic