com.alibaba.dubbo.rpc.ExporterListener Java Examples

The following examples show how to use com.alibaba.dubbo.rpc.ExporterListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListenerExporterWrapper.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
public ListenerExporterWrapper(Exporter<T> exporter, List<ExporterListener> listeners) {
    if (exporter == null) {
        throw new IllegalArgumentException("exporter == null");
    }
    this.exporter = exporter;
    this.listeners = listeners;
    if (listeners != null && !listeners.isEmpty()) {
        RuntimeException exception = null;
        for (ExporterListener listener : listeners) {
            if (listener != null) {
                try {
                    listener.exported(this);
                } catch (RuntimeException t) {
                    logger.error(t.getMessage(), t);
                    exception = t;
                }
            }
        }
        if (exception != null) {
            throw exception;
        }
    }
}
 
Example #2
Source File: ListenerExporterWrapper.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
@Override
public void unexport() {
    try {
        exporter.unexport();
    } finally {
        if (listeners != null && !listeners.isEmpty()) {
            RuntimeException exception = null;
            for (ExporterListener listener : listeners) {
                if (listener != null) {
                    try {
                        listener.unexported(this);
                    } catch (RuntimeException t) {
                        logger.error(t.getMessage(), t);
                        exception = t;
                    }
                }
            }
            if (exception != null) {
                throw exception;
            }
        }
    }
}
 
Example #3
Source File: ListenerExporterWrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public void unexport() {
    try {
        exporter.unexport();
    } finally {
        if (listeners != null && listeners.size() > 0) {
            RuntimeException exception = null;
            for (ExporterListener listener : listeners) {
                if (listener != null) {
                    try {
                        listener.unexported(this);
                    } catch (RuntimeException t) {
                        logger.error(t.getMessage(), t);
                        exception = t;
                    }
                }
            }
            if (exception != null) {
                throw exception;
            }
        }
    }
}
 
Example #4
Source File: ListenerExporterWrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public ListenerExporterWrapper(Exporter<T> exporter, List<ExporterListener> listeners){
    if (exporter == null) {
        throw new IllegalArgumentException("exporter == null");
    }
    this.exporter = exporter;
    this.listeners = listeners;
    if (listeners != null && listeners.size() > 0) {
        RuntimeException exception = null;
        for (ExporterListener listener : listeners) {
            if (listener != null) {
                try {
                    listener.exported(this);
                } catch (RuntimeException t) {
                    logger.error(t.getMessage(), t);
                    exception = t;
                }
            }
        }
        if (exception != null) {
            throw exception;
        }
    }
}
 
Example #5
Source File: ListenerExporterWrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public ListenerExporterWrapper(Exporter<T> exporter, List<ExporterListener> listeners){
    if (exporter == null) {
        throw new IllegalArgumentException("exporter == null");
    }
    this.exporter = exporter;
    this.listeners = listeners;
    if (listeners != null && listeners.size() > 0) {
        RuntimeException exception = null;
        for (ExporterListener listener : listeners) {
            if (listener != null) {
                try {
                    listener.exported(this);
                } catch (RuntimeException t) {
                    logger.error(t.getMessage(), t);
                    exception = t;
                }
            }
        }
        if (exception != null) {
            throw exception;
        }
    }
}
 
Example #6
Source File: ListenerExporterWrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public void unexport() {
    try {
        exporter.unexport();
    } finally {
        if (listeners != null && listeners.size() > 0) {
            RuntimeException exception = null;
            for (ExporterListener listener : listeners) {
                if (listener != null) {
                    try {
                        listener.unexported(this);
                    } catch (RuntimeException t) {
                        logger.error(t.getMessage(), t);
                        exception = t;
                    }
                }
            }
            if (exception != null) {
                throw exception;
            }
        }
    }
}
 
Example #7
Source File: ListenerExporterWrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public void unexport() {
    try {
        exporter.unexport();
    } finally {
        if (listeners != null && listeners.size() > 0) {
            RuntimeException exception = null;
            for (ExporterListener listener : listeners) {
                if (listener != null) {
                    try {
                        listener.unexported(this);
                    } catch (RuntimeException t) {
                        logger.error(t.getMessage(), t);
                        exception = t;
                    }
                }
            }
            if (exception != null) {
                throw exception;
            }
        }
    }
}
 
Example #8
Source File: ListenerExporterWrapper.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
public ListenerExporterWrapper(Exporter<T> exporter, List<ExporterListener> listeners){
    if (exporter == null) {
        throw new IllegalArgumentException("exporter == null");
    }
    this.exporter = exporter;
    this.listeners = listeners;
    if (listeners != null && listeners.size() > 0) {
        RuntimeException exception = null;
        for (ExporterListener listener : listeners) {
            if (listener != null) {
                try {
                    listener.exported(this);
                } catch (RuntimeException t) {
                    logger.error(t.getMessage(), t);
                    exception = t;
                }
            }
        }
        if (exception != null) {
            throw exception;
        }
    }
}
 
Example #9
Source File: ListenerExporterWrapper.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
public void unexport() {
    try {
        exporter.unexport();
    } finally {
        if (listeners != null && listeners.size() > 0) {
            RuntimeException exception = null;
            for (ExporterListener listener : listeners) {
                if (listener != null) {
                    try {
                        listener.unexported(this);
                    } catch (RuntimeException t) {
                        logger.error(t.getMessage(), t);
                        exception = t;
                    }
                }
            }
            if (exception != null) {
                throw exception;
            }
        }
    }
}
 
Example #10
Source File: ListenerExporterWrapper.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public ListenerExporterWrapper(Exporter<T> exporter, List<ExporterListener> listeners){
    if (exporter == null) {
        throw new IllegalArgumentException("exporter == null");
    }
    this.exporter = exporter;
    this.listeners = listeners;
    if (listeners != null && listeners.size() > 0) {
        RuntimeException exception = null;
        for (ExporterListener listener : listeners) {
            if (listener != null) {
                try {
                    listener.exported(this);
                } catch (RuntimeException t) {
                    logger.error(t.getMessage(), t);
                    exception = t;
                }
            }
        }
        if (exception != null) {
            throw exception;
        }
    }
}
 
Example #11
Source File: ListenerExporterWrapper.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
public ListenerExporterWrapper(Exporter<T> exporter, List<ExporterListener> listeners){
    if (exporter == null) {
        throw new IllegalArgumentException("exporter == null");
    }
    this.exporter = exporter;
    this.listeners = listeners;
    if (listeners != null && listeners.size() > 0) {
        RuntimeException exception = null;
        for (ExporterListener listener : listeners) {
            if (listener != null) {
                try {
                    listener.exported(this);
                } catch (RuntimeException t) {
                    logger.error(t.getMessage(), t);
                    exception = t;
                }
            }
        }
        if (exception != null) {
            throw exception;
        }
    }
}
 
Example #12
Source File: ListenerExporterWrapper.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
public void unexport() {
    try {
        exporter.unexport();
    } finally {
        if (listeners != null && listeners.size() > 0) {
            RuntimeException exception = null;
            for (ExporterListener listener : listeners) {
                if (listener != null) {
                    try {
                        listener.unexported(this);
                    } catch (RuntimeException t) {
                        logger.error(t.getMessage(), t);
                        exception = t;
                    }
                }
            }
            if (exception != null) {
                throw exception;
            }
        }
    }
}
 
Example #13
Source File: ProtocolListenerWrapper.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
    if (Constants.REGISTRY_PROTOCOL.equals(invoker.getUrl().getProtocol())) {
        return protocol.export(invoker);
    }
    return new ListenerExporterWrapper<>(protocol.export(invoker),
            Collections.unmodifiableList(ExtensionLoader.getExtensionLoader(ExporterListener.class)
                    .getActivateExtension(invoker.getUrl(), Constants.EXPORTER_LISTENER_KEY)));
}
 
Example #14
Source File: ProtocolListenerWrapper.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
    if (Constants.REGISTRY_PROTOCOL.equals(invoker.getUrl().getProtocol())) {
        return protocol.export(invoker);
    }
    return new ListenerExporterWrapper<T>(protocol.export(invoker), 
            Collections.unmodifiableList(ExtensionLoader.getExtensionLoader(ExporterListener.class)
                    .getActivateExtension(invoker.getUrl(), Constants.EXPORTER_LISTENER_KEY)));
}
 
Example #15
Source File: ProtocolListenerWrapper.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
    if (Constants.REGISTRY_PROTOCOL.equals(invoker.getUrl().getProtocol())) {
        return protocol.export(invoker);
    }
    return new ListenerExporterWrapper<T>(protocol.export(invoker), 
            Collections.unmodifiableList(ExtensionLoader.getExtensionLoader(ExporterListener.class)
                    .getActivateExtension(invoker.getUrl(), Constants.EXPORTER_LISTENER_KEY)));
}
 
Example #16
Source File: ProtocolListenerWrapper.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
    public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
//        invoker.getUrl().getProtocol()取值是scope的值,scope默认值值是registry,如果设置injvm会走本地服务export
        if (Constants.REGISTRY_PROTOCOL.equals(invoker.getUrl().getProtocol())) {
//          RegistryProtocol.export()
            return protocol.export(invoker);
        }
//        这里可以实现自己的ExporterListener实现,在服务export、unexport的时候的监听器实现 com.alibaba.dubbo.rpc.protocol.injvm.InjvmProtocol.export()=》
        return new ListenerExporterWrapper<T>(protocol.export(invoker),
                Collections.unmodifiableList(ExtensionLoader.getExtensionLoader(ExporterListener.class)
                        .getActivateExtension(invoker.getUrl(), Constants.EXPORTER_LISTENER_KEY)));
    }
 
Example #17
Source File: ProtocolListenerWrapper.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
    if (Constants.REGISTRY_PROTOCOL.equals(invoker.getUrl().getProtocol())) {
        return protocol.export(invoker);
    }
    return new ListenerExporterWrapper<T>(protocol.export(invoker), 
            Collections.unmodifiableList(ExtensionLoader.getExtensionLoader(ExporterListener.class)
                    .getActivateExtension(invoker.getUrl(), Constants.EXPORTER_LISTENER_KEY)));
}
 
Example #18
Source File: ProtocolListenerWrapper.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
    if (Constants.REGISTRY_PROTOCOL.equals(invoker.getUrl().getProtocol())) {
        return protocol.export(invoker);
    }
    return new ListenerExporterWrapper<T>(protocol.export(invoker), 
            Collections.unmodifiableList(ExtensionLoader.getExtensionLoader(ExporterListener.class)
                    .getActivateExtension(invoker.getUrl(), Constants.EXPORTER_LISTENER_KEY)));
}
 
Example #19
Source File: AbstractServiceConfig.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
@Override
public void setListener(String listener) {
    checkMultiExtension(ExporterListener.class, "listener", listener);
    super.setListener(listener);
}
 
Example #20
Source File: AbstractServiceConfig.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Override
public void setListener(String listener) {
    checkMultiExtension(ExporterListener.class, "listener", listener);
    super.setListener(listener);
}
 
Example #21
Source File: AbstractServiceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public void setListener(String listener) {
    checkMultiExtension(ExporterListener.class, "listener", listener);
    super.setListener(listener);
}
 
Example #22
Source File: AbstractServiceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public void setListener(String listener) {
    checkMultiExtension(ExporterListener.class, "listener", listener);
    super.setListener(listener);
}
 
Example #23
Source File: AbstractServiceConfig.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
public void setListener(String listener) {
    checkMultiExtension(ExporterListener.class, "listener", listener);
    this.listener = listener;
}
 
Example #24
Source File: AbstractServiceConfig.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public void setListener(String listener) {
    checkMultiExtension(ExporterListener.class, "listener", listener);
    super.setListener(listener);
}