[hunchentoot-devel] Handling multiple Hunchentoot instances with potentially conflicting ports
Hans Hübner
hans at huebner.org
Fri May 30 07:58:03 UTC 2008
Hi Raditya,
the problem that you see results from the fact that Hunchentoot sets
up the listen socket in a new thread. The handler and restart that
you set up around the START-SERVER invocation are not active in that
thread.
You may want to have a look at the new development version of
Hunchentoot. In this version, both LISTEN-FOR-CONNECTIONS and
EXECUTE-LISTENER are generic functions that you could augment with
:AROUND methods to handle port conflicts. The new version is not
finalized and these generic functions are not yet mentioned in the
official API documentation, but if you need to get running quickly, it
may be worth a try.
Use "svn co svn://bknr.net/svn/ediware" to check out the development
version of Hunchentoot and all required dependencies.
-Hans
On Thu, May 29, 2008 at 11:55 PM, Raditya Kertiyasa
<adit_kerti at yahoo.com> wrote:
> Hi everbody,
>
> I'm a Lisp newbie but I need to get my system up and running fast. I'm
> building a system that might cause multiple Hunchentoot servers to use
> conflicting ports. I want to handle this with an error handler and I've
> setup a wrapper function to start Hunchentoot and a restart function:
>
> ;; restart function to handle conflicting ports
> (defun ht-port-conflict-handler (condition)
> (... do something here to address the conflicting ports ...)
> (invoke-restart 'ht-port-conflict-handler))
>
>
> ;; Start Hunchentoot Server with error-handling
> (defun ht-start-with-error-handler ()
> (handler-bind ((simple-error #'ht-port-conflict-handler))
> (restart-case (setf *ht-handle* (hunchentoot:start-server
> :port *ht-port*))
> (ht-port-conflict-handler () nil))))
>
> The system should allow users to reconfigure their instance of Hunchentoot
> without having to invoke the debugger, but when I run this code I always end
> up in the debugger anyway. Can anybody tell me where I went wrong? Or maybe
> there's a better solution for my situation?
>
> Regards,
> Raditya Kertiyasa
>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
More information about the Tbnl-devel
mailing list