The thread pool will keep the thread alive for 60 seconds. I assume the spring thread scope will invoke the destroy when thread thread is discarded.
You can configure the keepAlive time on the <threads> for example to a lower value to have the destroy invoke faster. Mind that a thread pool can re-use threads, thats the point with the pool. So a 2nd message may re-use the same bean. 2011/5/11 차정호 <[email protected]>: > Hello. > > I love Camel and am using it for my product. > > I set my bean in the spring custom thread(prototype) scope, > And I configure the camel route the below > > <beans> > ... > <bean id="myBean" class="com.brm.test.MyBean" > scope="thread" init-method="start" destroy-method="stop"> > > <camelContext id="camel" > xmlns="http://camel.apache.org/schema/spring"> > ... > <route> > <from uri="seda:test" /> > <threads poolSize="10" maxPoolSize="20"> > <setExchangePattern > pattern="InOnly" /> > <to > uri="bean:myBean?method=process" /> > </threads> > </route> > ... > </camelContext> > ... > </beans> > > When I send message to seda:test, > In myBean the init-method start() was called ok. > But I have not seen the destroy-method stop() at all in the spring > thread(prototype) scope. > > My bean maintains some resources in its life cycle as the thread scope or > the prototype scope. > > But I don't know how to clear the resources of myBean when the thread using > myBean is discared or bean is destoryed. > > If spring destroy-method is not applicable, Is Some camel listener possible > ? > > Could someone help me? > > Thanks a lot before. > > > > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
