cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miguel <miguel.valen...@juntadeandalucia.es>
Subject Re: Custom generator not call recycle method
Date Thu, 06 Feb 2014 07:35:36 GMT
Hi Thorsten

   Yes, I supposed you tell me. I developed a new generator very similar 
to WebServiceProxyGenerator of the block cocoon-proxy for to consume 
Rest service, but I needed three modifications:
* the new generator have to be a cache component 
(WebServiceProxyGenerator not implement CacheableProcessingComponent)
* Use Apache HttpComponents 4.2 (WebServiceProxyGenerator use Commons 
HttpClient 3.x and this version have bugs about release connections)
* Use a pool connections (WebServiceProxyGenerator not use pool to 
manage connections and this can be a important improve to performance)

I developed a new class to manage pool and declared it using spring, it 
is seems the easy best way.
Besides if I declared the new generator using spring will be very easy 
to add the pool resource.

I had readed that Cocoon 2.2 can use spring to declare objects and I 
found examples with transformer, so I followed the web page: 
https://cocoon.apache.org/2.2/core-modules/core/2.2/688_1_1.html

The new generator seems work ok, but I checked that it not called to 
recycle method at finished and then, not release connection to pool.

At the end, I had have to added ApplicationContextAware interface to my 
generator to access resource pool declared in spring, and this is 
working fine. Still I have to do some test with apache jmeter to check 
performance but first impressions are good.

Best regards.

El 05/02/2014 14:43, Thorsten Scherler escribió:
> On 02/05/2014 11:22 AM, Miguel wrote:
>> Hi
>>
>> I have to come back to old configuration of generator:
>>
>> <map:generator label="icmsRest" name="icmsRest" 
>> logger="es.juntadeandalucia.generation.CustomGenerator"
>> src="es.juntadeandalucia.generation.CustomGenerator">
>>       <serverICMS>ip_machine</serverICMS>
>>       <portICMS>port_machine</portICMS>
>> <namePool>org.apache.cocoon.generation.HttpPoolManager</namePool>
>> </map:generator>
>>
>> Then, HttpPoolManager is a resource defined like spring bean and for 
>> to use it in my custom generator, I have to implement 
>> ApplicationContextAware interface. So, in this way, my generator work 
>> fine and recycle method is called at finish of my generator.
>>
>
> Hi Miguel,
>
> not sure whether I understand, you have it working now?
>
> I think the recyle method is special to avalon and I think spring 
> based components do not use this method anymore. Using the "old" 
> config tricks c2.2 into using the avalon methods...at least that is 
> what its look like.
>
> salu2
>
>
>>
>> El 04/02/2014 16:52, Miguel escribió:
>>> Hi,
>>>
>>> I'm migrating configuration custom generator from Avalon to Spring 
>>> and generator is working well but I have checked that generator does 
>>> not call recycled method when it has finished.
>>>
>>> My generator configuration in servlet-service.xml file is:
>>>
>>> <bean scope="prototype" 
>>> name="org.apache.cocoon.generation.Generator/customGenerator" 
>>> class="es.juntadeandalucia.generation.CustomGenerator">
>>>       <property name="server" value="${ip.machine}" />
>>>       <property name="port" value="${port_machine}" />
>>>       <property name="parser" 
>>> ref="org.apache.cocoon.core.xml.SAXParser"/>
>>>       <property name="manager" 
>>> ref="org.apache.avalon.framework.service.DefaultServiceManager" />
>>> </bean>
>>>
>>> When I used old configuration:
>>>
>>> <map:generator label="customGenerator" name="customGenerator"
>>> src="es.juntadeandalucia.generation.CustomGenerator">
>>>     <server>${ip.machine}</server>
>>>     <port>${port_machine}</port>
>>> </map:generator>
>>>
>>> then, my generator work all well and execute recycle method when 
>>> generator is finished.
>>>
>>> Any ideas?
>>> Thanks.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail:users-help@cocoon.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail:users-help@cocoon.apache.org
>
>
> -- 
> Thorsten Scherler <scherler.at.gmail.com>
> codeBusters S.L. - web based systems
> <consulting, training and solutions>
>
> http://www.codebusters.es/


Mime
View raw message