/** * Configuration of the handler under which the minimum pool size * is established. * @param configuration the configuration fragment */ public void configure( final Configuration configuration ) { m_poolMin = configuration.getAttributeAsInteger( "pool-min", 10 ); }
/** * 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 { m_value = value; m_valueCount = state.getAttributeAsInteger( "value-count" ); m_lastValue = state.getAttributeAsInteger( "last-value" ); }
/** * 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); }
/** * Avalon component lifecycle method */ public void configure(Configuration conf) { repositoryPath = conf.getAttribute( UploadService.REPOSITORY_KEY, UploadService.REPOSITORY_DEFAULT); headerEncoding = conf.getAttribute( UploadService.HEADER_ENCODING_KEY, UploadService.HEADER_ENCODING_DEFAULT); sizeMax = conf.getAttributeAsInteger( UploadService.SIZE_MAX_KEY, UploadService.SIZE_MAX_DEFAULT); sizeThreshold = conf.getAttributeAsInteger( UploadService.SIZE_THRESHOLD_KEY, UploadService.SIZE_THRESHOLD_DEFAULT); }
/** * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration configuration) throws ConfigurationException { super.configure(configuration); this.maxArgLength = configuration.getChild("maxArgLength").getValueAsInteger(MAX_ARG_LENGTH); Configuration tresholdConfiguration = configuration.getChild("tresholds"); this.tresholdList[0] = tresholdConfiguration.getChild("fatal").getAttributeAsInteger("millis", 5000); this.tresholdList[1] = tresholdConfiguration.getChild("error").getAttributeAsInteger("millis", 1000); this.tresholdList[2] = tresholdConfiguration.getChild("warn").getAttributeAsInteger("millis", 500); this.tresholdList[3] = tresholdConfiguration.getChild("info").getAttributeAsInteger("millis", 100); this.tresholdList[4] = tresholdConfiguration.getChild("debug").getAttributeAsInteger("millis", 10); }
/** * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration configuration) throws ConfigurationException { super.configure(configuration); this.maxArgLength = configuration.getChild("maxArgLength").getValueAsInteger(MAX_ARG_LENGTH); Configuration tresholdConfiguration = configuration.getChild("tresholds"); this.tresholdList[0] = tresholdConfiguration.getChild("fatal").getAttributeAsInteger("millis", 5000); this.tresholdList[1] = tresholdConfiguration.getChild("error").getAttributeAsInteger("millis", 1000); this.tresholdList[2] = tresholdConfiguration.getChild("warn").getAttributeAsInteger("millis", 500); this.tresholdList[3] = tresholdConfiguration.getChild("info").getAttributeAsInteger("millis", 100); this.tresholdList[4] = tresholdConfiguration.getChild("debug").getAttributeAsInteger("millis", 10); }
throws ConfigurationException final int queuesize = configuration.getAttributeAsInteger( "queue-size", -1 ); final Configuration config = configuration.getChildren()[ 0 ]; final LogTargetFactory factory = m_logTargetFactoryManager.getLogTargetFactory( config.getName() ); threadPriority = configuration.getAttributeAsInteger( "priority", 1 );
protected FileStrategy getFileStrategy( final Configuration conf, final File file ) { final String type = conf.getAttribute( "type", "unique" ); if( "revolving".equals( type ) ) { final int initialRotation = conf.getAttributeAsInteger( "init", 5 ); final int maxRotation = conf.getAttributeAsInteger( "max", 10 ); return new RevolvingFileStrategy( file, initialRotation, maxRotation ); } // default file strategy final String pattern = conf.getAttribute( "pattern", null ); final String suffix = conf.getAttribute( "suffix", null ); if( pattern == null ) { return new UniqueFileStrategy( file ); } else { if( suffix == null ) { return new UniqueFileStrategy( file, pattern ); } else { return new UniqueFileStrategy( file, pattern, suffix ); } } }
if( "avalon".equals( type ) ) final int depth = conf.getAttributeAsInteger( "depth", AvalonFormatter.DEFAULT_STACK_DEPTH ); final boolean printCascading = conf.getAttributeAsBoolean( "cascading", AvalonFormatter.DEFAULT_PRINT_CASCADING ); return new AvalonFormatter( format, depth, printCascading );
/** * 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 ); }
final int port = configChild.getAttributeAsInteger( "port" );
int port = configChild.getAttributeAsInteger( "port" );
public ProcessingNode buildNode(Configuration config) throws Exception { String type = this.treeBuilder.getTypeForStatement(config, Reader.ROLE); String mimeType = config.getAttribute("mime-type", null); if (mimeType == null) { mimeType = ((SitemapLanguage)this.treeBuilder).getMimeType(Reader.ROLE, type); } ReadNode node = new ReadNode( type, VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager), VariableResolverFactory.getResolver(mimeType, this.manager), config.getAttributeAsInteger("status-code", -1) ); return this.treeBuilder.setupNode(node, config); } }
public void configure(Configuration config) { this.defaultTimeToLive = config.getAttributeAsInteger("time-to-live", (3600 * 1000)); this.bindContinuationsToSession = config.getAttributeAsBoolean( "session-bound-continuations", false ); // create a global ContinuationsHolder if this the "session-bound-continuations" parameter is set to false if (!this.bindContinuationsToSession) { this.continuationsHolder = new WebContinuationsHolder(); } final Configuration expireConf = config.getChild("expirations-check"); final long initialDelay = expireConf.getChild("offset", true).getValueAsLong(180000); this.expirationCheckInterval = expireConf.getChild("period", true).getValueAsLong(180000); try { final RunnableManager runnableManager = (RunnableManager)serviceManager.lookup(RunnableManager.ROLE); runnableManager.execute( new Runnable() { public void run() { expireContinuations(); } }, initialDelay, expirationCheckInterval); serviceManager.release(runnableManager); } catch (Exception e) { getLogger().warn("Could not enqueue continuations expiration task. " + "Continuations will not automatically expire.", e); } }
/** * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration configuration) throws ConfigurationException { // limit to minimum interval of 1 second this.interval = Math.max(configuration.getAttributeAsInteger("interval", 5000), 1000); this.getLogger().debug("Monitoring the resources every " + this.interval + " ms"); if (configuration.getChild("entry", false) != null) { Configuration shutdownConfig = configuration.getChild("entry"); String shutdownEntryLocation = shutdownConfig.getChild("location").getValue(); this.shutdownEntry = new ShutdownEntry(this.getLogger(), this.applicationDir, shutdownEntryLocation, shutdownConfig.getChild("useSystemExit").getValueAsBoolean(false)); this.getLogger().debug("Using a shutdown entry : " + shutdownEntryLocation); } else { this.shutdownEntry = null; this.getLogger().debug("No shutdown entry defined"); } }
/** * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration configuration) throws ConfigurationException { // limit to minimum interval of 1 second this.interval = Math.max( configuration.getAttributeAsInteger("interval",5000), 1000 ); this.getLogger().debug( "Monitoring the resources every " + this.interval + " ms" ); if( configuration.getChild("entry",false) != null ) { Configuration shutdownConfig = configuration.getChild("entry"); String shutdownEntryLocation = shutdownConfig.getChild("location").getValue(); this.shutdownEntry = new ShutdownEntry( this.getLogger(), this.applicationDir, shutdownEntryLocation, shutdownConfig.getChild("useSystemExit").getValueAsBoolean(false) ); this.getLogger().debug( "Using a shutdown entry : " + shutdownEntryLocation ); } else { this.shutdownEntry = null; this.getLogger().debug( "No shutdown entry defined" ); } }
this.interval = Math.max(configuration.getAttributeAsInteger("interval", 5000), 1000);
this.interval = Math.max( configuration.getAttributeAsInteger("interval",5000), 1000 );
instrumentSampleConf.getAttribute( "type" ) ); long sampleInterval = instrumentSampleConf.getAttributeAsLong( "interval" ); int sampleSize = instrumentSampleConf.getAttributeAsInteger( "size", 1 );
sampleConf.getAttribute( "type" ) ); long sampleInterval = sampleConf.getAttributeAsLong( "interval" ); int sampleSize = sampleConf.getAttributeAsInteger( "size" );