首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用ClientCache实现复制区中的Pdx序列化

使用ClientCache实现复制区中的Pdx序列化
EN

Stack Overflow用户
提问于 2016-12-09 19:16:00
回答 1查看 1.1K关注 0票数 0

当我使用SB将Geode客户端缓存创建为->时,我在远程Geode实例上的PDX序列化有问题。

代码语言:javascript
复制
@Configuration
public class GeodeClientConfiguration {

@Bean
ClientCache cache() {
    return new ClientCacheFactory()
        .setPdxPersistent(true)
        .setPdxDiskStore("foo")
        .setPdxReadSerialized(true)
        .setPdxSerializer(new ReflectionBasedAutoSerializer(false, "foo.EpgProgram"))
        .create();
}

@Bean
Region<String, List<EpgProgram>> testRegion(final ClientCache cache) {
    return cache.<String, List<EpgProgram>> getRegion("schedule");
}

cache.xml看起来像->

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<client-cache
    xmlns="http://geode.apache.org/schema/cache"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://geode.apache.org/schema/cache
                    http://geode.apache.org/schema/cache/cache-1.0.xsd"
    version="1.0">
<pool name="serverPool">
    <locator host="localhost" port="10334"/>
</pool>
<region name="schedule"  refid="CACHING_PROXY">
    <region-attributes pool-name="serverPool"
            scope="global" />
</region>

在Gfsh中,我创建了一个区域为

代码语言:javascript
复制
create region --name=/schedule --type=REPLICATE_PERSISTENT

在方法测试过程中,向region添加EpgProgram列表时

代码语言:javascript
复制
public List<EpgProgram> getScheduleFromWhatson(String channel, LocalDate broadcastDate, Boolean expand) throws RestClientException, URISyntaxException {
    List<EpgProgram> programs = transform(whatsOnServiceInternal.getScheduleFromWhatson(channel, broadcastDate), expand);
    schedule.put(channel, programs);
    return programs;
}

pdx实例似乎是使用我在信息跟踪->中看到的反射生成的

代码语言:javascript
复制
[info 2016/12/09 11:32:33.361 CET <http-nio-8080-exec-1> tid=0xc8] Auto serializer generating type for class dk.dr.epg.core.EpgProgram for fields: 
printable: private boolean dk.dr.epg.core.EpgProgram.printable
live: private boolean dk.dr.epg.core.EpgProgram.live
rerun: private boolean dk.dr.epg.core.EpgProgram.rerun

但就在那之后,我得到了一个异常->

代码语言:javascript
复制
org.apache.geode.pdx.PdxInitializationException: The PDX metadata must be persistent in a member that has persistent data. See CacheFactory.setPdxPersistent.

是否错过了必须设置Pdx persistense的其他地方??

Geode版本:1.0.0-孵化中。

EN

回答 1

Stack Overflow用户

发布于 2016-12-13 04:40:05

您需要将pdx注册表配置为在服务器上永久存在。您可以在gfsh中这样做:

默认配置pdx -- gfsh> -store

我认为您需要在此之后重新启动服务器才能使更改生效。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41059201

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档