Grokbase Groups Avro commits May 2013
FAQ
Author: scottcarey
Date: Thu May 2 01:01:47 2013
New Revision: 1478244

URL: http://svn.apache.org/r1478244
Log:
AVRO-1313. Java: Add system property avro.disable.unsafe for disabling
     use of sun.misc.Unsafe.

Modified:
     avro/trunk/CHANGES.txt
     avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java
     avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1478244&r1=1478243&r2=1478244&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Thu May 2 01:01:47 2013
@@ -42,6 +42,9 @@ Trunk (not yet released)
      AVRO-1282. Java: Use sun.misc.Unsafe to improve Reflect API Performance.
      (Leo Romanoff via scottcarey)

+ AVRO-1313. Java: Add system property avro.disable.unsafe for disabling
+ use of sun.misc.Unsafe. (scottcarey)
+
    BUG FIXES

      AVRO-1296. Python: Fix schemas retrieved from protocol types

Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java?rev=1478244&r1=1478243&r2=1478244&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java (original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java Thu May 2 01:01:47 2013
@@ -32,6 +32,7 @@ class FieldAccessReflect extends FieldAc

      public ReflectionBasedAccessor(Field field) {
        this.field = field;
+ this.field.setAccessible(true);
      }

      @Override

Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java?rev=1478244&r1=1478243&r2=1478244&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java (original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java Thu May 2 01:01:47 2013
@@ -39,10 +39,12 @@ class ReflectionUtil {
      // so it is monomorphic and the JIT can inline
      FieldAccess access = null;
      try {
- FieldAccess unsafeAccess = load(
- "org.apache.avro.reflect.FieldAccessUnsafe", FieldAccess.class);
- if (validate(unsafeAccess)) {
- access = unsafeAccess;
+ if (null == System.getProperty("avro.disable.unsafe")) {
+ FieldAccess unsafeAccess = load(
+ "org.apache.avro.reflect.FieldAccessUnsafe", FieldAccess.class);
+ if (validate(unsafeAccess)) {
+ access = unsafeAccess;
+ }
        }
      } catch (Throwable ignored) {
      }
@@ -75,9 +77,9 @@ class ReflectionUtil {
    }

    private static final class AccessorTestClass {
- boolean b = true;
- byte by = 0xf;
- char c = 'c';
+ private boolean b = true;
+ protected byte by = 0xf;
+ public char c = 'c';
      short s = 123;
      int i = 999;
      long l = 12345L;

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupcommits @
categoriesavro
postedMay 2, '13 at 1:02a
activeMay 2, '13 at 1:02a
posts1
users1
websiteavro.apache.org
irc#avro

1 user in discussion

Scottcarey: 1 post

People

Translate

site design / logo © 2021 Grokbase