Java 以编程方式从Eureka服务器中删除已注册实例
有没有一种方法可以在不使用REST操作的情况下从Eureka服务器中删除已注册的实例?哪个是包含所有应用程序的数据结构Java 以编程方式从Eureka服务器中删除已注册实例,java,spring,spring-cloud,netflix-eureka,spring-cloud-netflix,Java,Spring,Spring Cloud,Netflix Eureka,Spring Cloud Netflix,有没有一种方法可以在不使用REST操作的情况下从Eureka服务器中删除已注册的实例?哪个是包含所有应用程序的数据结构 (很明显,我想删除它们在Eureka服务器中编写代码)。您所追求的功能可以通过,它本身只是Netflix Eureka类(,和)的扩展 具体来说,AbstractInstanceRegistry#cancel(String,String,boolean)方法应该从注册表中删除应用程序 此方法的Javadoc声明: /** * Cancels the registration
(很明显,我想删除它们在Eureka服务器中编写代码)。您所追求的功能可以通过,它本身只是Netflix Eureka类(,和)的扩展 具体来说,
AbstractInstanceRegistry#cancel(String,String,boolean)
方法应该从注册表中删除应用程序
此方法的Javadoc声明:
/**
* Cancels the registration of an instance.
*
* <p>
* This is normally invoked by a client when it shuts down informing the
* server to remove the instance from traffic.
* </p>
*
* @param appName the application name of the application.
* @param id the unique identifier of the instance.
* @param isReplication true if this is a replication event from other nodes, false
* otherwise.
* @return true if the instance was removed from the {@link AbstractInstanceRegistry} successfully, false otherwise.
*/
/**
*取消实例的注册。
*
*
*这通常由客户端在关闭时调用,并通知
*服务器从流量中删除实例。
*
*
*@param appName应用程序的应用程序名称。
*@param id实例的唯一标识符。
*@param isReplication true如果这是来自其他节点的复制事件,则为false
*否则。
*@如果成功从{@link AbstractInstanceRegistry}删除实例,则返回true,否则返回false。
*/
这就是如何从Eureka服务器本身实现这一点