use of org.springframework.remoting.rmi.RmiServiceExporter in project otter by alibaba.
the class RmiCommunicationEndpoint method initial.
public void initial() {
export = new RmiServiceExporter();
export.setServiceName("endpoint");
// 暴露自己
export.setService(this);
export.setServiceInterface(CommunicationEndpoint.class);
export.setRegistryHost(host);
export.setRegistryPort(port);
// 强制创建一个
export.setAlwaysCreateRegistry(alwaysCreateRegistry);
try {
export.afterPropertiesSet();
} catch (RemoteException e) {
throw new CommunicationException("Rmi_Create_Error", e);
}
}
use of org.springframework.remoting.rmi.RmiServiceExporter in project dubbo by alibaba.
the class RmiProtocol method doExport.
protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException {
final RmiServiceExporter rmiServiceExporter = new RmiServiceExporter();
rmiServiceExporter.setRegistryPort(url.getPort());
rmiServiceExporter.setServiceName(url.getPath());
rmiServiceExporter.setServiceInterface(type);
rmiServiceExporter.setService(impl);
try {
rmiServiceExporter.afterPropertiesSet();
} catch (RemoteException e) {
throw new RpcException(e.getMessage(), e);
}
return new Runnable() {
public void run() {
try {
rmiServiceExporter.destroy();
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
}
};
}
Aggregations