changeset 2543:4254f69340ee

Remove unused thread-contention-sample category. Reviewed-by: neugens Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-December/021815.html
author Jie Kang <jkang@redhat.com>
date Wed, 07 Dec 2016 10:55:51 -0500
parents 80c3708bd5e4
children 4933c471f51e
files thread/collector/src/main/java/com/redhat/thermostat/thread/dao/ThreadDao.java thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDAOCategoryRegistration.java thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImpl.java thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplStatementDescriptorRegistration.java thread/collector/src/main/java/com/redhat/thermostat/thread/model/ThreadContentionSample.java thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDAOCategoryRegistrationTest.java thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplStatementDescriptorRegistrationTest.java thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplTest.java thread/collector/src/test/java/com/redhat/thermostat/thread/model/ThreadModelPojosTest.java
diffstat 9 files changed, 2 insertions(+), 180 deletions(-) [+]
line wrap: on
line diff
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/ThreadDao.java	Thu Nov 17 15:48:11 2016 -0500
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/ThreadDao.java	Wed Dec 07 10:55:51 2016 -0500
@@ -44,9 +44,7 @@
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.core.VmRef;
 import com.redhat.thermostat.storage.core.experimental.statement.ResultHandler;
-import com.redhat.thermostat.thread.dao.internal.ThreadDaoKeys;
 import com.redhat.thermostat.thread.model.SessionID;
-import com.redhat.thermostat.thread.model.ThreadContentionSample;
 import com.redhat.thermostat.thread.model.ThreadHarvestingStatus;
 import com.redhat.thermostat.thread.model.ThreadSession;
 import com.redhat.thermostat.thread.model.ThreadState;
@@ -82,23 +80,6 @@
             DEADLOCK_DESCRIPTION_KEY);
 
 
-    /*
-     * THREAD_CONTENTION_SAMPLE
-     */
-    static final Key<String> THREAD_CONTENTION_BLOCKED_COUNT_KEY = new Key<>("blockedCount");
-    static final Key<String> THREAD_CONTENTION_BLOCKED_TIME_KEY = new Key<>("blockedTime");
-    static final Key<String> THREAD_CONTENTION_WAITED_COUNT_KEY = new Key<>("waitedCount");
-    static final Key<String> THREAD_CONTENTION_WAITED_TIME_KEY = new Key<>("waitedTime");
-    static final Category<ThreadContentionSample> THREAD_CONTENTION_SAMPLE =
-            new Category<>("thread-contention-sample", ThreadContentionSample.class,
-                           Arrays.<Key<?>>asList(Key.AGENT_ID, Key.VM_ID,
-                                                 THREAD_CONTENTION_BLOCKED_COUNT_KEY,
-                                                 THREAD_CONTENTION_BLOCKED_TIME_KEY,
-                                                 THREAD_CONTENTION_WAITED_COUNT_KEY,
-                                                 THREAD_CONTENTION_WAITED_TIME_KEY,
-                                                 ThreadDaoKeys.THREAD_HEADER_UUID, Key.TIMESTAMP),
-                           Arrays.<Key<?>>asList(ThreadDaoKeys.THREAD_HEADER_UUID, Key.TIMESTAMP));
-
     void saveSummary(ThreadSummary summary);
     List<ThreadSummary> getSummary(VmRef ref, Range<Long> range, int limit);
 
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDAOCategoryRegistration.java	Thu Nov 17 15:48:11 2016 -0500
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDAOCategoryRegistration.java	Wed Dec 07 10:55:51 2016 -0500
@@ -56,7 +56,6 @@
 
         categories.add(ThreadDao.DEADLOCK_INFO.getName());
         categories.add(ThreadDao.THREAD_HARVESTING_STATUS.getName());
-        categories.add(ThreadDao.THREAD_CONTENTION_SAMPLE.getName());
 
         ThreadDaoCategories.register(categories);
 
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImpl.java	Thu Nov 17 15:48:11 2016 -0500
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImpl.java	Wed Dec 07 10:55:51 2016 -0500
@@ -111,22 +111,6 @@
                  "'" + DEADLOCK_DESCRIPTION_KEY.getName() + "' = ?s";
 
 
-    static final String ADD_CONTENTION_SAMPLE =
-            "ADD "  + THREAD_CONTENTION_SAMPLE.getName() + " "               +
-                    "SET '" + Key.AGENT_ID.getName() + "' = ?s , "       +
-                    "'" + Key.VM_ID.getName() + "' = ?s , "          +
-                    "'" + THREAD_CONTENTION_BLOCKED_COUNT_KEY.getName() + "' = ?l , " +
-                    "'" + THREAD_CONTENTION_BLOCKED_TIME_KEY.getName() + "' = ?l , "  +
-                    "'" + THREAD_CONTENTION_WAITED_COUNT_KEY.getName() + "' = ?l , "  +
-                    "'" + THREAD_CONTENTION_WAITED_TIME_KEY.getName() + "' = ?l , "  +
-                    "'" + ThreadDaoKeys.THREAD_HEADER_UUID.getName() + "' = ?s , " +
-                    "'" + Key.TIMESTAMP.getName() + "' = ?l";
-
-    static final String GET_LATEST_CONTENTION_SAMPLE= "QUERY "
-            + THREAD_CONTENTION_SAMPLE.getName() + " WHERE '"
-            + ThreadDaoKeys.THREAD_HEADER_UUID.getName() + "' = ?s SORT '"
-            + Key.TIMESTAMP.getName() + "' DSC LIMIT 1";
-
     private final Category<AggregateCount> aggregateCategory;
     private Storage storage;
     
@@ -136,7 +120,6 @@
         ThreadDaoCategories.register(storage);
 
         storage.registerCategory(THREAD_HARVESTING_STATUS);
-        storage.registerCategory(THREAD_CONTENTION_SAMPLE);
 
         storage.registerCategory(DEADLOCK_INFO);
 
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplStatementDescriptorRegistration.java	Thu Nov 17 15:48:11 2016 -0500
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplStatementDescriptorRegistration.java	Wed Dec 07 10:55:51 2016 -0500
@@ -64,8 +64,6 @@
 
         descs.add(ThreadDaoImpl.DESC_ADD_THREAD_DEADLOCK_DATA);
         descs.add(ThreadDaoImpl.DESC_ADD_THREAD_HARVESTING_STATUS);
-        descs.add(ThreadDaoImpl.ADD_CONTENTION_SAMPLE);
-        descs.add(ThreadDaoImpl.GET_LATEST_CONTENTION_SAMPLE);
     }
     
     @Override
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/model/ThreadContentionSample.java	Thu Nov 17 15:48:11 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright 2012-2016 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.thread.model;
-
-import com.redhat.thermostat.storage.core.Entity;
-import com.redhat.thermostat.storage.core.Persist;
-import com.redhat.thermostat.storage.model.BasePojo;
-import com.redhat.thermostat.storage.model.TimeStampedPojo;
-
-/**
- */
-@Entity
-public class ThreadContentionSample extends BasePojo implements TimeStampedPojo {
-
-    private long blockedCount;
-    private long waitedCount;
-
-    private long blockedTime;
-    private long waitedTime;
-
-    // probe time
-    private long timestamp;
-
-    public ThreadContentionSample() {
-        this(null);
-    }
-
-    public ThreadContentionSample(String wID) {
-        super(wID);
-    }
-
-    @Override
-    @Persist
-    public long getTimeStamp() {
-        return timestamp;
-    }
-
-    @Persist
-    public void setTimeStamp(long timestamp) {
-        this.timestamp = timestamp;
-    }
-
-    @Persist
-    public long getBlockedCount() {
-        return blockedCount;
-    }
-
-    @Persist
-    public void setBlockedCount(long blockedCount) {
-        this.blockedCount = blockedCount;
-    }
-
-    @Persist
-    public void setWaitedCount(long waitedCount) {
-        this.waitedCount = waitedCount;
-    }
-
-    @Persist
-    public long getWaitedCount() {
-        return waitedCount;
-    }
-
-    @Persist
-    public void setBlockedTime(long blockedTime) {
-        this.blockedTime = blockedTime;
-    }
-
-    @Persist
-    public long getBlockedTime() {
-        return blockedTime;
-    }
-
-    @Persist
-    public void setWaitedTime(long waitedTime) {
-        this.waitedTime = waitedTime;
-    }
-
-    @Persist
-    public long getWaitedTime() {
-        return waitedTime;
-    }
-}
--- a/thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDAOCategoryRegistrationTest.java	Thu Nov 17 15:48:11 2016 -0500
+++ b/thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDAOCategoryRegistrationTest.java	Wed Dec 07 10:55:51 2016 -0500
@@ -51,7 +51,7 @@
 
 public class ThreadDAOCategoryRegistrationTest extends ServiceLoaderTest<CategoryRegistration> {
 
-    private static final int EXPECTED_CATEGORIES = 6;
+    private static final int EXPECTED_CATEGORIES = 5;
 
     public ThreadDAOCategoryRegistrationTest() {
         super(CategoryRegistration.class, STORAGE_SERVICES + 1 /* from lock dao */,
@@ -68,7 +68,6 @@
 
         assertTrue(categories.contains(ThreadDao.DEADLOCK_INFO.getName()));
         assertTrue(categories.contains(ThreadDao.THREAD_HARVESTING_STATUS.getName()));
-        assertTrue(categories.contains(ThreadDao.THREAD_CONTENTION_SAMPLE.getName()));
 
         Set<String> sourceCategories = new HashSet<>();
         ThreadDaoCategories.register(sourceCategories);
--- a/thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplStatementDescriptorRegistrationTest.java	Thu Nov 17 15:48:11 2016 -0500
+++ b/thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplStatementDescriptorRegistrationTest.java	Wed Dec 07 10:55:51 2016 -0500
@@ -56,7 +56,7 @@
     public void registersAllDescriptors() {
         ThreadDaoImplStatementDescriptorRegistration reg = new ThreadDaoImplStatementDescriptorRegistration();
         Set<String> descriptors = reg.getStatementDescriptors();
-        assertEquals(15, descriptors.size());
+        assertEquals(13, descriptors.size());
         assertFalse("null statement not allowed", descriptors.contains(null));
     }
 
--- a/thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplTest.java	Thu Nov 17 15:48:11 2016 -0500
+++ b/thread/collector/src/test/java/com/redhat/thermostat/thread/dao/internal/ThreadDaoImplTest.java	Wed Dec 07 10:55:51 2016 -0500
@@ -101,27 +101,6 @@
                                                     "'timeStamp' = ?l , " +
                                                     "'harvesting' = ?b";
         assertEquals(addThreadHarvesting, ThreadDaoImpl.DESC_ADD_THREAD_HARVESTING_STATUS);
-
-        String addThreadInfo = "ADD vm-thread-header SET 'agentId' = ?s , " +
-                                    "'vmId' = ?s , " +
-                                    "'threadName' = ?s , " +
-                                    "'threadId' = ?l , " +
-                                    "'timeStamp' = ?l , " +
-                                    "'referenceID' = ?s";
-
-        String addContentionSample = "ADD thread-contention-sample SET " +
-                "'agentId' = ?s , 'vmId' = ?s , 'blockedCount' = ?l , " +
-                "'blockedTime' = ?l , 'waitedCount' = ?l , " +
-                "'waitedTime' = ?l , 'referenceID' = ?s , 'timeStamp' = ?l";
-        assertEquals(addContentionSample, ThreadDaoImpl.ADD_CONTENTION_SAMPLE);
-
-        String getLatestContentionSample = "QUERY thread-contention-sample " +
-                "WHERE 'referenceID' = ?s SORT 'timeStamp' DSC LIMIT 1";
-        assertEquals(getLatestContentionSample, ThreadDaoImpl.GET_LATEST_CONTENTION_SAMPLE);
-
-        String getFirstThreadState = "QUERY vm-thread-state WHERE " +
-                "'agentId' = ?s AND 'referenceID' = ?s SORT 'probeStartTime' " +
-                "ASC LIMIT 1";
     }
     
     @Test
--- a/thread/collector/src/test/java/com/redhat/thermostat/thread/model/ThreadModelPojosTest.java	Thu Nov 17 15:48:11 2016 -0500
+++ b/thread/collector/src/test/java/com/redhat/thermostat/thread/model/ThreadModelPojosTest.java	Wed Dec 07 10:55:51 2016 -0500
@@ -45,7 +45,6 @@
         ThreadHarvestingStatus.class,
         ThreadState.class,
         ThreadSummary.class,
-        ThreadContentionSample.class,
         VmDeadLockData.class,
     };