Ehcache API Developer Guide : Thread Pools : Configuring Thread Pools with XML
Configuring Thread Pools with XML
Following is an example describing how to configure the thread pools the different services will use.
<thread-pools> <!-- 1 -->
<thread-pool alias="defaultDiskPool" min-size="1" max-size="3"/>
<thread-pool alias="defaultWriteBehindPool" min-size="1" max-size="3"/>
<thread-pool alias="cache2Pool" min-size="2" max-size="2"/>
</thread-pools>

<event-dispatch thread-pool="defaultEventPool"/> <!-- 2 -->
<write-behind thread-pool="defaultWriteBehindPool"/> <!-- 3 -->
<disk-store thread-pool="defaultDiskPool"/> <!-- 4 -->

<cache alias="cache1">
<key-type>java.lang.Long</key-type>
<value-type>java.lang.String</value-type>

<resources>
<heap unit="entries">10</heap>
<disk unit="MB">10</disk>
</resources>
</cache>

<cache alias="cache2">
<key-type>java.lang.Long</key-type>
<value-type>java.lang.String</value-type>

<loader-writer>
<class>org.ehcache.docs.plugs.ListenerObject</class>
<write-behind thread-pool="cache2Pool"> <!-- 5 -->
<batching batch-size="5">
<max-write-delay unit="seconds">10</max-write-delay>
</batching>
</write-behind>
</loader-writer>
<listeners dispatcher-thread-pool="cache2Pool"/> <!-- 6 -->
<resources>
<heap unit="entries">10</heap>
<disk unit="MB">10</disk>
</resources>
<disk-store-settings thread-pool="cache2Pool"
writer-concurrency="2"/> <!-- 7 -->
</cache>
1
Configure the thread pools. Note that there is no default one.
2
Configure the default thread pool this cache manager will use to send events.
3
Configure the default thread pool this cache manager will use for write-behind work.
4
Configure the default thread pool this cache manager will use for disk stores.
5
Configure a specific write-behind thread pool for this cache.
6
Configure a specific thread pool for this cache to send its events.
7
Configure a specific thread pool for this cache's disk store.
Copyright © 2010-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback