/** * Avalon component lifecycle method */ public void configure(Configuration conf) throws ConfigurationException { this.cacheCheckFrequency = conf.getAttributeAsLong( CACHE_CHECK_FREQUENCY, DEFAULT_CACHE_CHECK_FREQUENCY); this.cacheInitialSize = conf.getAttributeAsInteger(INITIAL_CACHE_SIZE, DEFAULT_INITIAL_CACHE_SIZE); }
/** * Used to load the state, called from AbstractInstrumentSample.loadState(); * <p> * Should only be called when synchronized. * * @param value Current value loaded from the state. * @param state Configuration object to load state from. * * @throws ConfigurationException If there were any problems loading the * state. */ protected void loadState( int value, Configuration state ) throws ConfigurationException { super.loadState( value, state ); m_valueTotal = state.getAttributeAsLong( "value-total" ); }
/** * Create a PoolableComponentHandler which manages a pool of Components * created by the specified factory object. * * @param factory The factory object which is responsible for creating the components * managed by the ComponentHandler. * @param config The configuration to use to configure the pool. */ public PoolableComponentHandler( final DefaultComponentFactory factory, final Configuration config ) throws Exception { m_factory = factory; int poolMax = config.getAttributeAsInteger( "pool-max", DEFAULT_MAX_POOL_SIZE ); boolean poolMaxStrict = config.getAttributeAsBoolean( "pool-max-strict", false ); boolean poolBlocking = config.getAttributeAsBoolean( "pool-blocking", true ); long poolTimeout = config.getAttributeAsLong( "pool-timeout", 0 ); long poolTrimInterval = config.getAttributeAsLong( "pool-trim-interval", 0 ); m_pool = new InstrumentedResourceLimitingPool( m_factory, poolMax, poolMaxStrict, poolBlocking, poolTimeout, poolTrimInterval ); // Initialize the Instrumentable elements. addChildInstrumentable( m_pool ); }
/** * @param conf * @throws ConfigurationException */ private void setupSingleRefreshJob(final Configuration conf) throws ConfigurationException { try { String key = NetUtils.decode(conf.getAttribute(ATTR_KEY), "utf-8"); String uri = NetUtils.decode(conf.getAttribute(ATTR_URI), "utf-8"); long interval = conf.getAttributeAsLong(ATTR_INTERVAL); addRefreshSource(key, uri, 10, interval); } catch (UnsupportedEncodingException e) { /* Won't happen */ } }
long savedTime = m_time = state.getAttributeAsLong( "time" ); long leaseExpirationTime = state.getAttributeAsLong( "lease-expiration", 0 ); if ( ( m_leaseExpirationTime != 0 ) && ( leaseExpirationTime > m_leaseExpirationTime ) )
/** * Configure the tree processor: * <processor file="{Location of the sitemap}" * check-reload="{true|false}" * config="{Location of sitemap tree processor config}> * <reload delay="10"/> * </processor> * * Only the file attribute is required; everything else is optional. * * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration config) throws ConfigurationException { this.checkReload = config.getAttributeAsBoolean("check-reload", this.settings.isReloadingEnabled("sitemap")); // Reload check delay. Default is 1 second. this.lastModifiedDelay = config.getChild("reload").getAttributeAsLong("delay", this.settings.getReloadDelay("sitemap")); String fileName = config.getAttribute("file", "sitemap.xmap"); try { this.source = new DelayedRefreshSourceWrapper(this.resolver.resolveURI(fileName), lastModifiedDelay); } catch (Exception e) { throw new ConfigurationException("Cannot resolve " + fileName, e); } }
long sampleInterval = instrumentSampleConf.getAttributeAsLong( "interval" ); int sampleSize = instrumentSampleConf.getAttributeAsInteger( "size", 1 ); instrumentSampleConf.getAttributeAsLong( "lease-expiration", 0 ); if ( leaseExpirationTime > 0 )
m_stateInterval = stateFileConf.getAttributeAsLong( "interval", 60000 );
long sampleInterval = sampleConf.getAttributeAsLong( "interval" ); int sampleSize = sampleConf.getAttributeAsInteger( "size", 1 );
long sampleInterval = sampleConf.getAttributeAsLong( "interval" ); int sampleSize = sampleConf.getAttributeAsInteger( "size" ); long leaseExpirationTime = sampleConf.getAttributeAsLong( "lease-expiration", 0 ); if ( leaseExpirationTime == 0 )