1 package org.jboss.cache.loader; 2 3 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig; 4 import org.jboss.cache.config.Dynamic; 5 6 import java.util.Properties ; 7 8 public class ClusteredCacheLoaderConfig extends IndividualCacheLoaderConfig 9 { 10 13 private static final long serialVersionUID = -3425487656984237468L; 14 15 @Dynamic 16 private long timeout = 10000; 17 18 public ClusteredCacheLoaderConfig() 19 { 20 setClassName(ClusteredCacheLoader.class.getName()); 21 } 22 23 28 ClusteredCacheLoaderConfig(IndividualCacheLoaderConfig base) 29 { 30 setClassName(ClusteredCacheLoader.class.getName()); 31 populateFromBaseConfig(base); 32 } 33 34 public long getTimeout() 35 { 36 return timeout; 37 } 38 39 public void setTimeout(long timeout) 40 { 41 testImmutability("timeout"); 42 this.timeout = timeout; 43 } 44 45 public void setProperties(Properties props) 46 { 47 super.setProperties(props); 48 try 49 { 50 timeout = Long.valueOf(props.getProperty("timeout")); 51 } 52 catch (Exception e) 53 { 54 log.info("Using default value for config property 'timeout' - " + timeout); 55 } 56 } 57 58 public boolean equals(Object obj) 59 { 60 if (obj instanceof ClusteredCacheLoaderConfig && equalsExcludingProperties(obj)) 61 { 62 ClusteredCacheLoaderConfig other = (ClusteredCacheLoaderConfig) obj; 63 return (this.timeout == other.timeout); 64 } 65 return false; 66 } 67 68 public int hashCode() 69 { 70 return 31 * hashCodeExcludingProperties() + (int) timeout; 71 } 72 73 } | Popular Tags |