本文介绍了在Curator中使用ServiceCache通知实例已关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

馆长的文档( http://curator.apache.org/curator-x-discovery/index.html )说:

If a particular instance has an I/O error, etc. you should call ServiceProvider.noteError() passing in the instance.

我使用的是ServiceCache而不是ServiceProvider的实例(请参见).

I am using a ServiceCache to get my instances, rather than a ServiceProvider (see Using selection strategies with a cache in Curator).

在哪里可以找到noteError()方法?我在缓存对象上找不到它

Where can I find the noteError() method here? I can't find it on the cache object

推荐答案

ServiceCache上没有noteError(),但是正如@Randgalt指出的那样(),最好的方法是不使用ServiceCache而是使用ServiceProvider,因为在后台仍然使用缓存的情况下,并提供了noteError()方法.

There is no noteError() on a ServiceCache, however as @Randgalt notes (https://stackoverflow.com/a/57059811/2048051) the best way is to not use a ServiceCache but rather just use ServiceProvider, because in the background that uses a cache anyway, and it has the noteError() method available.

https://issues.apache.org/jira/browse/CURATOR-531 提出来使文档更清晰

这篇关于在Curator中使用ServiceCache通知实例已关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 08:43