Renaud Bruyeron wrote:
Vadim Gritsenko wrote:
Renaud Bruyeron wrote:

It is possible to use pipelines directly, it would look something like:

  ...setup container...

Is that the avalon container, or is it a spring container? Is there an example of this somewhere?

Avalon in 2.1, spring in 2.2. Avalon is setup somewhere in CocoonServlet/Cocoon objects; in 2.2, spring container is setup as usual + cocoon specific spring namespace handlers in spring config.


  ProcessingPipeline pipeline = new [Non]CachingProcessingPipeline();
  pipeline.enableLogging(...);

  while (...) {
    pipeline.setup(new Parameters());

    // Pipeline will get generator from container
    pipeline.setGenerator("file", ...);
    pipeline.addTransformer("xslt", ...);
    pipeline.setSerializer("html", ...);

    Environment env = new BackgroundEnvironment(...);
    pipeline.process(env);
    pipeline.recycle();
  }

This looks simple enough. The recycle() method is not part of the ProcessingPipeline interface, but all its implementations are Recyclable (I guess this is avalon speak for "to be used in a pool", and therefore I can assume that the implementations are not threadsafe, right?).

Yes, pipeline interface is inherently not thread-safe.


Am I correct in assuming that cocoon pools instances of the pipelines (one per thread) when in a webapp context ?

One pipeline object per ... ahem ... pipeline being assembled. Usually this means one pipeline per Request (meaning, internal requests get own pipeline object), which can total to more than one per thread.

Vadim

Reply via email to