RE: (Fwd) RE: Re: [Rcosjava-general] messaging system
Status: Beta
Brought to you by:
newmana
From: <and...@ne...> - 2001-12-02 01:08:50
|
>Andrew, > >I don't understand how a post office gets a registeredHandler >without a call to super(id) in OSOffice, which would call >addHandler(). I assume things would happen like this: > >OSOffice osPostOffice = new OSOffice(M_ID); >// calls OSOffice constructor >OSOffice(String newId) >{ > id = newId; >} >// no call to super: compiler inserts super() which calls >PostOffice(){ } >// does nothing!!! so the compiler inserts another super() ending up at >SimpleMessageHandler(){ } >// which also does nothing. > >I see that the OSOffice constructor initialises id, which is a member >of SimpleMessageHandler (supersuperclass). > >I must be barking up the wrong tree but I can't figure this out. > I hope I'm following what you want. You're wondering how an OS or Animator level object registers with their PostOffice. That is, how does it end up in the registeredHandlers TreeMap and receive messages to process. For example, the Kernel calls super(String, OSOffice). OSMessageHandler creates a new AddHandler message and calls processMessage on the OSOffice. AddHandler calls the addHandler method on PostOffice (which actually is found in SimpleMessageHandler). This adds the Kernel to registeredHandlers. Animators do the same thing except using AnimatorMessageHandler and AnimatorOffice. The stuff that is confusing is the constructor in PostOffice. For example, type (the class name) is not used by anything but exists there. -- __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ |