[Backgroundrb-devel] MiddleMan singleton issue in start script

Christian Romney xmlblog at gmail.com
Mon Oct 16 11:06:39 EDT 2006

Hi all,

I found this thread in the August backgroundrb-devel archives.

>This means that in order to reference the new_worker method *in the
>instance that is running in the drb server* you can't do that
>directly. In order to spawn other workers from within a worker I
>would have to change the MiddleMan class to be a singleton. This way
>you could grab the one instance of it and call new_worker on that and
>it would work as expected. But the way it is currently setup, you
>don't have a reference to the Main MiddleMan instance from within
>your workers.

>    I don't think making the MiddleMan class be a singleton would affect
>any current code but I will have to test this. If it doesn't interfere then
I think it makes sense to turn the MiddleMan into a
>singleton. that way you cold gain access to it from within worker

I didn't see anything after that date complaining about the issue I'm
seeing, so here it is:
The start script has two lines of code that call MiddleMan.new. This results
in a NoMethodError,
because when you include Singleton it makes this method private. Attached is
my patch, which I've also
submitted on Rubyforge. It calls MiddleMan.instance, but the parameters to
new get nuked. This got my start
script working again, but I read that the whole start script will change
soon when the new version using slave comes out,
so I'm not sure it'll do anyone much good. Regardless, passing it on for
good karma.

This patch was created against the current rev (as of this writing), which
is 47.

Best Regards,
Christian Romney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061016/a7cda523/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixed_singleton_in_start-rev47.patch
Type: application/octet-stream
Size: 477 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061016/a7cda523/attachment.obj 

More information about the Backgroundrb-devel mailing list