Uploaded image for project: 'Red Hat Data Grid'
  1. Red Hat Data Grid
  2. JDG-403

Example code for HotRod Protobuf SerializationContext creation is incorrect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • JDG 7.0.0 ER6
    • JDG 7.0.0 DR1
    • Documentation
    • None

      Page 206 of the JDG 7 UserGuide, example 18.4, contains this code-snippet:

      import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; import org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller; import org.infinispan.protostream.SerializationContext;
      ...
      ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); clientBuilder.addServer().host("127.0.0.1").port(11234) .marshaller(new ProtoStreamMarshaller());
      RemoteCacheManager remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
      SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(remoteCacheManager);
      serCtx.registerProtoFile("/library.proto");
      serCtx.registerMarshaller(new BookMarshaller());
      serCtx.registerMarshaller(new AuthorMarshaller());
      // Book and Author classes omitted for brevity
      

      That code-snippet is incorrect, as the SerializationContext class does not contain a method "registerProtoFile" that accepts a String. The correct method is "serCtx.registerProtoFiles" which accepts a FileDescriptorSource instance.

            rhn-support-chuffman Christian Huffman
            rhn-gps-ddoyle Duncan Doyle (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: