Package org.apache.avro.io

Examples of org.apache.avro.io.ResolvingDecoder


   *  resolvers too often, because that is very expensive.
   */
  protected final ResolvingDecoder getResolver(Schema actual, Schema expected)
    throws IOException {
    Thread currThread = Thread.currentThread();
    ResolvingDecoder resolver;
    if (currThread == creator && creatorResolver != null) {
      return creatorResolver;
    }

    Map<Schema,ResolvingDecoder> cache = RESOLVER_CACHE.get().get(actual);
View Full Code Here


  }

  @Override
  @SuppressWarnings("unchecked")
  public D read(D reuse, Decoder in) throws IOException {
    ResolvingDecoder resolver = getResolver(actual, expected);
    resolver.configure(in);
    D result = (D) read(reuse, expected, resolver);
    resolver.drain();
    return result;
  }
View Full Code Here

   *  resolvers too often, because that is very expensive.
   */
  protected final ResolvingDecoder getResolver(Schema actual, Schema expected)
    throws IOException {
    Thread currThread = Thread.currentThread();
    ResolvingDecoder resolver;
    if (currThread == creator && creatorResolver != null) {
      return creatorResolver;
    }

    Map<Schema,ResolvingDecoder> cache = RESOLVER_CACHE.get().get(actual);
View Full Code Here

  }

  @Override
  @SuppressWarnings("unchecked")
  public D read(D reuse, Decoder in) throws IOException {
    ResolvingDecoder resolver = getResolver(actual, expected);
    resolver.configure(in);
    D result = (D) read(reuse, expected, resolver);
    resolver.drain();
    return result;
  }
View Full Code Here

   *  resolvers too often, because that is very expensive.
   */
  protected final ResolvingDecoder getResolver(Schema actual, Schema expected)
    throws IOException {
    Thread currThread = Thread.currentThread();
    ResolvingDecoder resolver;
    if (currThread == creator && creatorResolver != null) {
      return creatorResolver;
    }

    Map<Schema,ResolvingDecoder> cache = RESOLVER_CACHE.get().get(actual);
View Full Code Here

  }

  @Override
  @SuppressWarnings("unchecked")
  public D read(D reuse, Decoder in) throws IOException {
    ResolvingDecoder resolver = getResolver(actual, expected);
    resolver.configure(in);
    D result = (D) read(reuse, expected, resolver);
    resolver.drain();
    return result;
  }
View Full Code Here

    return super.read(reuse, schema, getResolvingDecoder(decoder));
  }

  protected ResolvingDecoder getResolvingDecoder(Decoder decoder)
  throws IOException {
    ResolvingDecoder resolvingDecoder = decoderCache.get(decoder);
    if(resolvingDecoder == null) {
      resolvingDecoder = new FakeResolvingDecoder(rootSchema, decoder);
      decoderCache.put(decoder, resolvingDecoder);
    }
    return resolvingDecoder;
View Full Code Here

  @SuppressWarnings("unchecked")
  public D read(D reuse, Decoder in) throws IOException {
    if (resolver == null) {
      resolver = ResolvingDecoder.resolve(actual, expected);
    }
    return (D) read(reuse, expected, new ResolvingDecoder(resolver, in));
  }
View Full Code Here

    return resolver;
  }

  @SuppressWarnings("unchecked")
  public D read(D reuse, Decoder in) throws IOException {
    ResolvingDecoder resolver = getResolver(actual, expected);
    resolver.init(in);
    D result = (D) read(reuse, expected, resolver);
    resolver.drain();
    return result;
  }
View Full Code Here

    }
  };

  private ResolvingDecoder getResolver(Schema actual, Schema expected)
    throws IOException {
    ResolvingDecoder resolver = threadResolver.get();
    if (resolver != null)
      return resolver;

    Map<Schema,ResolvingDecoder> cache = RESOLVER_CACHE.get().get(actual);
    if (cache == null) {
      cache = new WeakIdentityHashMap<Schema,ResolvingDecoder>();
      RESOLVER_CACHE.get().put(actual, cache);
    }
    resolver = cache.get(expected);
    if (resolver == null) {
      resolver = new ResolvingDecoder(Schema.applyAliases(actual, expected),
                                      expected, null);
      cache.put(expected, resolver);
    }
    threadResolver.set(resolver);
    return resolver;
View Full Code Here

TOP

Related Classes of org.apache.avro.io.ResolvingDecoder

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.