incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [07/10] git commit: Removing used classes.
Date Mon, 03 Jun 2013 02:02:22 GMT
Removing used classes.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/95cb159b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/95cb159b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/95cb159b

Branch: refs/heads/0.1.5
Commit: 95cb159ba5d4f617b58617a5d1d7a9118659c6c5
Parents: 9a0b732
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Jun 2 18:18:57 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Jun 2 18:18:57 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/manager/stats/LoadFactor.java  |  139 ---------------
 .../blur/manager/stats/LoadFactorProcessor.java    |   70 --------
 .../org/apache/blur/manager/stats/Sampler.java     |   23 ---
 .../org/apache/blur/manager/stats/WeightedAvg.java |   73 --------
 4 files changed, 0 insertions(+), 305 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/95cb159b/src/blur-core/src/main/java/org/apache/blur/manager/stats/LoadFactor.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/stats/LoadFactor.java b/src/blur-core/src/main/java/org/apache/blur/manager/stats/LoadFactor.java
deleted file mode 100644
index c1d2cba..0000000
--- a/src/blur-core/src/main/java/org/apache/blur/manager/stats/LoadFactor.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.apache.blur.manager.stats;
-
-/**
- * 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.
- */
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.blur.log.Log;
-import org.apache.blur.log.LogFactory;
-
-
-public class LoadFactor {
-
-  private static final Log LOG = LogFactory.getLog(LoadFactor.class);
-
-  public static void main(String[] args) throws InterruptedException {
-    LoadFactor loadFactor = new LoadFactor();
-    loadFactor.init();
-    loadFactor.add("heapUsed", new Sampler() {
-      private MemoryMXBean bean = ManagementFactory.getMemoryMXBean();
-
-      @Override
-      public long sample() {
-        return bean.getHeapMemoryUsage().getUsed();
-      }
-    });
-
-    new Thread(new Runnable() {
-      @Override
-      public void run() {
-        long total = 0;
-        while (true) {
-          total += doWork();
-        }
-      }
-    }).start();
-
-    while (true) {
-      System.out.println("one     = " + (long) loadFactor.getOneMinuteLoadFactor("heapUsed"));
-      System.out.println("five    = " + (long) loadFactor.getFiveMinuteLoadFactor("heapUsed"));
-      System.out.println("fifteen = " + (long) loadFactor.getFifteenMinuteLoadFactor("heapUsed"));
-      Thread.sleep(5000);
-    }
-
-  }
-
-  protected static int doWork() {
-    StringBuilder builder = new StringBuilder();
-    int count = 0;
-    for (int i = 0; i < 10000000; i++) {
-      if (count == 1000) {
-        try {
-          Thread.sleep(1);
-        } catch (InterruptedException e) {
-          return 0;
-        }
-        count = 0;
-      }
-      builder.append('m');
-      count++;
-    }
-    return builder.toString().hashCode();
-  }
-
-  private Map<String, LoadFactorProcessor> _processors = new ConcurrentHashMap<String,
LoadFactorProcessor>();
-  private Timer _timer;
-  private long _delay = TimeUnit.SECONDS.toMillis(1);
-  private long _period = TimeUnit.SECONDS.toMillis(1);
-
-  public void init() {
-    _timer = new Timer("LoadFactor-Daemon", true);
-    _timer.schedule(new TimerTask() {
-      @Override
-      public void run() {
-        try {
-          sampleAll();
-        } catch (Throwable e) {
-          LOG.error("Unknown error", e);
-        }
-      }
-    }, _delay, _period);
-
-  }
-
-  private void sampleAll() {
-    for (String name : _processors.keySet()) {
-      LoadFactorProcessor processor = _processors.get(name);
-      processor.sample();
-    }
-  }
-
-  public void add(String name, Sampler sampler) {
-    _processors.put(name, new LoadFactorProcessor(sampler));
-  }
-
-  public double getOneMinuteLoadFactor(String name) {
-    LoadFactorProcessor processor = _processors.get(name);
-    if (processor == null) {
-      return 0;
-    }
-    return processor.oneMinuteLoadFactor();
-  }
-
-  public double getFiveMinuteLoadFactor(String name) {
-    LoadFactorProcessor processor = _processors.get(name);
-    if (processor == null) {
-      return 0;
-    }
-    return processor.fiveMinuteLoadFactor();
-  }
-
-  public double getFifteenMinuteLoadFactor(String name) {
-    LoadFactorProcessor processor = _processors.get(name);
-    if (processor == null) {
-      return 0;
-    }
-    return processor.fifteenMinuteLoadFactor();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/95cb159b/src/blur-core/src/main/java/org/apache/blur/manager/stats/LoadFactorProcessor.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/stats/LoadFactorProcessor.java
b/src/blur-core/src/main/java/org/apache/blur/manager/stats/LoadFactorProcessor.java
deleted file mode 100644
index 6294fce..0000000
--- a/src/blur-core/src/main/java/org/apache/blur/manager/stats/LoadFactorProcessor.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.apache.blur.manager.stats;
-
-/**
- * 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.
- */
-import java.util.concurrent.TimeUnit;
-
-public class LoadFactorProcessor {
-
-  private final Sampler _sampler;
-  private final WeightedAvg _one;
-  private final WeightedAvg _five;
-  private final WeightedAvg _fifteen;
-
-  public LoadFactorProcessor(Sampler sampler) {
-    _sampler = sampler;
-    _one = new WeightedAvg((int) TimeUnit.MINUTES.toSeconds(1));
-    _five = new WeightedAvg((int) TimeUnit.MINUTES.toSeconds(5));
-    _fifteen = new WeightedAvg((int) TimeUnit.MINUTES.toSeconds(15));
-  }
-
-  public void sample() {
-    long sample = _sampler.sample();
-    _one.add(sample);
-    _five.add(sample);
-    _fifteen.add(sample);
-  }
-
-  public double oneMinuteLoadFactor() {
-    return _one.getAvg();
-  }
-
-  public double fiveMinuteLoadFactor() {
-    return _five.getAvg();
-  }
-
-  public double fifteenMinuteLoadFactor() {
-    return _fifteen.getAvg();
-  }
-
-  public Sampler getSampler() {
-    return _sampler;
-  }
-
-  public WeightedAvg getOne() {
-    return _one;
-  }
-
-  public WeightedAvg getFive() {
-    return _five;
-  }
-
-  public WeightedAvg getFifteen() {
-    return _fifteen;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/95cb159b/src/blur-core/src/main/java/org/apache/blur/manager/stats/Sampler.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/stats/Sampler.java b/src/blur-core/src/main/java/org/apache/blur/manager/stats/Sampler.java
deleted file mode 100644
index 8cd84fe..0000000
--- a/src/blur-core/src/main/java/org/apache/blur/manager/stats/Sampler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.apache.blur.manager.stats;
-
-/**
- * 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.
- */
-public interface Sampler {
-
-  long sample();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/95cb159b/src/blur-core/src/main/java/org/apache/blur/manager/stats/WeightedAvg.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/stats/WeightedAvg.java b/src/blur-core/src/main/java/org/apache/blur/manager/stats/WeightedAvg.java
deleted file mode 100644
index c662939..0000000
--- a/src/blur-core/src/main/java/org/apache/blur/manager/stats/WeightedAvg.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.blur.manager.stats;
-
-/**
- * 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.
- */
-
-public class WeightedAvg {
-
-  private final int _maxSize;
-  private final long[] _values;
-  private int _numberOfAdds;
-  private int _currentPosition;
-  private long _totalValue = 0;
-
-  public WeightedAvg(int maxSize) {
-    _maxSize = maxSize;
-    _values = new long[_maxSize];
-    _numberOfAdds = 0;
-    _currentPosition = 0;
-  }
-
-  public void add(long value) {
-    if (_currentPosition >= _maxSize) {
-      _currentPosition = 0;
-    }
-    long currentValue = _values[_currentPosition];
-    _values[_currentPosition] = value;
-    _totalValue += value - currentValue;
-    _numberOfAdds++;
-    _currentPosition++;
-  }
-
-  public double getAvg() {
-    if (_totalValue == 0) {
-      return 0;
-    }
-    return (double) _totalValue / (double) Math.min(_numberOfAdds, _maxSize);
-  }
-
-  public int getMaxSize() {
-    return _maxSize;
-  }
-
-  public long[] getValues() {
-    return _values;
-  }
-
-  public int getNumberOfAdds() {
-    return _numberOfAdds;
-  }
-
-  public int getCurrentPosition() {
-    return _currentPosition;
-  }
-
-  public long getTotalValue() {
-    return _totalValue;
-  }
-
-}


Mime
View raw message