Search in sources :

Example 1 with SharedResource

use of com.yahoo.jdisc.SharedResource 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)1 Provider (com.yahoo.container.di.componentgraph.Provider)1 SharedResource (com.yahoo.jdisc.SharedResource)1