Package org.infinispan.protostream

Examples of org.infinispan.protostream.SerializationContext


*/
public class ProtobufParsingTest extends AbstractParsingTest {

   @Override
   protected FilterProcessingChain<Descriptor> createFilterProcessingChain() throws IOException, Descriptors.DescriptorValidationException {
      SerializationContext serCtx = ProtobufUtil.newSerializationContext(new ConfigurationBuilder().build());
      MarshallerRegistration.registerMarshallers(serCtx);
      return FilterProcessingChain.build(new ProtobufPropertyHelper(serCtx), null);
   }
View Full Code Here


* @since 1.0
*/
public abstract class AbstractProtoStreamTest {

   protected SerializationContext createContext() throws IOException, DescriptorParserException {
      SerializationContext ctx = ProtobufUtil.newSerializationContext();
      MarshallerRegistration.registerMarshallers(ctx);
      return ctx;
   }
View Full Code Here

      MarshallerRegistration.registerMarshallers(ctx);
      return ctx;
   }

   protected SerializationContext createContext(Configuration cfg) throws IOException, DescriptorParserException {
      SerializationContext ctx = ProtobufUtil.newSerializationContext(cfg);
      MarshallerRegistration.registerMarshallers(ctx);
      return ctx;
   }
View Full Code Here

      return user;
   }

   private void readWithProtoStream(byte[] bytes, long[] result) throws IOException, DescriptorParserException {
      Configuration cfg = new ConfigurationBuilder().setLogOutOfSequenceReads(false).build();
      SerializationContext ctx = createContext(cfg);
      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);

      long tStart = System.nanoTime();
      for (int i = 0; i < NUM_INNER_LOOPS; i++) {
         ProtobufUtil.readFrom(ctx, bais, User.class);
View Full Code Here

      log.infof("Java serialization read duration    = %d ns", result[0]);
   }

   private byte[] writeWithProtoStream(User user, long[] result) throws IOException, DescriptorParserException {
      Configuration cfg = new ConfigurationBuilder().setLogOutOfSequenceWrites(false).build();
      SerializationContext ctx = createContext(cfg);
      ByteArrayOutputStream out = new ByteArrayOutputStream(1024);

      long tStart = System.nanoTime();
      for (int i = 0; i < NUM_INNER_LOOPS; i++) {
         ProtobufUtil.writeTo(ctx, out, user);
View Full Code Here

public class LifecycleManager extends AbstractModuleLifecycle {

   private static final Log log = LogFactory.getLog(LifecycleManager.class, Log.class);

   private void initProtobufMetadataManager(DefaultCacheManager cacheManager, GlobalComponentRegistry gcr) {
      SerializationContext serCtx = ProtobufUtil.newSerializationContext();
      try {
         MarshallerRegistration.registerMarshallers(serCtx);
      } catch (IOException  | DescriptorParserException e) {
         throw new CacheException("Failed to initialise serialization context", e);
      }
View Full Code Here

    * Registers the remote value wrapper interceptor in the cache before it gets started.
    */
   @Override
   public void cacheStarting(ComponentRegistry cr, Configuration cfg, String cacheName) {
      EmbeddedCacheManager cacheManager = cr.getGlobalComponentRegistry().getComponent(EmbeddedCacheManager.class);
      SerializationContext serializationContext = ProtobufMetadataManager.getSerializationContext(cacheManager);
      cr.registerComponent(new ProtobufMatcher(serializationContext), ProtobufMatcher.class);

      if (cfg.indexing().index().isEnabled() && !cfg.compatibility().enabled()) {
         log.infof("Registering RemoteValueWrapperInterceptor for cache %s", cacheName);
         createRemoteIndexingInterceptor(cr, cfg);
View Full Code Here

   public static final String NULL_TOKEN = "_null_";

   @Override
   public byte[] query(AdvancedCache<byte[], byte[]> cache, byte[] query) {
      try {
         SerializationContext serCtx = ProtobufMetadataManager.getSerializationContext(cache.getCacheManager());
         QueryRequest request = ProtobufUtil.fromByteArray(serCtx, query, 0, query.length, QueryRequest.class);

         QueryResponse response;
         if (cache.getCacheConfiguration().indexing().index().isEnabled()) {
            response = executeQuery(cache, serCtx, request);
View Full Code Here

            }
            results.add(row);
         }
      } else {
         results = new ArrayList<Object>(response.getResults().size());
         SerializationContext serCtx = getSerializationContext();
         for (WrappedMessage r : response.getResults()) {
            try {
               byte[] bytes = (byte[]) r.getValue();
               Object o = ProtobufUtil.fromWrappedByteArray(serCtx, bytes);
               results.add(o);
View Full Code Here

public class LifecycleManager extends AbstractModuleLifecycle {

   private static final Log log = LogFactory.getLog(LifecycleManager.class, Log.class);

   private void initProtobufMetadataManager(DefaultCacheManager cacheManager, GlobalComponentRegistry gcr) {
      SerializationContext serCtx = ProtobufUtil.newSerializationContext();
      try {
         MarshallerRegistration.registerMarshallers(serCtx);
      } catch (IOException e) {
         throw new CacheException("Failed to initialise serialization context", e);
      } catch (Descriptors.DescriptorValidationException e) {
View Full Code Here

TOP

Related Classes of org.infinispan.protostream.SerializationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.