avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: asynchronous connection manager
Date Fri, 22 Feb 2002 15:42:59 GMT
Emperor wrote:
>  
> hi,
>  
> for my project I'll build an asynchronous connection manager. Are there
> default ways of registering event listeners in avalon? or any event base
> classes? here are the interface models I used in a previous project
> (throws left out), would be great if anyone can have a look about it -
> how to implement it in avalon and so on... I will supply my work to the
> avalon cornerstone project:


First, the EventListener and Event stuff is written in Excalibur's
Scratchpad.  It works pretty well, and is probably up for promotion
soon.

I started to provide an interface for a SEDA like architecture--but had
to back off for a little while.  I have a Stage interface and a
SinkMap interface set up.  The Stage implements (or should implement)
EventListener and has a method for the container to give it one or more
Sinks to send its events to.

The StageManager or SilkServer whatever we want to call it is
responsible for connecting the stages to each other (and validating the
system).  You can also take a look at the CommandManager for one way
of assigning ThreadPools to Queues.

>  
> interface EventListener
> {
>     handleEvent (Event e);
> }
>  
> interface Acceptor
> {
>     public void bind(int port);
>     public void bind(int port, int backlog);
>     public void bind(InetAddress address, int port);
>     public void bind(InetAddress address, int port, int backlog);
>     public void unbind();
>  
>     // raises bound, unbound, accept (passes connection), accepterror
> events
>     addEventListener(EventListener eventlistener);
>     removeEventListener(EventListener eventlistener);
>     // more avalon way to manage events?
> }
>  
> interface Connector
> {
>     public void connect(InetAddress address, int port);
>  
>     // raises connect (passes connection), connecterror events
>     addEventListener(EventListener eventlistener);
>     removeEventListener(EventListener eventlistener);
>     // more avalon way to manage events?
> }
>  
> interface AsynchronousConnectionManager
> {
>     // more avalon like way of retriving connector instances? this is
> simple because connector is a nested class
>     public void createConnector();
>     public void addConnector(Connector connector);
>     public Enumeration getConnectors();
>     public void removeConnector(Connector connector);
>     // should I use connect / disconnect instead?? i find this approach
> more appropriate
>     
>     // more avalon like way of retriving acceptor instances? this is
> simple because connector is a nested class
>     public void createAcceptor();
>     public void addAcceptor(Acceptor acceptor);
>     public Enumeration getAcceptors();
>     public void removeAcceptor(Acceptor acceptor);
>     // should I use connect / disconnect instead?? i find this approach
> more appropriate
>  
>     public void start();
>     public void stop();
>     public boolean isRunning();
>     public boolean isStopping();
>     // will disappear in avalon impl... compose/dispose instead?
> }
>  
> interface AsynchronousConnection
> {
>     send(byte[] data);
>     disconnect();
>  
>     Acceptor getAcceptor();
>     Connector getConnector();
>  
>     // raises connect, read, disconnect event
>     addEventListener(EventListener eventlistener);
>     removeEventListener(EventListener eventlistener);
>     // more avalon way to manage events?
> }
> 
> 



-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message