Your own behaviours
Sean Hinde
Sean.Hinde@REDACTED
Mon Oct 1 11:34:29 CEST 2001
Hi guys,
I looked at using a combined application/top supervisor when first looking
at OTP and using the existing apps as a guide.
I concluded that any benefits (are there any?) were lost if you end up with
a hotch potch of different techniques which have to be individually figured
out later in maintenance mode.
The emacs mode produces very fine templates which we use across all our
applications. This means that I can look at Chandru's code and immediately
see how it starts up, and others can look at mine and all is clear.
The naming convention we use is always:
uoty_app - application behaviour
uoty_sup - top level supervisor
uoty_server - main server process
Let's keep it simple
Cheers,
Sean
> I'll go thru the code for these modules and study them. Thanks! But I
> suppose you can do more than just start the top level
> supervisor in the
> "top" module. You can have code to do different things in different
> application start phases for example.
>
> cheers,
> Chandru
>
> > -----Original Message-----
> > From: Vance Shipley [mailto:vances@REDACTED]
> > Sent: 27 September 2001 13:51
> > To: Chandrashekhar Mullaparthi
> > Cc: erlang-questions@REDACTED
> > Subject: RE: Your own behaviours
> >
> >
> > Chandru,
> >
> > This is an issue I have visited before. The first time we packaged
> > an "application" I found it odd that the top module, having
> behaviour
> > application, did pretty much nothing but start top level supervisor
> > which was implemented in another module. I wondered why the
> > supervisor
> > couldn't also be the application master. Looking at the callbacks
> > which the two behaviours have I saw no conflict. Then I looked at
> > OTP for examples and that is just what I found. Some
> notable modules
> > which behave as both supervisor and application master are kernel
> > and sasl.
> >
> > Here is the example from kernel.erl:
> >
> > -module(kernel).
> >
> > -behaviour(application).
> > -behaviour(supervisor).
> >
> >
> > I wrote a shell script to find all examples (included below) and
> > here is the list from R7B-3:
> >
> > ./lib/sasl/src/sasl.erl
> > ./lib/kernel/src/kernel.erl
> > ./lib/mnesia/src/mnesia_event.erl
> > ./lib/mnesia/src/mnesia_sup.erl
> > ./lib/mnemosyne/src/mnemosyne_sup.erl
> > ./lib/mnesia_session/src/mnesia_session_top_sup.erl
> >
> >
> > -Vance
> >
> > Vance Shipley
> > Motivity Telecom Inc.
> > +1 519 579 5816
> >
> >
> > find_multiple_behaviours.sh:
> > #! /bin/sh
> > for i in `find . -name "*.erl"`
> > do
> > if [ `fgrep -c "behaviour(" $i` -gt 1 ]
> > then
> > echo $i
> > fi
> > done
> >
>
>
>
> NOTICE AND DISCLAIMER:
> This email (including attachments) is confidential. If you
> have received
> this email in error please notify the sender immediately and
> delete this
> email from your system without copying or disseminating it or
> placing any
> reliance upon its contents. We cannot accept liability for
> any breaches of
> confidence arising through use of email. Any opinions
> expressed in this
> email (including attachments) are those of the author and do
> not necessarily
> reflect our opinions. We will not accept responsibility for
> any commitments
> made by our employees outside the scope of our business. We
> do not warrant
> the accuracy or completeness of such information.
>
NOTICE AND DISCLAIMER:
This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.
More information about the erlang-questions
mailing list