net.sf.ehcache.statistics.extended.ExtendedStatistics Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
/**
* Copyright Terracotta, Inc.
*
* Licensed 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 net.sf.ehcache.statistics.extended;
import net.sf.ehcache.CacheOperationOutcomes;
import net.sf.ehcache.store.StoreOperationOutcomes;
import net.sf.ehcache.transaction.xa.XaCommitOutcome;
import net.sf.ehcache.transaction.xa.XaRecoveryOutcome;
import net.sf.ehcache.transaction.xa.XaRollbackOutcome;
import org.terracotta.statistics.archive.Timestamped;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* The ExtendedStatistics interface.
*
* @author cschanck
*/
public interface ExtendedStatistics {
/** The Constant ALL_CACHE_PUT_OUTCOMES. */
static final Set ALL_CACHE_PUT_OUTCOMES = EnumSet.allOf(CacheOperationOutcomes.PutOutcome.class);
/** The Constant ALL_CACHE_GET_OUTCOMES. */
static final Set ALL_CACHE_GET_OUTCOMES = EnumSet.allOf(CacheOperationOutcomes.GetOutcome.class);
/** The Constant ALL_CACHE_MISS_OUTCOMES. */
static final Set ALL_CACHE_MISS_OUTCOMES = EnumSet.of(
CacheOperationOutcomes.GetOutcome.MISS_EXPIRED, CacheOperationOutcomes.GetOutcome.MISS_NOT_FOUND);
/** The Constant ALL_STORE_PUT_OUTCOMES. */
static final Set ALL_STORE_PUT_OUTCOMES = EnumSet.allOf(StoreOperationOutcomes.PutOutcome.class);
/**
* Sets the time to disable.
*
* @param time the time
* @param unit the unit
*/
void setTimeToDisable(long time, TimeUnit unit);
/**
* Sets the always on.
*
* @param alwaysOn the new always on
*/
void setAlwaysOn(boolean alwaysOn);
/**
* Gets the.
*
* @return the operation
*/
Operation get();
/**
* Put.
*
* @return the operation
*/
Operation put();
/**
* Removes the.
*
* @return the operation
*/
Operation remove();
/**
* Heap get.
*
* @return the operation
*/
Operation heapGet();
/**
* Offheap get.
*
* @return the operation
*/
Operation offheapGet();
/**
* Disk get.
*
* @return the operation
*/
Operation diskGet();
/**
* Heap put.
*
* @return the operation
*/
Operation heapPut();
/**
* Offheap put.
*
* @return the operation
*/
Operation offheapPut();
/**
* Disk put.
*
* @return the operation
*/
Operation diskPut();
/**
* Heap remove.
*
* @return the operation
*/
Operation heapRemove();
/**
* Offheap remove.
*
* @return the operation
*/
Operation offheapRemove();
/**
* Disk remove.
*
* @return the operation
*/
Operation diskRemove();
/**
* Search.
*
* @return the operation
*/
Operation search();
/**
* Xa commit.
*
* @return the operation
*/
Operation xaCommit();
/**
* Xa rollback.
*
* @return the operation
*/
Operation xaRollback();
/**
* Xa recovery.
*
* @return the operation
*/
Operation xaRecovery();
/**
* Eviction.
*
* @return the operation
*/
Operation eviction();
/**
* Expiry.
*
* @return the operation
*/
Operation expiry();
/**
* Cluster events
*
* @return the operation
*/
Operation clusterEvent();
/**
* Nonstop events
*
* @return the operation
*/
Operation nonstop();
/**
* All get.
*
* @return the result
*/
Result allGet();
/**
* All miss.
*
* @return the result
*/
Result allMiss();
/**
* All put.
*
* @return the result
*/
Result allPut();
/**
* Heap all put.
*
* @return the result
*/
Result heapAllPut();
/**
* Off heap all put.
*
* @return the result
*/
Result offHeapAllPut();
/**
* Disk all put.
*
* @return the result
*/
Result diskAllPut();
/**
* Cache hit ratio.
* @return
*/
Statistic cacheHitRatio();
/**
* Nonstop timeout ratio
* @return
*/
Statistic nonstopTimeoutRatio();
/**
* Operations.
*
* @param the generic type
* @param outcome the outcome
* @param name the name
* @param tags the tags
* @return the sets the
*/
> Set> operations(Class outcome, String name, String... tags);
/**
* Get the set of cache specific pass thru statistics for a nam/tags pair. Used for
* custom pass thru statistics, as opposed to well known standard ones.
* @param name name
* @param tags set of tags
* @return
*/
Set> passthru(String name, Set tags);
/**
* The Interface Operation.
*
* @param the generic type
*/
public interface Operation> {
/**
* Type.
*
* @return the class
*/
Class type();
/**
* Component.
*
* @param result the result
* @return the result
*/
Result component(T result);
/**
* Compound.
*
* @param results the results
* @return the result
*/
Result compound(Set results);
/**
* Ratio of.
*
* @param numerator the numerator
* @param denomiator the denomiator
* @return the statistic
*/
Statistic ratioOf(Set numerator, Set denomiator);
/**
* Sets the always on.
*
* @param enable the new always on
*/
void setAlwaysOn(boolean enable);
/**
* Checks if is always on.
*
* @return true, if is always on
*/
boolean isAlwaysOn();
/**
* Sets the window.
*
* @param time the time
* @param unit the unit
*/
void setWindow(long time, TimeUnit unit);
/**
* Sets the history.
*
* @param samples the samples
* @param time the time
* @param unit the unit
*/
void setHistory(int samples, long time, TimeUnit unit);
/**
* Gets the window size.
*
* @param unit the unit
* @return the window size
*/
long getWindowSize(TimeUnit unit);
/**
* Gets the history sample size.
*
* @return the history sample size
*/
int getHistorySampleSize();
/**
* Gets the history sample time.
*
* @param unit the unit
* @return the history sample time
*/
long getHistorySampleTime(TimeUnit unit);
}
/**
* The Interface Result.
*/
public interface Result {
/**
* Count.
*
* @return the statistic
*/
Statistic count();
/**
* Rate.
*
* @return the statistic
*/
Statistic rate();
/**
* Latency.
*
* @return the latency
*/
Latency latency();
}
/**
* The Latency interface. Provides min/max/average.
*/
public interface Latency {
/**
* Minimum latency observed.
*
* @return Minimum observed latency. NULL if no operation was observed.
*/
Statistic minimum();
/**
* Maximum latency observed.
*
* @return Maximum observed latency. NULL if no operation was observed.
*/
Statistic maximum();
/**
* Average observed latency.
*
* @return Average observed latency. NULL if no operation was observed.
*/
Statistic average();
}
/**
* The Interface Statistic.
*
* @param the generic type
*/
public interface Statistic {
/**
* Active.
*
* @return true, if successful
*/
boolean active();
/**
* Value.
*
* @return the t
*/
T value();
/**
* History.
*
* @return the list
*/
List> history();
}
/**
* Gets the size.
*
* @return the size
*/
Statistic size();
/**
* Gets the local heap size.
*
* @return the local heap size
*/
Statistic localHeapSize();
/**
* Gets the local heap size in bytes.
*
* @return the local heap size in bytes
*/
Statistic localHeapSizeInBytes();
/**
* Gets the local off heap size.
*
* @return the local off heap size
*/
Statistic localOffHeapSize();
/**
* Gets the local off heap size in bytes.
*
* @return the local off heap size in bytes
*/
Statistic localOffHeapSizeInBytes();
/**
* Gets the local disk size.
*
* @return the local disk size
*/
Statistic localDiskSize();
/**
* Gets the local disk size in bytes.
*
* @return the local disk size in bytes
*/
Statistic localDiskSizeInBytes();
/**
* Gets the remote size.
*
* @return the remote size
*/
Statistic remoteSize();
/**
* Gets the writer queue length.
*
* @return the writer queue length
*/
Statistic writerQueueLength();
/**
* Get the timestamp (millis) of the last cluster rejoin event
*
* @return statistic for cluster rejoin timestamp
*/
Statistic mostRecentRejoinTimeStampMillis();
}