Timothy:


Attached is a small demo. The demo deploys a simple component that uses a Phoneix component (the cornerstone threads block). Just save the attached demo.xml anywhere locally then invoke the following command:

$ merlin -execute demo.xml

You should see something like the following:

[INFO   ] (thread-tutorial.test): aquiring cornerstone threads service
[INFO   ] (thread-tutorial.test): initialization
[INFO   ] (thread-tutorial.test.counter): count: 10
[INFO   ] (thread-tutorial.test): disposal
[INFO   ] (thread-tutorial.test): disposal invoked while child thread active
[INFO   ] (thread-tutorial.test.counter): I've been interrupted.
[INFO   ] (thread-tutorial.test.counter): Time to die.
[INFO   ] (thread-tutorial.test): disposal complete


Inside the demo.xml you will see the following:


 a) declaration of the classloader needed to deploy the
    components

 b) a deployment directive for the cornerstone thread
    manager

 c) a deployment directive for a demo component that
    uses the thread manager

To get a little more detail as to what is happening you could try adding the -info and/or -debug command line switches. Sources for the demo are in the avalon-components/threads-tutorial package.

Don't hesitate to post any questions.

Stephen.

--

Stephen J. McConnell
mailto:[EMAIL PROTECTED]
http://www.osm.net

Sent via James running under Merlin as an NT service.
http://avalon.apache.org/sandbox/merlin


<!--
Thread Tutorial.
-->

<container name="thread-tutorial">

     <categories>
       <category name="classloader/scanner" priority="ERROR"/>
     </categories>

     <classloader>
       <classpath>
         <repository>
           <resource id="avalon-framework:avalon-framework-impl" version="4.1.5"/>
           <resource id="commons-collections:commons-collections" version="2.1"/>
           <resource id="excalibur-pool:excalibur-pool" version="1.2"/>
           <resource id="excalibur-thread:excalibur-thread" version="1.1.1"/>
           <resource id="excalibur-event:excalibur-event" version="1.0.3"/>
           <resource id="cornerstone-threads:cornerstone-threads-api" version="1.0"/>
           <resource id="cornerstone-threads:cornerstone-threads-impl" version="1.0"/>
           <resource id="cornerstone-threads:cornerstone-threads-tutorial" version="1.0"/>
         </repository>
       </classpath>
     </classloader>

     <component name="threads" 
        class="org.apache.avalon.cornerstone.blocks.threads.DefaultThreadManager">
       <configuration>
         <thread-group>
           <name>default</name>
           <priority>5</priority> 
           <is-daemon>false</is-daemon>
           <max-threads>100</max-threads>
           <min-threads>20</min-threads>
           <min-spare-threads>20</min-spare-threads>
         </thread-group>
       </configuration>
     </component>

     <component name="test" 
        class="org.apache.avalon.cornerstone.threads.tutorial.ThreadConsumer" />

</container>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to