activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino" <hi...@hiramchirino.com>
Subject Re: AMQ-1273
Date Wed, 13 Jun 2007 20:21:19 GMT
I think I would rather keep code like that out of the broker.  If you
want do do async operations with the broker, the end user could always
just use an executor and a FutureTask.  See:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Future.html

On 6/13/07, eta <eric@ultracode.com> wrote:
>
> Would this patch be too simplistic?  Or plain wrong for some reason?  It
> would give apps the option to start up the broker in a separate thread.  One
> problem I could see would be that they wouldn't receive any notification as
> to the success/failure of the broker initialization.  Perhaps a callback
> interface to the app would solve that?  --Eric
>
> Index:
> BrokerService.java===================================================================
> --- BrokerService.java  (revision 547009)
> +++ BrokerService.java  (working copy)
> @@ -391,6 +391,21 @@
>          return started.get();
>      }
>
> +    public void startAsync() throws Exception {
> +        Thread startupThread = new Thread (new Runnable() {
> +            public void run() {
> +                Log log = LogFactory.getLog(BrokerService.class);
> +                try {
> +                    start();
> +                }
> +                catch (Exception ex) {
> +                    log.error("Failed to start broker", ex);
> +                }
> +            }
> +        });
> +        startupThread.start();
> +    }
> +
>      // Service interface
>      //
> -------------------------------------------------------------------------
>      public void start() throws Exception {
>
> --
> View this message in context: http://www.nabble.com/AMQ-1273-tf3917378s2354.html#a11107435
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Mime
View raw message