Glad to help!  Yeah, the cleanupThread() stuff is *very* important in
HiveMind.  That's how we cleanup thread-local resources and the like.  So,
if you ever do any asynchronous processing inside a registry, make sure you
call cleanupThread() when the asynchronous process is done or you'll waste
resources.

-----Original Message-----
From: Kristian Marinkovic [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 28, 2006 8:30 AM
To: Tapestry users
Subject: RE: RE: RE: Hivemind: creating a pooled service

ok, now i get it.... in order to put an object back to the pool i
have to release it somehow.... my mistake

 i've seen it in org.apache.tapestry.ApplicationServlet but had no
clue what it was for :)

it works fine now

thank you




                                                                           
             "James Carman"                                                
             <[EMAIL PROTECTED]                                             
             ulting.com>                                                An 
                                        "'Tapestry users'"                 
             28.07.2006 14:12           <users@tapestry.apache.org>        
                                                                     Kopie 
                                                                           
              Bitte antworten                                        Thema 
                    an                  RE: RE: Hivemind: creating a       
             "Tapestry users"           pooled service                     
             <[EMAIL PROTECTED]                                             
                pache.org>                                                 
                                                                           
                                                                           
                                                                           
                                                                           




Try this:

public void run()
{
  IPooledObject o = (IPooledObject) registry
              .getService("cross.pooledObject",IPooledObject.class);
  System.out.println("ObjectID: " + o.getValue());
  registry.cleanupThread();
}

See what you get.  The pooled lifecycle model doesn't know when to release
stuff if you don't clean up your current thread.

-----Original Message-----
From: Kristian Marinkovic [mailto:[EMAIL PROTECTED]
Sent: Friday, July 28, 2006 8:09 AM
To: Tapestry users
Subject: RE: RE: Hivemind: creating a pooled service

hi james,

the error message does not occur any more. But the objects are still
not being pooled. my testcode looks like this:

public class PoolTest implements Runnable {

    public static Registry registry = null;

    public static void main(String[] args) throws InterruptedException {
        registry = RegistryBuilder.constructDefaultRegistry();

        Thread[] a = new Thread[10];
        for(int i=0;i<a.length;i++)  a[i] = new Thread(new PoolTest());
        for(Thread t: a) t.start();
        for(Thread t: a) t.join();

        for(int i=0;i<a.length;i++) a[i] = new Thread(new PoolTest());
        for(Thread t: a) t.start();
        for(Thread t: a) t.join();

        ....

    public void run() {
        IPooledObject o = (IPooledObject) registry
                .getService("cross.pooledObject",IPooledObject.class);
        System.out.println("ObjectID: " + o.getValue());
}

I'm getting 20 different object ids. i'd except to have less than 20
different object ids :)

g,
 kris





             "James Carman"
             <[EMAIL PROTECTED]
             ulting.com>                                                An
                                        "'Tapestry users'"
             28.07.2006 13:32           <users@tapestry.apache.org>
                                                                     Kopie

              Bitte antworten                                        Thema
                    an                  RE: Hivemind: creating a pooled
             "Tapestry users"           service
             <[EMAIL PROTECTED]
                pache.org>








FYI, the HiveMind mailing lists have been moved.  We are moving to an
Apache
top-level project, but we haven't moved the website yet.  Anyway, have you
tried this:

<service-point id="pooledObjectProvider"
        interface="org.apache.hivemind.ServiceImplementationFactory"
        paramaters-occurs="none" />

This tells HiveMind that your implementation factory doesn't expect any
parameters.

-----Original Message-----
From: Kristian Marinkovic [mailto:[EMAIL PROTECTED]
Sent: Friday, July 28, 2006 6:28 AM
To: Tapestry users
Subject: Hivemind: creating a pooled service


hi,

could someone tell me howto configure hivemind to get me a
object with a "pooled"  lifecycle which, if the pool is empty, uses
a own factory or provider to generate it?

my configuration doesn't pool the object and returns a
"Parameters to service implementation factory
pooledObjectProvider contains no contributions
but expects exactly one contribution." error
message

<service-point id="pooledObject"
        interface="pool.IPooledObject" />
<service-point id="pooledObjectProvider"
        interface="org.apache.hivemind.ServiceImplementationFactory" />

<implementation service-id="pooledObjectProvider">
    <invoke-factory model="singleton">
        <construct class="pool.PooledObjectProvider" />
    </invoke-factory>
</implementation>

<implementation service-id="pooledObject">
    <invoke-factory model="pooled"
               service-id="pooledObjectProvider" />
</implementation>


g,
kris

P.S. i always get a failure notive when i try to subscribe to the hivemind
mailinglist


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to