avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Carey (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AVRO-544) Allow the HttpServer to serve forever without a call to Thread.sleep()
Date Tue, 06 Jul 2010 21:27:50 GMT

    [ https://issues.apache.org/jira/browse/AVRO-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885694#action_12885694

Scott Carey commented on AVRO-544:

+1 on AVRO-544-2.patch

bq. What's the rational for splitting these up? If you need to have explicit control over
starting/stopping the server, then I would have a start() method as per above, otherwise just
put both into the constructor.

start() should not block.  The constructor should most definitely not block.  If a user wants
to block, there is join(), they should not be forced to block and burn up a thread.

Use cases I've had where I don't want to block are numerous.

Here is an example, two servers with different ports / configurations plus a thread pool with
scheduled tasks for custom business logic:

MyCustomExecutorService pool = ...
HttpServer server1 = ...
HttpServer server2 = ...


boolean shutdown = false;
while(!shutdown) {
  shutdown = MyCustomShutdownListener.awaitShutdown();

Also, it is generally better to explicitly start asynchronous activities after construction
and configuration of their representative entities -- there are many use cases where construction
and starting should be separated.

> Allow the HttpServer to serve forever without a call to Thread.sleep()
> ----------------------------------------------------------------------
>                 Key: AVRO-544
>                 URL: https://issues.apache.org/jira/browse/AVRO-544
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>            Reporter: Jeff Hammerbacher
>            Assignee: Jeff Hammerbacher
>             Fix For: 1.4.0
>         Attachments: AVRO-544-2.patch, AVRO-544.patch
> One way would be to expose the join() method on the HttpServer: http://jetty.codehaus.org/jetty/jetty-6/apidocs/org/mortbay/jetty/Server.html#join%28%29

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message