You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Gaasch, Derek" <dg...@montana.edu> on 2003/02/26 23:14:57 UTC

PoolService trouble! What's wrong with this code?

I'm trying to figure out how exactly to use PoolService (and perhaps
ArrayCtorRecyclable) to create a recycleable object to use with PoolService.

The object I want to recycle requires a constructor which takes 2 String
arrays.  

public SomeObject(String[] arr1, String[] arr2)
{
}

Anyone have any success with this? Basically, what I am doing (which keeps
giving me an instantiation exception) is:

String[] p1 = {"p1test1","p1test2"};
String[] p2 = {"p2test1","p2test2"};
Object[] params = {p1,p2};
String[] signature = {"String[]","String[]"};

SomeObject so  =
(SomeObject)TurbinePool.getInstance("org.blah.SomeObject",params,signature);


Any help will be most welcome! Thanks.

-d

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: PoolService trouble! What's wrong with this code?

Posted by Ilkka Priha <ip...@surfeu.fi>.
The signature must be in the same form as returned by Class.getName(), like

String[] signature = { "[Ljava.lang.String;", "[Ljava.lang.String;" };

See Javadoc of JDK for more details.

-- Ilkka


Gaasch, Derek wrote:
> I'm trying to figure out how exactly to use PoolService (and perhaps
> ArrayCtorRecyclable) to create a recycleable object to use with PoolService.
> 
> The object I want to recycle requires a constructor which takes 2 String
> arrays.  
> 
> public SomeObject(String[] arr1, String[] arr2)
> {
> }
> 
> Anyone have any success with this? Basically, what I am doing (which keeps
> giving me an instantiation exception) is:
> 
> String[] p1 = {"p1test1","p1test2"};
> String[] p2 = {"p2test1","p2test2"};
> Object[] params = {p1,p2};
> String[] signature = {"String[]","String[]"};
> 
> SomeObject so  =
> (SomeObject)TurbinePool.getInstance("org.blah.SomeObject",params,signature);
> 
> 
> Any help will be most welcome! Thanks.
> 
> -d
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 
> .
> 





---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org