At 07:56 AM 6/21/2002 +0200, you wrote:
>>Transparent pooling via proxies? I thought about that earlier but it
>>requires the notion of a (Component)Transaction which I mentioned a while
>>back that no one seemed to like.
>
>
>I remember the suggestion - but I'm thinking about this differently in
>terms of an interceptor architecture.
Hmm Interceptor architectures are generally tied to method invocation
models not to lookup of a component. So interceptors only come into play
after a service has been looked up. (At least in most ORB based
architecutres from J2EE, CORBA and MSes enterprise object system .. not DNA
whats it called nowadays?).
So the way I see it being used is as follows. We have a transaction
interceptor that associates a transaction with the current call (lets
ignore the policy for this atm). Then we have an interceptor that does
something like the following;
interface ResourceReleaser
{
void release();
}
class PoolingInterceptor implements Interceptor, ResourceReleaser
{
private Object m_object;
Object invoke( InterceptorContext ctx, Object[] args ) throws Exception
{
if( null == m_object )
{
//Okay this resource not used yet in this transaction
//so lets try and aquire it and associate with transaction
m_object = getPool().getInstance();
m_object.activate();
getComponentTransaction().addResource( m_object,
(ResourceReleaser)this );
}
return m_object.invoke( ctx.getMethod(), args );
}
void release()
{
//This is called when transaction ends, or request goes out of scope or
//transaction is finished
m_object.deactivate();
getPool().release( m_object );
}
}
So the first time the client tries to call a method on object it is
retriewved from pool. As soon as the transaction is finished, the request
ends or the client goes out of scope via some other method then the object
is released. Activate()/deactivate() are the called to prep it after coming
out of pool or before going back in.
Basically this is hald of what EJB servers do to get scalability. I don't
know if it is common among CORBA apps (Stephen?) but it is fairly well
developed technique. Easy to write components but fairly hard to write the
container.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>