public class org.apache.dubbo.registry.client.FileSystemServiceDiscovery extends org.apache.dubbo.registry.client.AbstractServiceDiscovery implements org.apache.dubbo.event.EventListener
{
private final org.apache.dubbo.common.logger.Logger logger;
private final java.util.Map fileLocksCache;
private org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration dynamicConfiguration;
public void <init>()
{
org.apache.dubbo.common.logger.Logger v;
java.util.concurrent.ConcurrentHashMap v;
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.lang.Class v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
specialinvoke v.<org.apache.dubbo.registry.client.AbstractServiceDiscovery: void <init>()>();
v = virtualinvoke v.<java.lang.Object: java.lang.Class getClass()>();
v = staticinvoke <org.apache.dubbo.common.logger.LoggerFactory: org.apache.dubbo.common.logger.Logger getLogger(java.lang.Class)>(v);
v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.logger.Logger logger> = v;
v = new java.util.concurrent.ConcurrentHashMap;
specialinvoke v.<java.util.concurrent.ConcurrentHashMap: void <init>()>();
v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.util.Map fileLocksCache> = v;
return;
}
public void onEvent(org.apache.dubbo.registry.client.event.ServiceInstancesChangedEvent)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.registry.client.event.ServiceInstancesChangedEvent v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: org.apache.dubbo.registry.client.event.ServiceInstancesChangedEvent;
return;
}
public void initialize(org.apache.dubbo.common.URL) throws java.lang.Exception
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.common.URL v;
org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: org.apache.dubbo.common.URL;
v = staticinvoke <org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration createDynamicConfiguration(org.apache.dubbo.common.URL)>(v);
v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration dynamicConfiguration> = v;
specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: void registerDubboShutdownHook()>();
specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: void registerListener()>();
return;
}
private void registerDubboShutdownHook()
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.common.lang.ShutdownHookCallbacks v;
org.apache.dubbo.common.lang.ShutdownHookCallback v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v = <org.apache.dubbo.common.lang.ShutdownHookCallbacks: org.apache.dubbo.common.lang.ShutdownHookCallbacks INSTANCE>;
v = staticinvoke <org.apache.dubbo.registry.client.FileSystemServiceDiscovery$destroy__446: org.apache.dubbo.common.lang.ShutdownHookCallback bootstrap$(org.apache.dubbo.registry.client.FileSystemServiceDiscovery)>(v);
virtualinvoke v.<org.apache.dubbo.common.lang.ShutdownHookCallbacks: org.apache.dubbo.common.lang.ShutdownHookCallbacks addCallback(org.apache.dubbo.common.lang.ShutdownHookCallback)>(v);
return;
}
private void registerListener()
{
java.util.function.Consumer v;
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.util.Set v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v = virtualinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.util.Set getServices()>();
v = staticinvoke <org.apache.dubbo.registry.client.FileSystemServiceDiscovery$lambda_registerListener_1__447: java.util.function.Consumer bootstrap$(org.apache.dubbo.registry.client.FileSystemServiceDiscovery)>(v);
interfaceinvoke v.<java.util.Set: void forEach(java.util.function.Consumer)>(v);
return;
}
public void onConfigChanged(org.apache.dubbo.common.config.configcenter.ConfigChangedEvent)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.common.config.configcenter.ConfigChangedEvent v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: org.apache.dubbo.common.config.configcenter.ConfigChangedEvent;
return;
}
public void destroy() throws java.lang.Exception
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration dynamicConfiguration>;
virtualinvoke v.<org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration: void close()>();
specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: void releaseAndRemoveRegistrationFiles()>();
return;
}
private void releaseAndRemoveRegistrationFiles()
{
java.util.function.Consumer v;
java.util.Map v;
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.util.Set v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.util.Map fileLocksCache>;
v = interfaceinvoke v.<java.util.Map: java.util.Set keySet()>();
v = staticinvoke <org.apache.dubbo.registry.client.FileSystemServiceDiscovery$lambda_releaseAndRemoveRegistrationFiles_2__448: java.util.function.Consumer bootstrap$(org.apache.dubbo.registry.client.FileSystemServiceDiscovery)>(v);
interfaceinvoke v.<java.util.Set: void forEach(java.util.function.Consumer)>(v);
return;
}
private void removeFile(java.io.File)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.io.File v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: java.io.File;
staticinvoke <org.apache.commons.io.FileUtils: boolean deleteQuietly(java.io.File)>(v);
return;
}
private java.lang.String getServiceInstanceId(org.apache.dubbo.registry.client.ServiceInstance)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.registry.client.ServiceInstance v;
java.lang.String v, v, v;
java.lang.Integer v;
boolean v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: org.apache.dubbo.registry.client.ServiceInstance;
v = interfaceinvoke v.<org.apache.dubbo.registry.client.ServiceInstance: java.lang.String getId()>();
v = staticinvoke <org.apache.dubbo.common.utils.StringUtils: boolean isBlank(java.lang.CharSequence)>(v);
if v == 0 goto label;
v = interfaceinvoke v.<org.apache.dubbo.registry.client.ServiceInstance: java.lang.String getHost()>();
v = interfaceinvoke v.<org.apache.dubbo.registry.client.ServiceInstance: java.lang.Integer getPort()>();
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String,java.lang.Integer)>(v, v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("\u.\u0001");
return v;
label:
return v;
}
private java.lang.String getServiceName(org.apache.dubbo.registry.client.ServiceInstance)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.registry.client.ServiceInstance v;
java.lang.String v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: org.apache.dubbo.registry.client.ServiceInstance;
v = interfaceinvoke v.<org.apache.dubbo.registry.client.ServiceInstance: java.lang.String getServiceName()>();
return v;
}
public java.util.List getInstances(java.lang.String)
{
java.util.SortedSet v;
java.util.function.Function v, v;
org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration v;
java.util.stream.Stream v, v, v;
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.lang.Object v;
java.lang.String v;
java.util.stream.Collector v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: java.lang.String;
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration dynamicConfiguration>;
v = virtualinvoke v.<org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration: java.util.SortedSet getConfigKeys(java.lang.String)>("dubbo");
v = interfaceinvoke v.<java.util.SortedSet: java.util.stream.Stream stream()>();
v = staticinvoke <org.apache.dubbo.registry.client.FileSystemServiceDiscovery$lambda_getInstances_3__449: java.util.function.Function bootstrap$(org.apache.dubbo.registry.client.FileSystemServiceDiscovery,java.lang.String)>(v, v);
v = interfaceinvoke v.<java.util.stream.Stream: java.util.stream.Stream map(java.util.function.Function)>(v);
v = staticinvoke <org.apache.dubbo.registry.client.FileSystemServiceDiscovery$lambda_getInstances_4__450: java.util.function.Function bootstrap$()>();
v = interfaceinvoke v.<java.util.stream.Stream: java.util.stream.Stream map(java.util.function.Function)>(v);
v = staticinvoke <java.util.stream.Collectors: java.util.stream.Collector toList()>();
v = interfaceinvoke v.<java.util.stream.Stream: java.lang.Object collect(java.util.stream.Collector)>(v);
return v;
}
public org.apache.dubbo.common.URL getUrl()
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
return null;
}
public void doRegister(org.apache.dubbo.registry.client.ServiceInstance)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.registry.client.ServiceInstance v;
java.lang.String v, v, v;
org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration v;
boolean v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: org.apache.dubbo.registry.client.ServiceInstance;
v = specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.lang.String getServiceInstanceId(org.apache.dubbo.registry.client.ServiceInstance)>(v);
v = specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.lang.String getServiceName(org.apache.dubbo.registry.client.ServiceInstance)>(v);
v = staticinvoke <com.alibaba.fastjson.JSON: java.lang.String toJSONString(java.lang.Object)>(v);
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration dynamicConfiguration>;
v = virtualinvoke v.<org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration: boolean publishConfig(java.lang.String,java.lang.String,java.lang.String)>(v, v, v);
if v == 0 goto label;
specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: void lockFile(java.lang.String,java.lang.String)>(v, v);
label:
return;
}
private void lockFile(java.lang.String, java.lang.String)
{
java.util.Map v;
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.lang.String v, v;
java.nio.file.Path v;
java.util.function.Function v;
java.io.File v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: java.lang.String;
v := @parameter: java.lang.String;
v = specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.io.File serviceInstanceFile(java.lang.String,java.lang.String)>(v, v);
v = virtualinvoke v.<java.io.File: java.nio.file.Path toPath()>();
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.util.Map fileLocksCache>;
v = staticinvoke <org.apache.dubbo.registry.client.FileSystemServiceDiscovery$lambda_lockFile_5__451: java.util.function.Function bootstrap$(org.apache.dubbo.registry.client.FileSystemServiceDiscovery,java.nio.file.Path)>(v, v);
interfaceinvoke v.<java.util.Map: java.lang.Object computeIfAbsent(java.lang.Object,java.util.function.Function)>(v, v);
return;
}
public void doUpdate(org.apache.dubbo.registry.client.ServiceInstance)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.registry.client.ServiceInstance v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: org.apache.dubbo.registry.client.ServiceInstance;
virtualinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: void register(org.apache.dubbo.registry.client.ServiceInstance)>(v);
return;
}
public void unregister(org.apache.dubbo.registry.client.ServiceInstance) throws java.lang.RuntimeException
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
org.apache.dubbo.registry.client.ServiceInstance v;
java.lang.String v, v;
org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: org.apache.dubbo.registry.client.ServiceInstance;
v = specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.lang.String getServiceInstanceId(org.apache.dubbo.registry.client.ServiceInstance)>(v);
v = specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.lang.String getServiceName(org.apache.dubbo.registry.client.ServiceInstance)>(v);
specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: void releaseFileLock(java.lang.String,java.lang.String)>(v, v);
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration dynamicConfiguration>;
virtualinvoke v.<org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration: boolean removeConfig(java.lang.String,java.lang.String)>(v, v);
return;
}
private void releaseFileLock(java.lang.String, java.lang.String)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.lang.String v, v;
java.io.File v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: java.lang.String;
v := @parameter: java.lang.String;
v = specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.io.File serviceInstanceFile(java.lang.String,java.lang.String)>(v, v);
specialinvoke v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: void releaseFileLock(java.io.File)>(v);
return;
}
private void releaseFileLock(java.io.File)
{
java.util.Map v;
java.util.function.BiFunction v;
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.io.File v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: java.io.File;
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: java.util.Map fileLocksCache>;
v = staticinvoke <org.apache.dubbo.registry.client.FileSystemServiceDiscovery$lambda_releaseFileLock_6__452: java.util.function.BiFunction bootstrap$(org.apache.dubbo.registry.client.FileSystemServiceDiscovery,java.io.File)>(v, v);
interfaceinvoke v.<java.util.Map: java.lang.Object computeIfPresent(java.lang.Object,java.util.function.BiFunction)>(v, v);
return;
}
private void releaseFileLock(java.nio.channels.FileLock)
{
java.lang.Throwable v;
org.apache.dubbo.common.logger.Logger v, v;
java.io.IOException v;
java.nio.channels.FileLock v;
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.lang.String v;
java.nio.channels.FileChannel v;
boolean v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: java.nio.channels.FileLock;
label:
v = virtualinvoke v.<java.nio.channels.FileLock: java.nio.channels.FileChannel channel()>();
label:
virtualinvoke v.<java.nio.channels.FileLock: void release()>();
label:
if v == null goto label;
virtualinvoke v.<java.nio.channels.FileChannel: void close()>();
goto label;
label:
v := @caughtexception;
throw v;
label:
v := @caughtexception;
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.logger.Logger logger>;
v = interfaceinvoke v.<org.apache.dubbo.common.logger.Logger: boolean isErrorEnabled()>();
if v == 0 goto label;
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.logger.Logger logger>;
v = virtualinvoke v.<java.io.IOException: java.lang.String getMessage()>();
interfaceinvoke v.<org.apache.dubbo.common.logger.Logger: void error(java.lang.String,java.lang.Throwable)>(v, v);
label:
return;
catch java.lang.Throwable from label to label with label;
catch java.io.IOException from label to label with label;
}
private java.io.File serviceInstanceFile(java.lang.String, java.lang.String)
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.lang.String v, v;
org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration v;
java.io.File v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v := @parameter: java.lang.String;
v := @parameter: java.lang.String;
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration dynamicConfiguration>;
v = virtualinvoke v.<org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration: java.io.File configFile(java.lang.String,java.lang.String)>(v, v);
return v;
}
public java.util.Set getServices()
{
org.apache.dubbo.registry.client.FileSystemServiceDiscovery v;
java.util.Set v;
org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration v;
v := @this: org.apache.dubbo.registry.client.FileSystemServiceDiscovery;
v = v.<org.apache.dubbo.registry.client.FileSystemServiceDiscovery: org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration dynamicConfiguration>;
v = virtualinvoke v.<org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration: java.util.Set getConfigGroups()>();
return v;
}
private static org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration createDynamicConfiguration(org.apache.dubbo.common.URL)
{
org.apache.dubbo.common.URL v, v;
java.lang.String v, v, v, v;
org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration v;
v := @parameter: org.apache.dubbo.common.URL;
v = staticinvoke <java.lang.System: java.lang.String getProperty(java.lang.String)>("user.home");
v = <java.io.File: java.lang.String separator>;
v = <java.io.File: java.lang.String separator>;
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String,java.lang.String,java.lang.String)>(v, v, v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("\u0001\u.dubbo\u0001registry");
v = new org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration;
v = virtualinvoke v.<org.apache.dubbo.common.URL: org.apache.dubbo.common.URL addParameter(java.lang.String,java.lang.String)>("dubbo.config-center.dir", v);
specialinvoke v.<org.apache.dubbo.common.config.configcenter.file.FileSystemDynamicConfiguration: void <init>(org.apache.dubbo.common.URL)>(v);
return v;
}
}