You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/12/09 19:15:38 UTC

[1/3] accumulo git commit: ACCUMULO-3395 Keep a reference to a single Logger instance.

Repository: accumulo
Updated Branches:
  refs/heads/1.6 6170c02ee -> 98c524e34
  refs/heads/master de1d3ee38 -> 04774b171


ACCUMULO-3395 Keep a reference to a single Logger instance.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/98c524e3
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/98c524e3
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/98c524e3

Branch: refs/heads/1.6
Commit: 98c524e3425678286872952ce376a4aa774079a5
Parents: 6170c02
Author: Josh Elser <el...@apache.org>
Authored: Tue Dec 9 13:11:03 2014 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Tue Dec 9 13:11:03 2014 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/server/util/RpcWrapper.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/98c524e3/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java b/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java
index 02bd1ef..7055053 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java
@@ -24,6 +24,7 @@ import org.apache.accumulo.trace.instrument.thrift.RpcServerInvocationHandler;
 import org.apache.accumulo.trace.instrument.thrift.TraceWrap;
 import org.apache.thrift.TApplicationException;
 import org.apache.thrift.TException;
+import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
@@ -38,17 +39,18 @@ public class RpcWrapper {
 
   public static <T> T service(final T instance) {
     InvocationHandler handler = new RpcServerInvocationHandler<T>(instance) {
+      private final Logger log = LoggerFactory.getLogger(instance.getClass());
       @Override
       public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
         try {
           return super.invoke(obj, method, args);
         } catch (RuntimeException e) {
           String msg = e.getMessage();
-          LoggerFactory.getLogger(instance.getClass()).error(msg, e);
+          log.error(msg, e);
           throw new TException(msg);
         } catch (Error e) {
           String msg = e.getMessage();
-          LoggerFactory.getLogger(instance.getClass()).error(msg, e);
+          log.error(msg, e);
           throw new TException(msg);
         }
       }


[2/3] accumulo git commit: ACCUMULO-3395 Keep a reference to a single Logger instance.

Posted by el...@apache.org.
ACCUMULO-3395 Keep a reference to a single Logger instance.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/98c524e3
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/98c524e3
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/98c524e3

Branch: refs/heads/master
Commit: 98c524e3425678286872952ce376a4aa774079a5
Parents: 6170c02
Author: Josh Elser <el...@apache.org>
Authored: Tue Dec 9 13:11:03 2014 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Tue Dec 9 13:11:03 2014 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/server/util/RpcWrapper.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/98c524e3/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java b/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java
index 02bd1ef..7055053 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/RpcWrapper.java
@@ -24,6 +24,7 @@ import org.apache.accumulo.trace.instrument.thrift.RpcServerInvocationHandler;
 import org.apache.accumulo.trace.instrument.thrift.TraceWrap;
 import org.apache.thrift.TApplicationException;
 import org.apache.thrift.TException;
+import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
@@ -38,17 +39,18 @@ public class RpcWrapper {
 
   public static <T> T service(final T instance) {
     InvocationHandler handler = new RpcServerInvocationHandler<T>(instance) {
+      private final Logger log = LoggerFactory.getLogger(instance.getClass());
       @Override
       public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
         try {
           return super.invoke(obj, method, args);
         } catch (RuntimeException e) {
           String msg = e.getMessage();
-          LoggerFactory.getLogger(instance.getClass()).error(msg, e);
+          log.error(msg, e);
           throw new TException(msg);
         } catch (Error e) {
           String msg = e.getMessage();
-          LoggerFactory.getLogger(instance.getClass()).error(msg, e);
+          log.error(msg, e);
           throw new TException(msg);
         }
       }


[3/3] accumulo git commit: Merge branch '1.6'

Posted by el...@apache.org.
Merge branch '1.6'


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/04774b17
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/04774b17
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/04774b17

Branch: refs/heads/master
Commit: 04774b1714c5fb9f0a160262045767d4d2a1eefe
Parents: de1d3ee 98c524e
Author: Josh Elser <el...@apache.org>
Authored: Tue Dec 9 13:11:31 2014 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Tue Dec 9 13:11:31 2014 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/server/rpc/RpcWrapper.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/04774b17/server/base/src/main/java/org/apache/accumulo/server/rpc/RpcWrapper.java
----------------------------------------------------------------------
diff --cc server/base/src/main/java/org/apache/accumulo/server/rpc/RpcWrapper.java
index 7b34986,0000000..a488da9
mode 100644,000000..100644
--- a/server/base/src/main/java/org/apache/accumulo/server/rpc/RpcWrapper.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/rpc/RpcWrapper.java
@@@ -1,62 -1,0 +1,64 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.accumulo.server.rpc;
 +
 +import java.lang.reflect.InvocationHandler;
 +import java.lang.reflect.Method;
 +import java.lang.reflect.Proxy;
 +
 +import org.apache.accumulo.core.trace.wrappers.RpcServerInvocationHandler;
 +import org.apache.accumulo.core.trace.wrappers.TraceWrap;
 +import org.apache.thrift.TApplicationException;
 +import org.apache.thrift.TException;
++import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +/**
 + * This class accommodates the changes in THRIFT-1805, which appeared in Thrift 0.9.1 and restricts client-side notification of server-side errors to
 + * {@link TException} only, by wrapping {@link RuntimeException} and {@link Error} as {@link TException}, so it doesn't just close the connection and look like
 + * a network issue, but informs the client that a {@link TApplicationException} had occurred, as it did in Thrift 0.9.0. This performs similar functions as
 + * {@link TraceWrap}, but with the additional action of translating exceptions. See also ACCUMULO-1691 and ACCUMULO-2950.
 + *
 + * @since 1.6.1
 + */
 +public class RpcWrapper {
 +
 +  public static <T> T service(final T instance) {
 +    InvocationHandler handler = new RpcServerInvocationHandler<T>(instance) {
++      private final Logger log = LoggerFactory.getLogger(instance.getClass());
 +      @Override
 +      public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
 +        try {
 +          return super.invoke(obj, method, args);
 +        } catch (RuntimeException e) {
 +          String msg = e.getMessage();
-           LoggerFactory.getLogger(instance.getClass()).error(msg, e);
++          log.error(msg, e);
 +          throw new TException(msg);
 +        } catch (Error e) {
 +          String msg = e.getMessage();
-           LoggerFactory.getLogger(instance.getClass()).error(msg, e);
++          log.error(msg, e);
 +          throw new TException(msg);
 +        }
 +      }
 +    };
 +
 +    @SuppressWarnings("unchecked")
 +    T proxiedInstance = (T) Proxy.newProxyInstance(instance.getClass().getClassLoader(), instance.getClass().getInterfaces(), handler);
 +    return proxiedInstance;
 +  }
 +
 +}