You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@visi.com> on 2008/08/31 05:44:37 UTC

Re: Clustering of SFSB - Heads-up

On Feb 4, 2008, at 4:19 PM, David Blevins wrote:

>
> On Jan 27, 2008, at 6:37 PM, Gianny Damour wrote:
>
>> I extracted the logic you are talking about behind this contract:
>> public interface ConnectionFactoryStrategy extends Serializable {
>>   Connection connect(URI[] locations, Request request) throws  
>> RemoteException;
>> }
>>
>> This contract allows an implementation to decide how to fail-over  
>> and route requests.
>
> Yea, the ConnectionFactory interface was originally "public  
> Connection getConnection(ServerMetaData serverMetaData) throws  
> java.io.IOException;"  It might be better to revert back to that and  
> let the implementor choose how they'd like to handle the URIs inside  
> the serverMetaData.


Changed this up a bit.  ConnectionFactoryStrategy is now essentially  
what ConnectionFactory used to be when it took ServerMetaData as the  
only arg.  Also, the org.apache.openejb.client.Client class once again  
uses the ConnectionManager to get a connection.  ConnectionManager in  
turn delegates to the ConnectionStrategy named in the ServerMetaData  
or the default if none is mentioned.  The ConnectionStrategy in turn  
will likely invoke several possible ConnectionFactories in its attempt  
to get a connection.

public interface ConnectionStrategy {
     public Connection connect(ServerMetaData server) throws  
IOException;
}

public interface ConnectionFactory {
     public Connection getConnection(URI uri) throws  
java.io.IOException;
}

The ConnectionManager serves as a place to register use the  
ConnectionStrategy in addition to the ConnectionFactory as before.

ConnectionStrategy(s) and ConnectionFactory(s) are now equally  
pluggable.  New implementations can be included in the classpath and  
we'll pick them up automagically or you can register/unregister one  
explicitly in code.


I looked for implementations of ConnectionFactoryStrategy other than  
the stick to last server one.  Let me know if there are any I should  
update.

Check out the code and let me know what you think.

-David