1 package org.apache.directmemory.conf;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24
25 import java.util.Properties;
26
27
28
29
30 public class SimplePropertiesConfiguration
31 extends DefaultConfiguration
32 implements ConfigurationService
33 {
34 private static final Logger logger = LoggerFactory.getLogger( SimplePropertiesConfiguration.class );
35
36 public SimplePropertiesConfiguration()
37 {
38 Properties properties = new Properties();
39 try
40 {
41 properties.load( this.getClass().getClassLoader().getResourceAsStream( "directmemory.properties" ) );
42 this.setNumberOfBuffers( new Integer( properties.getProperty( "numberOfBuffers" ) ) );
43 this.setInitialCapacity( new Integer( properties.getProperty( "initialCapacity" ) ) );
44 this.setRamMegaBytes( new Integer( properties.getProperty( "ramMegaBytes" ) ) );
45 this.setConcurrencyLevel( new Integer( properties.getProperty( "concurrencyLevel" ) ) );
46 this.setDisposalTime( new Long( properties.getProperty( "disposalTime" ) ) );
47 }
48 catch ( Exception e )
49 {
50
51 logger.warn( "no properties file found or invalid file - using defaults" );
52 }
53 }
54
55 }