All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.terracotta.modules.ehcache.store.nonstop.ExceptionOnTimeoutStore Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.10.9.2
Show newest version
/**
 * 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 org.terracotta.modules.ehcache.store.nonstop;

import net.sf.ehcache.CacheException;
import net.sf.ehcache.Element;
import net.sf.ehcache.Status;
import net.sf.ehcache.config.CacheConfiguration;
import net.sf.ehcache.constructs.nonstop.NonStopCacheException;
import net.sf.ehcache.search.Attribute;
import net.sf.ehcache.search.Results;
import net.sf.ehcache.search.attribute.AttributeExtractor;
import net.sf.ehcache.store.ElementValueComparator;
import net.sf.ehcache.store.Policy;
import net.sf.ehcache.store.StoreListener;
import net.sf.ehcache.store.StoreQuery;
import net.sf.ehcache.store.TerracottaStore;
import net.sf.ehcache.writer.CacheWriterManager;
import net.sf.ehcache.writer.writebehind.WriteBehind;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Implementation of {@link TerracottaStore} that throws {@link NonStopCacheException} for all operations.
 * 
 * @author Abhishek Sanoujam
 */
public final class ExceptionOnTimeoutStore implements TerracottaStore {

  /**
   * the singleton instance
   */
  private static final ExceptionOnTimeoutStore INSTANCE = new ExceptionOnTimeoutStore();

  /**
   * private constructor
   */
  private ExceptionOnTimeoutStore() {
    //
  }

  /**
   * returns the singleton instance
   */
  public static ExceptionOnTimeoutStore getInstance() {
    return INSTANCE;
  }

    /**
   * {@inheritDoc}.
   * 

* Throws {@link NonStopCacheException} */ @Override public Element get(final Object key) throws IllegalStateException, CacheException { throw new NonStopCacheException("get timed out"); } /** * {@inheritDoc} */ @Override public Element getQuiet(final Object key) throws IllegalStateException, CacheException { throw new NonStopCacheException("getQuiet timed out"); } /** * {@inheritDoc} *

* Throws {@link NonStopCacheException} */ @Override public Map getAllQuiet(Collection keys) { throw new NonStopCacheException("getAllQuiet for '" + keys.size() + "' keys timed out"); } /** * {@inheritDoc} *

* Throws {@link NonStopCacheException} */ @Override public Map getAll(Collection keys) { throw new NonStopCacheException("getAll for '" + keys.size() + "' keys timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public List getKeys() throws IllegalStateException, CacheException { throw new NonStopCacheException("getKeys timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean put(final Element element) throws IllegalArgumentException, IllegalStateException, CacheException { throw new NonStopCacheException("put timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void putAll(final Collection elements) throws CacheException { throw new NonStopCacheException("putAll for " + elements.size() + " elements timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Element remove(final Object key) throws IllegalStateException { throw new NonStopCacheException("remove timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void removeAll(final Collection keys) throws IllegalStateException { throw new NonStopCacheException("removeAll for " + keys.size() + " keys timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void removeAll() throws IllegalStateException, CacheException { throw new NonStopCacheException("removeAll timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void flush() throws IllegalStateException, CacheException { throw new NonStopCacheException("flush timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Object getInternalContext() { throw new NonStopCacheException("getInternalContext timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public int getSize() throws IllegalStateException, CacheException { throw new NonStopCacheException("getSize timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Element putIfAbsent(Element element) throws NullPointerException { throw new NonStopCacheException("putIfAbsent timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Element replace(Element element) throws NullPointerException { throw new NonStopCacheException("replace timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void addStoreListener(StoreListener listener) { throw new NonStopCacheException("addStoreListener timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean bufferFull() { throw new NonStopCacheException("bufferFull timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean containsKey(Object key) { throw new NonStopCacheException("containsKey timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean containsKeyInMemory(Object key) { throw new NonStopCacheException("containsKeyInMemory timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean containsKeyOffHeap(Object key) { throw new NonStopCacheException("containsKeyOffHeap timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean containsKeyOnDisk(Object key) { throw new NonStopCacheException("containsKeyOnDisk timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void dispose() { throw new NonStopCacheException("dispose timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Results executeQuery(StoreQuery query) { throw new NonStopCacheException("executeQuery timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void expireElements() { throw new NonStopCacheException("expireElements timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Policy getInMemoryEvictionPolicy() { throw new NonStopCacheException("getInMemoryEvictionPolicy timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public int getInMemorySize() { throw new NonStopCacheException("getInMemorySize timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public long getInMemorySizeInBytes() { throw new NonStopCacheException("getInMemorySizeInBytes timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Object getMBean() { throw new NonStopCacheException("getMBean timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public int getOffHeapSize() { throw new NonStopCacheException("getOffHeapSize timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public long getOffHeapSizeInBytes() { throw new NonStopCacheException("getOffHeapSizeInBytes timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public int getOnDiskSize() { throw new NonStopCacheException("getOnDiskSize timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public long getOnDiskSizeInBytes() { throw new NonStopCacheException("getOnDiskSizeInBytes timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean hasAbortedSizeOf() { throw new NonStopCacheException("hasAbortedSizeOf timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Status getStatus() { throw new NonStopCacheException("getStatus timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public int getTerracottaClusteredSize() { throw new NonStopCacheException("getTerracottaClusteredSize timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean isCacheCoherent() { throw new NonStopCacheException("isCacheCoherent timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean isClusterCoherent() { throw new NonStopCacheException("isClusterCoherent timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean isNodeCoherent() { throw new NonStopCacheException("isNodeCoherent timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean putWithWriter(Element element, CacheWriterManager writerManager) throws CacheException { throw new NonStopCacheException("putWithWriter timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { throw new NonStopCacheException("removeElement timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void removeStoreListener(StoreListener listener) { throw new NonStopCacheException("removeStoreListener timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Element removeWithWriter(Object key, CacheWriterManager writerManager) throws CacheException { throw new NonStopCacheException("removeWithWriter timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { throw new NonStopCacheException("replace timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void setAttributeExtractors(Map extractors) { throw new NonStopCacheException("setAttributeExtractors timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void setInMemoryEvictionPolicy(Policy policy) { throw new NonStopCacheException("setInMemoryEvictionPolicy timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void setNodeCoherent(boolean coherent) throws UnsupportedOperationException { throw new NonStopCacheException("setNodeCoherent timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public void waitUntilClusterCoherent() throws UnsupportedOperationException { throw new NonStopCacheException("waitUntilClusterCoherent timed out"); } @Override public Set getSearchAttributes() { throw new NonStopCacheException("getSearchAttributes timed out"); } /** * {@inheritDoc}. *

* Throws {@link NonStopCacheException} */ @Override public Attribute getSearchAttribute(String attributeName) { throw new NonStopCacheException("getSearchAttribute timed out"); } /** * {@inheritDoc} */ @Override public Set getLocalKeys() { throw new NonStopCacheException("getLocalKeys() timed out"); } /** * {@inheritDoc} */ @Override public CacheConfiguration.TransactionalMode getTransactionalMode() { throw new NonStopCacheException("getTransactionalMode() timed out"); } /** * {@inheritDoc} */ public Element unlockedGet(Object key) { throw new NonStopCacheException("unlockedGet() timed out"); } /** * {@inheritDoc} */ public Element unlockedGetQuiet(Object key) { throw new NonStopCacheException("unlockedGetQuiet() timed out"); } /** * {@inheritDoc} */ @Override public Element unsafeGet(Object key) { throw new NonStopCacheException("unsafeGet() timed out"); } /** * {@inheritDoc} */ @Override public void quickClear() { throw new NonStopCacheException("quickClear() timed out"); } /** * {@inheritDoc} */ @Override public int quickSize() { throw new NonStopCacheException("quickSize() timed out"); } /** * {@inheritDoc} */ public Element unsafeGetQuiet(Object key) { throw new NonStopCacheException("unsafeGetQuiet() timed out"); } /** * {@inheritDoc} */ @Override public void recalculateSize(Object key) { throw new UnsupportedOperationException(); } @Override public WriteBehind createWriteBehind() { throw new UnsupportedOperationException(); } @Override public void notifyCacheEventListenersChanged() { throw new NonStopCacheException("notifyCacheEventListenersChanged() timed out"); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy