2017-06-22 5 views
0

ここはbeanの部分です。 DFLT_CACHE_SIZEの値を設定する方法xmlのignite実行コンフィギュレーションで静的フィールドの値を設定する方法

<bean class="org.apache.ignite.configuration.CacheConfiguration"> 
    <property name="name" value="cfgCache"/> 
    <property name="cacheMode" value="REPLICATED"/> 
    <property name="static.DFLT_CACHE_SIZE" value="1000000"/> 
    <!--property name="atomicityMode" value="ATOMIC"/--> 
</bean> 

? または任意の静的フィールド?

ドキュメントは:

static int DFLT_CACHE_SIZE 
Default cache size to use with eviction policy. 
DFLT_CACHE_SIZE = 256MB 

Apacheの発火は、Springフレームワークに基づいています。

のErr

WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'grid.cfg' defined in URL [file:/home/ignite/sample-cache.xml]: Cannot create inner bean 
'org.apache.ignite.configuration.CacheConfiguration#4cc0edeb' of type [org.apache.ignite.configuration.CacheConfiguration] while setting bean 
property 'cacheConfiguration' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with 
name 'org.apache.ignite.configuration.CacheConfiguration#4cc0edeb' defined in URL [file:/home/ignite/sample-cache.xml]: Error setting property 
values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'DFLT_CACHE_SIZE' of bean class 
[org.apache.ignite.configuration.CacheConfiguration]: Bean property 'DFLT_CACHE_SIZE' is not writable or has an invalid setter method. Does the 
parameter type of the setter match the return type of the getter? 

答えて

2

このデフォルト値を設定する代わりに、Igniteの追い出しポリシーでmaxフィールドを設定することで、このデフォルト値を上書きすることができます。例:

<bean class="org.apache.ignite.configuration.CacheConfiguration"> 
      <property name="name" value="cfgCache"/> 
      <property name="cacheMode" value="REPLICATED"/> 
      <property name="evictionPolicy"> 
       <bean class="org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy"> 
        <property name="maxSize" value="100"/> 
       </bean> 
      </property> 
</bean> 
0

public static final int DFLT_CACHE_SIZE = 100000;

それだけで静的なフィールドではありません。 の最後のフィールドです。スプリング設定で変更する方法はありません。

関連する問題