Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.infinispan.query.remote.indexing;
 import  org.apache.lucene.document.Document;
 import  org.infinispan.commons.CacheException;
 import  org.infinispan.protostream.ProtobufParser;
import  org.infinispan.protostream.SerializationContext;
import  org.infinispan.protostream.WrappedMessage;

public final class ProtobufValueWrapperFieldBridge implements FieldBridge {
   private final Cache cache;

This is lazily initialised in decodeAndIndex method. This does not need to be volatile nor do we need to synchronize before accessing it. It may happen to initialize it multiple times but that is not harmful.
   private SerializationContext serializationContext = null;

Lazily initialized in decodeAndIndex method, similarly to serializationContext field.
   private Descriptors.Descriptor wrapperDescriptor = null;
   public ProtobufValueWrapperFieldBridge(Cache cache) {
      this. = cache;
   public void set(String nameObject value, Document document, LuceneOptions luceneOptions) {
      if (!(value instanceof ProtobufValueWrapper)) {
         throw new IllegalArgumentException("This FieldBridge can only be applied to a ProtobufValueWrapper");
      ProtobufValueWrapper valueWrapper = (ProtobufValueWrappervalue;
      decodeAndIndex(valueWrapper.getBinary(), documentluceneOptions);
   private void decodeAndIndex(byte[] bytes, Document document, LuceneOptions luceneOptions) {
      if ( == null) {
          = ProtobufMetadataManager.getSerializationContext(.getCacheManager());
      if (wrapperDescriptor == null) {
         wrapperDescriptor = .getMessageDescriptor(WrappedMessage.PROTOBUF_TYPE_NAME);
      try {
         new ProtobufParser().parse(new WrappedMessageTagHandler(documentluceneOptions), wrapperDescriptor, bytes);
      } catch (IOException e) {
         throw new CacheException(e);
New to GrepCode? Check out our FAQ X