Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# UnregisterKeys()方法未在apache geode本机客户端中执行_C#_Geode - Fatal编程技术网

C# UnregisterKeys()方法未在apache geode本机客户端中执行

C# UnregisterKeys()方法未在apache geode本机客户端中执行,c#,geode,C#,Geode,成功订阅区域并设置CacheListener并完成使用后, Region.GetSubscriptionService().UnregisterKeys(新列表(){key})似乎没有按照屏幕截图工作。 执行以下代码后,更新后(EntryEvent ev)仍会触发事件 如何正确地从该地区取消订阅 我正在使用ApacheGeodeNative 1.10.0 在.NET WPF Framework 4.6.0上运行它 图1-获取感兴趣的密钥: 图2-执行注销密钥并再次检查感兴趣的密钥 正在创建缓

成功订阅区域并设置CacheListener并完成使用后,
Region.GetSubscriptionService().UnregisterKeys(新列表(){key})
似乎没有按照屏幕截图工作。 执行以下代码后,更新后(EntryEvent ev)仍会触发事件

如何正确地从该地区取消订阅

我正在使用ApacheGeodeNative 1.10.0 在.NET WPF Framework 4.6.0上运行它

图1-获取感兴趣的密钥:

图2-执行注销密钥并再次检查感兴趣的密钥

正在创建缓存工厂:

cacheFactory.Set("log-file", _serviceName + "Geode.log")
            .Set("log-level", "info")
            .Set("statistic-sampling-enabled", "false")

            .Set("name", _serviceName)
            .SetPdxReadSerialized(true)
            .Create();
创建池:

_cache.GetPoolManager()
            .CreateFactory()
            .SetSubscriptionEnabled(true)
            .AddLocator(_host, _port)
            .SetFreeConnectionTimeout(new TimeSpan(5000))
            .Create();

仍然在研究这个问题,但是可以肯定的是,这似乎不是C++与GEODE的最新开发分支的问题。以下测试代码通过:

auto cache = createTestCache();
auto poolFactory =
    cache.getPoolManager().createFactory().setSubscriptionEnabled(true);
cluster.applyLocators(poolFactory);
poolFactory.create("default");
auto region = setupCachingProxyRegion(cache);
std::vector<std::shared_ptr<CacheableKey> > keys;
keys.push_back(std::make_shared<CacheableInt32>(123456));

region->registerKeys(keys, false, true);

auto attrMutator = region->getAttributesMutator();
auto listener = std::make_shared<SimpleCacheListioner>();
attrMutator->setCacheListener(listener);

region->put(123456, "foo");
region->put(123456, "bar");
region->put(123456, "baz");
region->put(123456, "qux");

region->unregisterKeys(keys);
auto stillInterested = region->getInterestList();
EXPECT_EQ(stillInterested.size(), 0);

EXPECT_EQ(listener->getCreateCount(), 1);
EXPECT_EQ(listener->getUpdateCount(), 3);
EXPECT_EQ(listener->getInvalidateCount(), 0);
EXPECT_EQ(listener->getDestroyCount(), 0);

cache.close();
auto-cache=createTestCache();
汽车制造厂=
cache.getPoolManager().createFactory().setSubscriptionEnabled(true);
集群应用程序(poolFactory);
创建(“默认”);
自动区域=setupCachingProxyRegion(缓存);
向量键;
键。推回(std::make_shared(123456));
区域->注册表键(键、假、真);
自动属性变换器=区域->getAttributesMutator();
自动侦听器=std::使_共享();
attrMutator->setCacheListener(侦听器);
地区->出售(123456,“foo”);
区域->放置(123456,“条形”);
地区->出售(123456,“baz”);
地区->投入(123456,“qux”);
区域->取消注册密钥(密钥);
auto StillInterest=region->getInterestList();
EXPECT_EQ(stillinterest.size(),0);
EXPECT_EQ(侦听器->getCreateCount(),1);
EXPECT_EQ(侦听器->getUpdateCount(),3);
EXPECT\u EQ(侦听器->getInvalidateCount(),0);
EXPECT_EQ(侦听器->getDestroyCount(),0);
cache.close();

理论上,C++的./.NET GODE本地客户端只是用最小的变化来包装C++代码,所以这里的语言不应该是问题,但是当然我不知道,直到我尝试。类似地,我不记得自1.10.0版本发布以来,在这部分代码中做过任何更改,但是在我尝试之前我也不知道,所以回滚到提交并重新运行测试也是我的任务列表中的一部分。当我学习时,我将提供一个更新。

仍然在为这个问题做准备,但是可以肯定的是,这似乎不是C++与最新开发分支中的GEOD对话的问题。以下测试代码通过:

auto cache = createTestCache();
auto poolFactory =
    cache.getPoolManager().createFactory().setSubscriptionEnabled(true);
cluster.applyLocators(poolFactory);
poolFactory.create("default");
auto region = setupCachingProxyRegion(cache);
std::vector<std::shared_ptr<CacheableKey> > keys;
keys.push_back(std::make_shared<CacheableInt32>(123456));

region->registerKeys(keys, false, true);

auto attrMutator = region->getAttributesMutator();
auto listener = std::make_shared<SimpleCacheListioner>();
attrMutator->setCacheListener(listener);

region->put(123456, "foo");
region->put(123456, "bar");
region->put(123456, "baz");
region->put(123456, "qux");

region->unregisterKeys(keys);
auto stillInterested = region->getInterestList();
EXPECT_EQ(stillInterested.size(), 0);

EXPECT_EQ(listener->getCreateCount(), 1);
EXPECT_EQ(listener->getUpdateCount(), 3);
EXPECT_EQ(listener->getInvalidateCount(), 0);
EXPECT_EQ(listener->getDestroyCount(), 0);

cache.close();
auto-cache=createTestCache();
汽车制造厂=
cache.getPoolManager().createFactory().setSubscriptionEnabled(true);
集群应用程序(poolFactory);
创建(“默认”);
自动区域=setupCachingProxyRegion(缓存);
向量键;
键。推回(std::make_shared(123456));
区域->注册表键(键、假、真);
自动属性变换器=区域->getAttributesMutator();
自动侦听器=std::使_共享();
attrMutator->setCacheListener(侦听器);
地区->出售(123456,“foo”);
区域->放置(123456,“条形”);
地区->出售(123456,“baz”);
地区->投入(123456,“qux”);
区域->取消注册密钥(密钥);
auto StillInterest=region->getInterestList();
EXPECT_EQ(stillinterest.size(),0);
EXPECT_EQ(侦听器->getCreateCount(),1);
EXPECT_EQ(侦听器->getUpdateCount(),3);
EXPECT\u EQ(侦听器->getInvalidateCount(),0);
EXPECT_EQ(侦听器->getDestroyCount(),0);
cache.close();

理论上,C++的./.NET GODE本地客户端只是用最小的变化来包装C++代码,所以这里的语言不应该是问题,但是当然我不知道,直到我尝试。类似地,我不记得自1.10.0版本发布以来,在这部分代码中做过任何更改,但是在我尝试之前我也不知道,所以回滚到提交并重新运行测试也是我的任务列表中的一部分。当/如果我了解更多信息,我将在这里提供更新。

我认为在这种情况下,测试本身存在问题


问题在于假设CacheListener是订阅的一部分,但实际上它只是与区域关联,任何本地或远程事件都可以触发CacheListener。要确定事件源,作为Cachelistener事件处理的一部分,用户必须通过RemoteOrigin方法检查EntryEvent的来源。在密钥中使用register interest是一个服务器端事件,因此注销密钥中的interest也是一个服务器端操作,它应该停止将事件从服务器推送到客户端,但仍然会为本地事件触发CacheListener。如果希望侦听器不再触发,则必须通过region AttributesMutator将其设置为null

我认为在这种情况下,测试本身存在问题

问题在于假设CacheListener是订阅的一部分,但实际上它只是与区域关联,任何本地或远程事件都可以触发CacheListener。要确定事件源,作为Cachelistener事件处理的一部分,用户必须通过RemoteOrigin方法检查EntryEvent的来源。在密钥中使用register interest是一个服务器端事件,因此注销密钥中的interest也是一个服务器端操作,它应该停止将事件从服务器推送到客户端,但仍然会为本地事件触发CacheListener。如果希望侦听器不再触发,则必须通过region AttributesMutator将其设置为null

更新-确认这是C#(CLI)代码中的一个问题。Bug作为.UPDATE归档-确认这是C#(CLI)代码中的一个问题。臭虫被归档为。