Bug 9060: Remove un-used Instant getObjectCreated() from CloseTracked 70/62370/4
authorMichael Vorburger <vorburger@redhat.com>
Mon, 28 Aug 2017 15:27:17 +0000 (17:27 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Wed, 30 Aug 2017 15:56:43 +0000 (15:56 +0000)
I initially thought that it would be "interesting" to be able to do some
sort of output sorted by the age of the object creating kind of UX in
the CLI I'm planning to propose next, but ultimately realized that
keeping an extra Instant fields in EACH CloseTracked (e.g. Tx) is just
overhead and not really adding much value (because the NUMBER of
non-closed objects is MUCH more interesting than this timestamp..), thus
removing this again after all.

This is one of a serious of commits which is part of a solution I'm
proposing in order to be able to detect OOM issues such as Bug 9034,
based on using the mdsal-trace DataBroker.

Change-Id: Ie40fe23ce2af670902ff8e44a6757ebdf9ef915e
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/closetracker/impl/AbstractCloseTracked.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/closetracker/impl/CloseTracked.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/closetracker/impl/CloseTrackedTrait.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingReadWriteTransaction.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingWriteTransaction.java

index 59dbf57..aaafeb4 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
-import java.time.Instant;
 import javax.annotation.Nullable;
 
 /**
 import javax.annotation.Nullable;
 
 /**
@@ -27,11 +26,6 @@ public abstract class AbstractCloseTracked<T extends AbstractCloseTracked<T>> im
         closeTracker.removeFromTrackedRegistry();
     }
 
         closeTracker.removeFromTrackedRegistry();
     }
 
-    @Override
-    public final Instant getObjectCreated() {
-        return closeTracker.getObjectCreated();
-    }
-
     @Override
     public @Nullable StackTraceElement[] getAllocationContextStackTrace() {
         return closeTracker.getAllocationContextStackTrace();
     @Override
     public @Nullable StackTraceElement[] getAllocationContextStackTrace() {
         return closeTracker.getAllocationContextStackTrace();
index 1febe15..f5fd341 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
-import java.time.Instant;
 import javax.annotation.Nullable;
 
 /**
 import javax.annotation.Nullable;
 
 /**
@@ -19,8 +18,6 @@ import javax.annotation.Nullable;
  */
 public interface CloseTracked<T extends CloseTracked<T>> {
 
  */
 public interface CloseTracked<T extends CloseTracked<T>> {
 
-    Instant getObjectCreated();
-
     @Nullable StackTraceElement[] getAllocationContextStackTrace();
 
 }
     @Nullable StackTraceElement[] getAllocationContextStackTrace();
 
 }
index f76eeb1..b846c04 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
-import java.time.Instant;
 import java.util.Objects;
 import javax.annotation.Nullable;
 
 import java.util.Objects;
 import javax.annotation.Nullable;
 
@@ -23,12 +22,10 @@ import javax.annotation.Nullable;
  */
 public class CloseTrackedTrait<T extends CloseTracked<T>> implements CloseTracked<T> {
 
  */
 public class CloseTrackedTrait<T extends CloseTracked<T>> implements CloseTracked<T> {
 
-    private final Instant created;
     private final @Nullable Throwable allocationContext;
     private final CloseTrackedRegistry<T> closeTrackedRegistry;
 
     public CloseTrackedTrait(CloseTrackedRegistry<T> transactionChainRegistry) {
     private final @Nullable Throwable allocationContext;
     private final CloseTrackedRegistry<T> closeTrackedRegistry;
 
     public CloseTrackedTrait(CloseTrackedRegistry<T> transactionChainRegistry) {
-        this.created = Instant.now();
         if (transactionChainRegistry.isDebugContextEnabled()) {
             this.allocationContext = new Throwable("allocated at");
         } else {
         if (transactionChainRegistry.isDebugContextEnabled()) {
             this.allocationContext = new Throwable("allocated at");
         } else {
@@ -38,11 +35,6 @@ public class CloseTrackedTrait<T extends CloseTracked<T>> implements CloseTracke
         this.closeTrackedRegistry.add(this);
     }
 
         this.closeTrackedRegistry.add(this);
     }
 
-    @Override
-    public Instant getObjectCreated() {
-        return created;
-    }
-
     @Override
     public StackTraceElement[] getAllocationContextStackTrace() {
         return allocationContext != null ? allocationContext.getStackTrace() : null;
     @Override
     public StackTraceElement[] getAllocationContextStackTrace() {
         return allocationContext != null ? allocationContext.getStackTrace() : null;
index 52f1dab..fe57c81 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.md.sal.trace.dom.impl;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
-import java.time.Instant;
 import java.util.Objects;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import java.util.Objects;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -67,11 +66,6 @@ class TracingReadWriteTransaction
         return super.cancel();
     }
 
         return super.cancel();
     }
 
-    @Override
-    public Instant getObjectCreated() {
-        return closeTracker.getObjectCreated();
-    }
-
     @Override
     public StackTraceElement[] getAllocationContextStackTrace() {
         return closeTracker.getAllocationContextStackTrace();
     @Override
     public StackTraceElement[] getAllocationContextStackTrace() {
         return closeTracker.getAllocationContextStackTrace();
index 719944a..7e98e40 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.md.sal.trace.dom.impl;
 
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
 
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
-import java.time.Instant;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
@@ -47,11 +46,6 @@ class TracingWriteTransaction extends AbstractTracingWriteTransaction
         return super.cancel();
     }
 
         return super.cancel();
     }
 
-    @Override
-    public Instant getObjectCreated() {
-        return closeTracker.getObjectCreated();
-    }
-
     @Override
     public StackTraceElement[] getAllocationContextStackTrace() {
         return closeTracker.getAllocationContextStackTrace();
     @Override
     public StackTraceElement[] getAllocationContextStackTrace() {
         return closeTracker.getAllocationContextStackTrace();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.