users@shoal.java.net

Re: Custom Transport

From: Joseph Fialli <joe.fialli_at_oracle.com>
Date: Wed, 21 Dec 2011 10:18:11 -0500

  Comments inline below.

-Joe

On 12/15/11 9:25 AM, rpunnoose_at_proteus-technologies.com wrote:
> Hi,
>
> I really have two questions:
>
> 1. I want to use my own custom transport (networkmanager, not grizzly
> or jxta). I think I can just implement the Networkmanager interface and
> make it available. But looking at the AbstractNetworkManager code, it
> doesn't seem like either the findByServiceLoader or findByClassLoader
> (from the getInstance) will work with custom transports. Any ideas?
>
To allow for custom transports,
AbstractNetworkManager.findByServiceLoader and
AbstractNetworkManager.getInstance
could be extended that if the transport contains ".", treat it as a
fully qualified implementation class. Current
implementation only allows for transport to be convenient enumeration of
grizzly1_9, grizzly2_0 and rest to default
to jxta. But adding a check for "." in the transport name could treat
the transport as a fully qualified
classname and to just look up that value directly using serviceloader in
JDK 6 and higher and class loading in JDK 5.

> 2. I want to use shoal in osgi, and have the custom transport as a
> separate bundle. The ServiceLoader approach will not work with osgi. Is
> there another approach I can take? I think I can create an OSGi version
> extension (just extend the AbstractNetworkManager) that would look at
> OSGi services as well. Any ideas?
Shoal is being loaded as an OSGi module in GlassFish since GlassFish 3.1.
So you can already use Shoal in osgi. The targets are generated by
mvn install. The OSGi jars in shoal workspace are generated in
shoal/gms/api/target/shoal-gms-api.jar
and shoal/gms/impl/target/shoal-gms-impl.jar and
shoal/cache/target/shoal-cache.jar.
Here is mvn repository for the OSGi loadable shoal jars:
https://maven.java.net/content/repositories/releases/org/shoal/.

So while Shoal is not using OSGi to load its dependencies,
it can be loaded as an OSGi module.
> Thanks much!
>
> Roshan