Search in sources :

Example 1 with AbstractComponent

use of com.yahoo.component.AbstractComponent in project vespa by vespa-engine.

the class SearchChainRegistry method setupSearcherRegistry.

private SearcherRegistry setupSearcherRegistry(ComponentRegistry<? extends AbstractComponent> allComponents) {
    SearcherRegistry registry = new SearcherRegistry();
    for (AbstractComponent component : allComponents.allComponents()) {
        if (component instanceof Searcher) {
            registry.register((Searcher) component);
        }
    }
    // just freeze this right away
    registry.freeze();
    return registry;
}
Also used : AbstractComponent(com.yahoo.component.AbstractComponent) Searcher(com.yahoo.search.Searcher)

Example 2 with AbstractComponent

use of com.yahoo.component.AbstractComponent in project vespa by vespa-engine.

the class ApplicationStatusHandler method renderAbstractComponents.

private static JSONArray renderAbstractComponents(List<? extends AbstractComponent> components) {
    JSONArray ret = new JSONArray();
    for (AbstractComponent c : components) {
        JSONObject jc = renderComponent(c, c.getId());
        ret.put(jc);
    }
    return ret;
}
Also used : AbstractComponent(com.yahoo.component.AbstractComponent) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray)

Example 3 with AbstractComponent

use of com.yahoo.component.AbstractComponent in project vespa by vespa-engine.

the class Deconstructor method deconstruct.

@Override
public void deconstruct(Object component) {
    if (component instanceof AbstractComponent) {
        AbstractComponent abstractComponent = (AbstractComponent) component;
        if (abstractComponent.isDeconstructable()) {
            executor.schedule(new DestructComponentTask(abstractComponent), delay.getSeconds(), TimeUnit.SECONDS);
        }
    } else if (component instanceof Provider) {
        // TODO Providers should most likely be deconstructed similarily to AbstractComponent
        log.info("Starting deconstruction of provider " + component);
        ((Provider) component).deconstruct();
        log.info("Finished deconstruction of provider " + component);
    } else if (component instanceof SharedResource) {
        log.info("Releasing container reference to resource " + component);
        // No need to delay release, as jdisc does ref-counting
        ((SharedResource) component).release();
    }
}
Also used : AbstractComponent(com.yahoo.component.AbstractComponent) SharedResource(com.yahoo.jdisc.SharedResource) Provider(com.yahoo.container.di.componentgraph.Provider)

Aggregations

AbstractComponent (com.yahoo.component.AbstractComponent)3 Provider (com.yahoo.container.di.componentgraph.Provider)1 SharedResource (com.yahoo.jdisc.SharedResource)1 Searcher (com.yahoo.search.Searcher)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1