use of org.apache.felix.scr.annotations.Activate in project sling by apache.
the class HealthCheckExecutorImpl method activate.
@Activate
protected final void activate(final Map<String, Object> properties, final BundleContext bundleContext) {
this.bundleContext = bundleContext;
final ModifiableThreadPoolConfig hcThreadPoolConfig = new ModifiableThreadPoolConfig();
hcThreadPoolConfig.setMaxPoolSize(25);
hcThreadPool = threadPoolManager.create(hcThreadPoolConfig, "Health Check Thread Pool");
this.modified(properties);
try {
this.bundleContext.addServiceListener(this, "(" + Constants.OBJECTCLASS + "=" + HealthCheck.class.getName() + ")");
} catch (final InvalidSyntaxException ise) {
// this should really never happen as the expression above is constant
throw new RuntimeException("Unexpected exception occured.", ise);
}
}
use of org.apache.felix.scr.annotations.Activate in project sling by apache.
the class CompositeHealthCheck method activate.
@Activate
protected void activate(final ComponentContext ctx) {
bundleContext = ctx.getBundleContext();
componentContext = ctx;
healthCheckFilter = new HealthCheckFilter(bundleContext);
filterTags = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_FILTER_TAGS), new String[] {});
log.debug("Activated, will select HealthCheck having tags {}", Arrays.asList(filterTags));
}
use of org.apache.felix.scr.annotations.Activate in project sling by apache.
the class ResourceModuleProvider method activate.
@Activate
private void activate(Map<String, Object> props) {
final int maxRecursionLevels = PropertiesUtil.toInteger(props.get(PROP_MAX_RECURSION_LEVELS), DEFAULT_MAX_RECURSION_LEVELS);
this.moduleInstance = new SimpleModule();
SimpleSerializers serializers = new SimpleSerializers();
serializers.addSerializer(Resource.class, new ResourceSerializer(maxRecursionLevels));
moduleInstance.setSerializers(serializers);
}
use of org.apache.felix.scr.annotations.Activate in project sling by apache.
the class REPLJavaSourceCodeServlet method activate.
@Activate
@SuppressWarnings("unused")
protected void activate(ComponentContext componentContext) {
for (Bundle bundle : componentContext.getBundleContext().getBundles()) {
if (FS_CLASSLOADER_SN.equals(bundle.getSymbolicName())) {
BundleContext context = bundle.getBundleContext();
classesFolder = new File(context.getDataFile(""), "classes");
}
}
}
use of org.apache.felix.scr.annotations.Activate in project sling by apache.
the class AsyncJobConsumer method activate.
@Activate
public void activate(Map<String, Object> properites) {
int corePoolSize = (int) properites.get(CORE_THREAD_POOL_SIZE);
int maxPoolSize = (int) properites.get(MAC_THREAD_POOL_SIZE);
int maxBacklog = (int) properites.get(MAX_QUEUED_BACKLOG);
shutdownWaitSeconds = (long) properites.get(SHUTDOWN_WAIT_SECONDS);
workQueue = new LinkedBlockingQueue<Runnable>(maxBacklog);
executor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 60, TimeUnit.SECONDS, workQueue);
}
Aggregations