Bump upstreams for Silicon
[openflowplugin.git] / applications / forwardingrules-sync / src / main / java / org / opendaylight / openflowplugin / applications / frsync / impl / SyncReactorFutureDecorator.java
index c279e9f9cb5e6c830cde696a65ea8a8ed7cb5a35..bb418b2b447a57d7d7b8b12f0240d07aafa5d64a 100644 (file)
@@ -1,11 +1,10 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.applications.frsync.impl;
 
 import com.google.common.util.concurrent.ListenableFuture;
@@ -27,55 +26,29 @@ import org.slf4j.LoggerFactory;
 public class SyncReactorFutureDecorator implements SyncReactor {
 
     private static final Logger LOG = LoggerFactory.getLogger(SyncReactorFutureDecorator.class);
-    public static final String FRM_RPC_CLIENT_PREFIX = "FRM-RPC-client-";
     private final SyncReactor delegate;
     private final ListeningExecutorService executorService;
 
-    public SyncReactorFutureDecorator(SyncReactor delegate, ListeningExecutorService executorService) {
+    public SyncReactorFutureDecorator(final SyncReactor delegate, final ListeningExecutorService executorService) {
         this.delegate = delegate;
         this.executorService = executorService;
     }
 
     public ListenableFuture<Boolean> syncup(final InstanceIdentifier<FlowCapableNode> flowcapableNodePath,
-                                            final SyncupEntry syncupEntry) throws InterruptedException {
+                                            final SyncupEntry syncupEntry) {
         final NodeId nodeId = PathUtil.digNodeId(flowcapableNodePath);
         return executorService.submit(() -> {
-            final String oldThreadName = updateThreadName(nodeId);
             try {
-                final Boolean ret = doSyncupInFuture(flowcapableNodePath, syncupEntry).get(10000, TimeUnit.MILLISECONDS);
-                return ret;
+                return doSyncupInFuture(flowcapableNodePath, syncupEntry).get(10000, TimeUnit.MILLISECONDS);
             } catch (TimeoutException e) {
-                LOG.warn("doSyncupInFuture timeout occured {}", nodeId.getValue(), e);
-                return false;
-            } finally {
-                updateThreadName(oldThreadName);
+                LOG.warn("Syncup future timeout occured {}", nodeId.getValue());
+                return Boolean.FALSE;
             }
         });
     }
 
     protected ListenableFuture<Boolean> doSyncupInFuture(final InstanceIdentifier<FlowCapableNode> flowcapableNodePath,
-                                                         final SyncupEntry syncupEntry) throws InterruptedException {
+                                                         final SyncupEntry syncupEntry) {
         return delegate.syncup(flowcapableNodePath, syncupEntry);
     }
-
-    private String updateThreadName(final NodeId nodeId) {
-        final Thread currentThread = Thread.currentThread();
-        final String oldName = currentThread.getName();
-        if (oldName.startsWith(SyncReactorFutureDecorator.FRM_RPC_CLIENT_PREFIX)) {
-            currentThread.setName(oldName + "@" + nodeId.getValue());
-        } else {
-            LOG.warn("Try to update foreign thread name {} {}", nodeId, oldName);
-        }
-        return oldName;
-    }
-
-    private void updateThreadName(final String name) {
-        final Thread currentThread = Thread.currentThread();
-        final String oldName = currentThread.getName();
-        if (oldName.startsWith(SyncReactorFutureDecorator.FRM_RPC_CLIENT_PREFIX)) {
-            currentThread.setName(name);
-        } else {
-            LOG.warn("Try to update foreign thread name {} {}", oldName, name);
-        }
-    }
 }