001    /*
002     *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003     *
004     *  This file is licensed to You under the Eclipse Public License (EPL);
005     *  You may not use this file except in compliance with the License. You
006     *  may obtain a copy of the License at
007     *
008     *      http://www.opensource.org/licenses/eclipse-1.0.php
009     *
010     *  See the COPYRIGHT.txt file distributed with this work for information
011     *  regarding copyright ownership.
012     */
013    package org.jikesrvm.adaptive.measurements.organizers;
014    
015    import org.jikesrvm.adaptive.measurements.RuntimeMeasurements;
016    import org.jikesrvm.adaptive.measurements.listeners.YieldCounterListener;
017    import org.vmmagic.pragma.NonMoving;
018    
019    /**
020     * An organizer that periodically decays runtime counters
021     *
022     **/
023    @NonMoving
024    public final class DecayOrganizer extends Organizer {
025    
026      /**
027       * @param listener the associated listener
028       */
029      public DecayOrganizer(YieldCounterListener listener) {
030        this.listener = listener;
031        listener.setOrganizer(this);
032      }
033    
034      /**
035       * Initialization: install and activate our listener.
036       */
037      @Override
038      public void initialize() {
039        RuntimeMeasurements.installTimerNullListener((YieldCounterListener) listener);
040      }
041    
042      /**
043       * Decays the decayable objects.
044       */
045      @Override
046      void thresholdReached() {
047        RuntimeMeasurements.decayDecayableObjects();
048      }
049    }
050    
051    
052