You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rm...@apache.org on 2014/05/13 20:15:22 UTC
svn commit: r1594312 -
/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/EvictionListener.java
Author: rmannibucau
Date: Tue May 13 18:15:21 2014
New Revision: 1594312
URL: http://svn.apache.org/r1594312
Log:
forgotten class
Added:
commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/EvictionListener.java
Added: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/EvictionListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/EvictionListener.java?rev=1594312&view=auto
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/EvictionListener.java (added)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/EvictionListener.java Tue May 13 18:15:21 2014
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+package org.apache.commons.jcs.jcache;
+
+import org.apache.commons.jcs.engine.control.event.behavior.IElementEvent;
+import org.apache.commons.jcs.engine.control.event.behavior.IElementEventHandler;
+
+public class EvictionListener implements IElementEventHandler
+{
+ private final Statistics stats;
+
+ public EvictionListener(final Statistics statistics)
+ {
+ this.stats = statistics;
+ }
+
+ @Override
+ public void handleElementEvent(final IElementEvent event)
+ {
+ switch (event.getElementEvent())
+ {
+ case EXCEEDED_MAXLIFE_BACKGROUND:
+ case EXCEEDED_MAXLIFE_ONREQUEST:
+ case EXCEEDED_IDLETIME_ONREQUEST:
+ case EXCEEDED_IDLETIME_BACKGROUND:
+ stats.increaseEvictions(1);
+ break;
+ }
+ }
+}