Search in sources :

Example 1 with Destroyable

use of com.tencent.polaris.api.control.Destroyable in project polaris-java by polarismesh.

the class BaseEngine method init.

public void init() throws PolarisException {
    sdkContext.init();
    subInit();
    serviceCallResultListeners = ServiceCallResultListener.getServiceCallResultListeners(sdkContext);
    sdkContext.registerDestroyHook(new Destroyable() {

        @Override
        protected void doDestroy() {
            if (null != serviceCallResultListeners) {
                for (ServiceCallResultListener listener : serviceCallResultListeners) {
                    listener.destroy();
                }
            }
        }
    });
    sdkContext.getValueContext().setValue(CTX_KEY_ENGINE, this);
}
Also used : Destroyable(com.tencent.polaris.api.control.Destroyable)

Example 2 with Destroyable

use of com.tencent.polaris.api.control.Destroyable in project polaris-java by polarismesh.

the class DefaultLimitAPI method subInit.

@Override
protected void subInit() {
    quotaFlow.init(sdkContext.getExtensions());
    sdkContext.registerDestroyHook(new Destroyable() {

        @Override
        protected void doDestroy() {
            quotaFlow.destroy();
        }
    });
    statPlugins = sdkContext.getPlugins().getPlugins(PluginTypes.STAT_REPORTER.getBaseType());
}
Also used : Destroyable(com.tencent.polaris.api.control.Destroyable)

Aggregations

Destroyable (com.tencent.polaris.api.control.Destroyable)2