You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Martin Strand <ma...@entcap.se> on 2006/07/23 01:42:03 UTC
Get the Registry?
Is it possible to get a reference to the current thread's Registry? This
old post suggests it's not possible (yet), is that correct?
http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
Martin
RE: Get the Registry?
Posted by James Carman <ja...@carmanconsulting.com>.
Well, create a JIRA issue and we'll see about putting it into a 1.2 release.
This sounds like a pretty neat feature and it doesn't at first glance appear
to be that difficult.
-----Original Message-----
From: Martin Strand [mailto:martin.strand@entcap.se]
Sent: Monday, July 24, 2006 2:27 PM
To: user@hivemind.apache.org
Subject: Re: Get the Registry?
Ok, that sounds nice. I take it this is not going to make it into 1.2,
right?
Should I create a JIRA issue?
Martin
On Mon, 24 Jul 2006 20:17:14 +0200, James Carman
<ja...@carmanconsulting.com> wrote:
> We should probably put logic into the generated proxy classes so that
> they
> set a ThreadLocal variable somewhere to reference the Registry. Then,
> within any invocation you can access the current registry.
>
> -----Original Message-----
> From: Martin Strand [mailto:martin.strand@entcap.se]
> Sent: Monday, July 24, 2006 2:12 PM
> To: user@hivemind.apache.org
> Subject: Re: Get the Registry?
>
> Nice hack, Achim - backdoor access to RegistryInfrastructure. :)
> Yeah, it is a dirty hack but it actually seems to work so it will have to
> do for now. Thanks.
>
> Does anyone know if there are any plans to fix this so we can access the
> Registry without hacks?
>
> Martin
>
> On Mon, 24 Jul 2006 14:38:19 +0200, Achim Hügen <ac...@gmx.de>
> wrote:
>
>> Ok, what is coming now is a really dirty hack but might work:
>>
>> registry = (RegistryInfrastructure )
>> ServiceSerializationHelper.getServiceSerializationSupport();
>>
>> It's not the Registry interface you get but RegistryInfrastructure which
>> is as good as the
>> other one because the methods you need are defined there too.
>>
>> Achim
>>
>> Martin Strand schrieb:
>>> I need registry.setupThread() and registry.cleanupThread().
>>> I've got a service with a listener that is invoked from a thread
>>> outside Hivemind, something like this:
>>>
>>> public class MyService()
>>> {
>>> private Registry registry;
>>>
>>> public MyService()
>>> {
>>> registry = getThisThreadsRegistry();
>>> OutsideHivemind.registerListener(this);
>>> }
>>>
>>> public void invokeListener()
>>> {
>>> registry.setupThread();
>>>
>>> // Do lots of Hivemind stuff...
>>>
>>> registry.cleanupThread();
>>> }
>>> }
>>>
>>> On Mon, 24 Jul 2006 07:45:19 +0200, Achim Hügen <ac...@gmx.de>
>>> wrote:
>>>
>>>> Which part of the registry api do you need?
>>>>
>>>> Achim
>>>>
>>>> Am Sun, 23 Jul 2006 04:30:02 +0200 schrieb Martin Strand
>>>> <ma...@entcap.se>:
>>>>
>>>>> Yeah, that would be a simple solution but the problem is that my code
>>>>> doesn't control creation of the Registry. :(
>>>>> It's (sort of) a plugin so I want it to work in any Hivemind
>>>>> environment.
>>>>>
>>>>> Martin
>>>>>
>>>>> On Sun, 23 Jul 2006 03:54:13 +0200, Jason L. Buberel
>>>>> <ja...@buberel.org> wrote:
>>>>>
>>>>>> I use a class named Init with a static method on it to get my
>>>>>> singleton
>>>>>> registry.
>>>>>>
>>>>>> See the attached file.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
>>>>>>> Is it possible to get a reference to the current thread's Registry?
>>>>>>> This
>>>>>>> old post suggests it's not possible (yet), is that correct?
>>>>>>>
>
http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%
> 3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>>>>>>> Martin
>>>
>>>
>>
>>
>
>
>
>
Re: Get the Registry?
Posted by Martin Strand <ma...@entcap.se>.
Ok, that sounds nice. I take it this is not going to make it into 1.2,
right?
Should I create a JIRA issue?
Martin
On Mon, 24 Jul 2006 20:17:14 +0200, James Carman
<ja...@carmanconsulting.com> wrote:
> We should probably put logic into the generated proxy classes so that
> they
> set a ThreadLocal variable somewhere to reference the Registry. Then,
> within any invocation you can access the current registry.
>
> -----Original Message-----
> From: Martin Strand [mailto:martin.strand@entcap.se]
> Sent: Monday, July 24, 2006 2:12 PM
> To: user@hivemind.apache.org
> Subject: Re: Get the Registry?
>
> Nice hack, Achim - backdoor access to RegistryInfrastructure. :)
> Yeah, it is a dirty hack but it actually seems to work so it will have to
> do for now. Thanks.
>
> Does anyone know if there are any plans to fix this so we can access the
> Registry without hacks?
>
> Martin
>
> On Mon, 24 Jul 2006 14:38:19 +0200, Achim Hügen <ac...@gmx.de>
> wrote:
>
>> Ok, what is coming now is a really dirty hack but might work:
>>
>> registry = (RegistryInfrastructure )
>> ServiceSerializationHelper.getServiceSerializationSupport();
>>
>> It's not the Registry interface you get but RegistryInfrastructure which
>> is as good as the
>> other one because the methods you need are defined there too.
>>
>> Achim
>>
>> Martin Strand schrieb:
>>> I need registry.setupThread() and registry.cleanupThread().
>>> I've got a service with a listener that is invoked from a thread
>>> outside Hivemind, something like this:
>>>
>>> public class MyService()
>>> {
>>> private Registry registry;
>>>
>>> public MyService()
>>> {
>>> registry = getThisThreadsRegistry();
>>> OutsideHivemind.registerListener(this);
>>> }
>>>
>>> public void invokeListener()
>>> {
>>> registry.setupThread();
>>>
>>> // Do lots of Hivemind stuff...
>>>
>>> registry.cleanupThread();
>>> }
>>> }
>>>
>>> On Mon, 24 Jul 2006 07:45:19 +0200, Achim Hügen <ac...@gmx.de>
>>> wrote:
>>>
>>>> Which part of the registry api do you need?
>>>>
>>>> Achim
>>>>
>>>> Am Sun, 23 Jul 2006 04:30:02 +0200 schrieb Martin Strand
>>>> <ma...@entcap.se>:
>>>>
>>>>> Yeah, that would be a simple solution but the problem is that my code
>>>>> doesn't control creation of the Registry. :(
>>>>> It's (sort of) a plugin so I want it to work in any Hivemind
>>>>> environment.
>>>>>
>>>>> Martin
>>>>>
>>>>> On Sun, 23 Jul 2006 03:54:13 +0200, Jason L. Buberel
>>>>> <ja...@buberel.org> wrote:
>>>>>
>>>>>> I use a class named Init with a static method on it to get my
>>>>>> singleton
>>>>>> registry.
>>>>>>
>>>>>> See the attached file.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
>>>>>>> Is it possible to get a reference to the current thread's Registry?
>>>>>>> This
>>>>>>> old post suggests it's not possible (yet), is that correct?
>>>>>>>
> http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%
> 3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>>>>>>> Martin
>>>
>>>
>>
>>
>
>
>
>
RE: Get the Registry?
Posted by James Carman <ja...@carmanconsulting.com>.
We should probably put logic into the generated proxy classes so that they
set a ThreadLocal variable somewhere to reference the Registry. Then,
within any invocation you can access the current registry.
-----Original Message-----
From: Martin Strand [mailto:martin.strand@entcap.se]
Sent: Monday, July 24, 2006 2:12 PM
To: user@hivemind.apache.org
Subject: Re: Get the Registry?
Nice hack, Achim - backdoor access to RegistryInfrastructure. :)
Yeah, it is a dirty hack but it actually seems to work so it will have to
do for now. Thanks.
Does anyone know if there are any plans to fix this so we can access the
Registry without hacks?
Martin
On Mon, 24 Jul 2006 14:38:19 +0200, Achim Hügen <ac...@gmx.de>
wrote:
> Ok, what is coming now is a really dirty hack but might work:
>
> registry = (RegistryInfrastructure )
> ServiceSerializationHelper.getServiceSerializationSupport();
>
> It's not the Registry interface you get but RegistryInfrastructure which
> is as good as the
> other one because the methods you need are defined there too.
>
> Achim
>
> Martin Strand schrieb:
>> I need registry.setupThread() and registry.cleanupThread().
>> I've got a service with a listener that is invoked from a thread
>> outside Hivemind, something like this:
>>
>> public class MyService()
>> {
>> private Registry registry;
>>
>> public MyService()
>> {
>> registry = getThisThreadsRegistry();
>> OutsideHivemind.registerListener(this);
>> }
>>
>> public void invokeListener()
>> {
>> registry.setupThread();
>>
>> // Do lots of Hivemind stuff...
>>
>> registry.cleanupThread();
>> }
>> }
>>
>> On Mon, 24 Jul 2006 07:45:19 +0200, Achim Hügen <ac...@gmx.de>
>> wrote:
>>
>>> Which part of the registry api do you need?
>>>
>>> Achim
>>>
>>> Am Sun, 23 Jul 2006 04:30:02 +0200 schrieb Martin Strand
>>> <ma...@entcap.se>:
>>>
>>>> Yeah, that would be a simple solution but the problem is that my code
>>>> doesn't control creation of the Registry. :(
>>>> It's (sort of) a plugin so I want it to work in any Hivemind
>>>> environment.
>>>>
>>>> Martin
>>>>
>>>> On Sun, 23 Jul 2006 03:54:13 +0200, Jason L. Buberel
>>>> <ja...@buberel.org> wrote:
>>>>
>>>>> I use a class named Init with a static method on it to get my
>>>>> singleton
>>>>> registry.
>>>>>
>>>>> See the attached file.
>>>>>
>>>>>
>>>>>
>>>>> On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
>>>>>> Is it possible to get a reference to the current thread's Registry?
>>>>>> This
>>>>>> old post suggests it's not possible (yet), is that correct?
>>>>>>
http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%
3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>>>>>> Martin
>>
>>
>
>
Re: Get the Registry?
Posted by Martin Strand <ma...@entcap.se>.
Nice hack, Achim - backdoor access to RegistryInfrastructure. :)
Yeah, it is a dirty hack but it actually seems to work so it will have to
do for now. Thanks.
Does anyone know if there are any plans to fix this so we can access the
Registry without hacks?
Martin
On Mon, 24 Jul 2006 14:38:19 +0200, Achim Hügen <ac...@gmx.de>
wrote:
> Ok, what is coming now is a really dirty hack but might work:
>
> registry = (RegistryInfrastructure )
> ServiceSerializationHelper.getServiceSerializationSupport();
>
> It's not the Registry interface you get but RegistryInfrastructure which
> is as good as the
> other one because the methods you need are defined there too.
>
> Achim
>
> Martin Strand schrieb:
>> I need registry.setupThread() and registry.cleanupThread().
>> I've got a service with a listener that is invoked from a thread
>> outside Hivemind, something like this:
>>
>> public class MyService()
>> {
>> private Registry registry;
>>
>> public MyService()
>> {
>> registry = getThisThreadsRegistry();
>> OutsideHivemind.registerListener(this);
>> }
>>
>> public void invokeListener()
>> {
>> registry.setupThread();
>>
>> // Do lots of Hivemind stuff...
>>
>> registry.cleanupThread();
>> }
>> }
>>
>> On Mon, 24 Jul 2006 07:45:19 +0200, Achim Hügen <ac...@gmx.de>
>> wrote:
>>
>>> Which part of the registry api do you need?
>>>
>>> Achim
>>>
>>> Am Sun, 23 Jul 2006 04:30:02 +0200 schrieb Martin Strand
>>> <ma...@entcap.se>:
>>>
>>>> Yeah, that would be a simple solution but the problem is that my code
>>>> doesn't control creation of the Registry. :(
>>>> It's (sort of) a plugin so I want it to work in any Hivemind
>>>> environment.
>>>>
>>>> Martin
>>>>
>>>> On Sun, 23 Jul 2006 03:54:13 +0200, Jason L. Buberel
>>>> <ja...@buberel.org> wrote:
>>>>
>>>>> I use a class named Init with a static method on it to get my
>>>>> singleton
>>>>> registry.
>>>>>
>>>>> See the attached file.
>>>>>
>>>>>
>>>>>
>>>>> On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
>>>>>> Is it possible to get a reference to the current thread's Registry?
>>>>>> This
>>>>>> old post suggests it's not possible (yet), is that correct?
>>>>>> http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>>>>>> Martin
>>
>>
>
>
Re: Get the Registry?
Posted by Achim Hügen <ac...@gmx.de>.
Ok, what is coming now is a really dirty hack but might work:
registry = (RegistryInfrastructure )
ServiceSerializationHelper.getServiceSerializationSupport();
It's not the Registry interface you get but RegistryInfrastructure which
is as good as the
other one because the methods you need are defined there too.
Achim
Martin Strand schrieb:
> I need registry.setupThread() and registry.cleanupThread().
> I've got a service with a listener that is invoked from a thread
> outside Hivemind, something like this:
>
> public class MyService()
> {
> private Registry registry;
>
> public MyService()
> {
> registry = getThisThreadsRegistry();
> OutsideHivemind.registerListener(this);
> }
>
> public void invokeListener()
> {
> registry.setupThread();
>
> // Do lots of Hivemind stuff...
>
> registry.cleanupThread();
> }
> }
>
> On Mon, 24 Jul 2006 07:45:19 +0200, Achim Hügen <ac...@gmx.de>
> wrote:
>
>> Which part of the registry api do you need?
>>
>> Achim
>>
>> Am Sun, 23 Jul 2006 04:30:02 +0200 schrieb Martin Strand
>> <ma...@entcap.se>:
>>
>>> Yeah, that would be a simple solution but the problem is that my
>>> code doesn't control creation of the Registry. :(
>>> It's (sort of) a plugin so I want it to work in any Hivemind
>>> environment.
>>>
>>> Martin
>>>
>>> On Sun, 23 Jul 2006 03:54:13 +0200, Jason L. Buberel
>>> <ja...@buberel.org> wrote:
>>>
>>>> I use a class named Init with a static method on it to get my
>>>> singleton
>>>> registry.
>>>>
>>>> See the attached file.
>>>>
>>>>
>>>>
>>>> On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
>>>>> Is it possible to get a reference to the current thread's
>>>>> Registry? This
>>>>> old post suggests it's not possible (yet), is that correct?
>>>>> http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>>>>>
>>>>>
>>>>> Martin
>
>
Re: Get the Registry?
Posted by Martin Strand <ma...@entcap.se>.
I need registry.setupThread() and registry.cleanupThread().
I've got a service with a listener that is invoked from a thread outside
Hivemind, something like this:
public class MyService()
{
private Registry registry;
public MyService()
{
registry = getThisThreadsRegistry();
OutsideHivemind.registerListener(this);
}
public void invokeListener()
{
registry.setupThread();
// Do lots of Hivemind stuff...
registry.cleanupThread();
}
}
On Mon, 24 Jul 2006 07:45:19 +0200, Achim Hügen <ac...@gmx.de>
wrote:
> Which part of the registry api do you need?
>
> Achim
>
> Am Sun, 23 Jul 2006 04:30:02 +0200 schrieb Martin Strand
> <ma...@entcap.se>:
>
>> Yeah, that would be a simple solution but the problem is that my code
>> doesn't control creation of the Registry. :(
>> It's (sort of) a plugin so I want it to work in any Hivemind
>> environment.
>>
>> Martin
>>
>> On Sun, 23 Jul 2006 03:54:13 +0200, Jason L. Buberel
>> <ja...@buberel.org> wrote:
>>
>>> I use a class named Init with a static method on it to get my singleton
>>> registry.
>>>
>>> See the attached file.
>>>
>>>
>>>
>>> On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
>>>> Is it possible to get a reference to the current thread's Registry?
>>>> This
>>>> old post suggests it's not possible (yet), is that correct?
>>>> http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>>>>
>>>> Martin
Re: Get the Registry?
Posted by Achim Hügen <ac...@gmx.de>.
Which part of the registry api do you need?
Achim
Am Sun, 23 Jul 2006 04:30:02 +0200 schrieb Martin Strand
<ma...@entcap.se>:
> Yeah, that would be a simple solution but the problem is that my code
> doesn't control creation of the Registry. :(
> It's (sort of) a plugin so I want it to work in any Hivemind environment.
>
> Martin
>
> On Sun, 23 Jul 2006 03:54:13 +0200, Jason L. Buberel <ja...@buberel.org>
> wrote:
>
>> I use a class named Init with a static method on it to get my singleton
>> registry.
>>
>> See the attached file.
>>
>>
>>
>> On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
>>> Is it possible to get a reference to the current thread's Registry?
>>> This
>>> old post suggests it's not possible (yet), is that correct?
>>> http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>>>
>>> Martin
>
Re: Get the Registry?
Posted by Martin Strand <ma...@entcap.se>.
Yeah, that would be a simple solution but the problem is that my code
doesn't control creation of the Registry. :(
It's (sort of) a plugin so I want it to work in any Hivemind environment.
Martin
On Sun, 23 Jul 2006 03:54:13 +0200, Jason L. Buberel <ja...@buberel.org>
wrote:
> I use a class named Init with a static method on it to get my singleton
> registry.
>
> See the attached file.
>
>
>
> On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
>> Is it possible to get a reference to the current thread's Registry? This
>> old post suggests it's not possible (yet), is that correct?
>> http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>>
>> Martin
Re: Get the Registry?
Posted by "Jason L. Buberel" <ja...@buberel.org>.
I use a class named Init with a static method on it to get my singleton
registry.
See the attached file.
On Sun, 2006-07-23 at 01:42 +0200, Martin Strand wrote:
> Is it possible to get a reference to the current thread's Registry? This
> old post suggests it's not possible (yet), is that correct?
> http://mail-archives.apache.org/mod_mbox/jakarta-hivemind-user/200509.mbox/%3c200509011707.j81H7rk1014963@carmanconsulting.com%3e
>
> Martin