1 package net.javacoding.jspider.core; 2 3 4 import net.javacoding.jspider.core.impl.SpiderImpl; 5 import net.javacoding.jspider.core.util.config.*; 6 7 8 14 public class SpiderNest { 15 16 public static final int DEFAULT_SPIDER_THREADS = 1; 17 public static final int DEFAULT_THINKER_THREADS = 1; 18 19 public SpiderNest() { 20 21 } 22 23 public Spider breedSpider(SpiderContext context) { 24 25 PropertySet props = ConfigurationFactory.getConfiguration().getJSpiderConfiguration(); 26 PropertySet threadProps = new MappedPropertySet ( ConfigConstants.CONFIG_THREADING, props); 27 PropertySet spidersProps = new MappedPropertySet ( ConfigConstants.CONFIG_THREADING_SPIDERS, threadProps); 28 PropertySet thinkerProps = new MappedPropertySet ( ConfigConstants.CONFIG_THREADING_THINKERS, threadProps); 29 int spiderThreads = spidersProps.getInteger(ConfigConstants.CONFIG_THREADING_COUNT, DEFAULT_SPIDER_THREADS); 30 int thinkerThreads = thinkerProps.getInteger(ConfigConstants.CONFIG_THREADING_COUNT, DEFAULT_THINKER_THREADS); 31 32 return new SpiderImpl(context, spiderThreads, thinkerThreads); 33 } 34 35 } 36 | Popular Tags |