• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Serializer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.hazelcast.nio.serialization.Serializer的典型用法代码示例。如果您正苦于以下问题:Java Serializer类的具体用法?Java Serializer怎么用?Java Serializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Serializer类属于com.hazelcast.nio.serialization包,在下文中一共展示了Serializer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    if (cacheEntryClass == null) {
        return null;
    }

    try {
        cacheEntryClass.getMethod("areLazyPropertiesUnfetched");

        // If CacheEntry.areLazyPropertiesUnfetched() exists, we're on Hibernate 5
        return new Hibernate5CacheEntrySerializer();
    } catch (NoSuchMethodException e) {
        // Otherwise, if there's no such method, we're on Hibernate 5.1+
        return new Hibernate51CacheEntrySerializer();
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:17,代码来源:Hibernate5CacheEntrySerializerHook.java


示例2: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<LongAccumulator>() {
        @Override
        public int getTypeId() {
            return SerializerHookConstants.LONG_ACC;
        }

        @Override
        public void destroy() {

        }

        @Override
        public void write(ObjectDataOutput out, LongAccumulator object) throws IOException {
            out.writeLong(object.get());
        }

        @Override
        public LongAccumulator read(ObjectDataInput in) throws IOException {
            return new LongAccumulator(in.readLong());
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:25,代码来源:AccumulatorSerializerHooks.java


示例3: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<Tuple2>() {
        @Override
        public void write(ObjectDataOutput out, Tuple2 t) throws IOException {
            out.writeObject(t.f0());
            out.writeObject(t.f1());
        }

        @Override
        public Tuple2 read(ObjectDataInput in) throws IOException {
            return tuple2(in.readObject(), in.readObject());
        }

        @Override
        public int getTypeId() {
            return SerializerHookConstants.TUPLE2;
        }

        @Override
        public void destroy() {
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:25,代码来源:DataModelSerializerHooks.java


示例4: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<Entry>() {
        @Override
        public int getTypeId() {
            return SerializerHookConstants.MAP_ENTRY;
        }

        @Override
        public void write(ObjectDataOutput out, Entry object) throws IOException {
            out.writeObject(object.getKey());
            out.writeObject(object.getValue());
        }

        @Override
        public Entry read(ObjectDataInput in) throws IOException {
            return entry(in.readObject(), in.readObject());
        }

        @Override
        public void destroy() {
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:25,代码来源:MapEntryHook.java


示例5: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<SnapshotBarrier>() {
        @Override
        public int getTypeId() {
            return SerializerHookConstants.SNAPSHOT_BARRIER;
        }

        @Override
        public void destroy() {
        }

        @Override
        public void write(ObjectDataOutput out, SnapshotBarrier object) throws IOException {
            out.writeLong(object.snapshotId());
        }

        @Override
        public SnapshotBarrier read(ObjectDataInput in) throws IOException {
            return new SnapshotBarrier(in.readLong());
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:24,代码来源:ExecutionSerializerHooks.java


示例6: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<Watermark>() {
        @Override
        public int getTypeId() {
            return SerializerHookConstants.WATERMARK;
        }

        @Override
        public void destroy() {
        }

        @Override
        public void write(ObjectDataOutput out, Watermark object) throws IOException {
            out.writeLong(object.timestamp());
        }

        @Override
        public Watermark read(ObjectDataInput in) throws IOException {
            return new Watermark(in.readLong());
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:24,代码来源:CoreSerializerHooks.java


示例7: newHzInstance

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
private HazelcastInstance newHzInstance(Class<?> typeClass, Serializer serializer) {
    Config cfg = new Config();
    cfg.setProperty("hazelcast.logging.type","log4j2");

    cfg.getSerializationConfig().getSerializerConfigs().add(
        new SerializerConfig()
            .setTypeClass(typeClass)
            .setImplementation(serializer)
    );

    NetworkConfig network = cfg.getNetworkConfig();
    JoinConfig join = network.getJoin();
    join.getMulticastConfig().setEnabled(true);
    join.getTcpIpConfig().setEnabled(false);

    network.getInterfaces().setEnabled(false);

    MapConfig mapCfg = new MapConfig();
    mapCfg.setName(MAP_NAME);
    mapCfg.setInMemoryFormat(InMemoryFormat.OBJECT);

    cfg.addMapConfig(mapCfg);

    return Hazelcast.newHazelcastInstance(cfg);
}
 
开发者ID:lburgazzoli,项目名称:lb-hazelcast,代码行数:26,代码来源:JsonExamplePlain.java


示例8: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    if (cacheKeyClass != null) {
        return new Hibernate4CacheKeySerializer();
    }
    return null;
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:8,代码来源:Hibernate4CacheKeySerializerHook.java


示例9: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    if (cacheEntryClass == null) {
        return null;
    }
    if (cacheEntryClass.isInterface()) {
        //Hibernate 4.2 and later have a CacheEntry interface, not a class
        return new Hibernate42CacheEntrySerializer();
    }
    //Hibernate 4.1 and earlier have a CacheEntry class
    return new Hibernate41CacheEntrySerializer();
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:13,代码来源:Hibernate4CacheEntrySerializerHook.java


示例10: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    if (cacheEntryClass != null) {
        return new Hibernate3CacheEntrySerializer();
    }
    return null;
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:8,代码来源:Hibernate3CacheEntrySerializerHook.java


示例11: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    if (cacheKeyClass != null) {
        return new Hibernate3CacheKeySerializer();
    }
    return null;
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:8,代码来源:Hibernate3CacheKeySerializerHook.java


示例12: makeBinary

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
public static <V> Serializer makeBinary(final Class<V> type) {
    return new JsonSerializer<>(
        type,
        HzSerializationConstants.TYPEID_JSON_BINARY,
        new SmileFactory()
    );
}
 
开发者ID:lburgazzoli,项目名称:lb-hazelcast,代码行数:8,代码来源:JsonSerializer.java


示例13: makeBinary

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
public static <V> Serializer makeBinary(final Class<V> type) {
	return new JsonSerializer<>(type, TYPEID_JSON_BINARY, new SmileFactory());
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:4,代码来源:JsonSerializer.java


示例14: makePlain

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
public static <V> Serializer makePlain(final Class<V> type) {
	return new JsonSerializer<>(type, TYPEID_JSON_PLAIN);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:4,代码来源:JsonSerializer.java


示例15: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new Hibernate52CacheEntrySerializer();
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:5,代码来源:Hibernate5CacheEntrySerializerHook.java


示例16: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new WritableStreamSerializer();
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:5,代码来源:WritableSerializerHooks.java


示例17: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Nonnull
@Override
public Serializer createSerializer() {
    return new SequencerDefinitionSerializer();
}
 
开发者ID:noctarius,项目名称:snowcast,代码行数:6,代码来源:SequencerDefinitionSerializerHook.java


示例18: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return serializer;
}
 
开发者ID:noctarius,项目名称:hazelcast-unaware-serialization,代码行数:5,代码来源:KryoSerializerHook.java


示例19: createSerializer

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new JsonEnvelopeSerializer();
}
 
开发者ID:noctarius,项目名称:hazelcast-unaware-serialization,代码行数:5,代码来源:JsonEnvelopeSerializerHook.java


示例20: make

import com.hazelcast.nio.serialization.Serializer; //导入依赖的package包/类
public static <V> Serializer make(final Class<V> type) {
    return new KryoSerializer<>(type, HzSerializationConstants.TYPEID_KRYO);
}
 
开发者ID:lburgazzoli,项目名称:lb-hazelcast,代码行数:4,代码来源:KryoSerializer.java



注:本文中的com.hazelcast.nio.serialization.Serializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IItemStack类代码示例发布时间:2022-05-22
下一篇:
Java PrefetchCompleteEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap