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

net.sf.ehcache.terracotta.ClusteredInstanceFactory Maven / Gradle / Ivy

Go to download

This is the ehcache core module. Pair it with other modules for added functionality.

There is a newer version: 2.6.11
Show newest version
/**
 *  Copyright 2003-2010 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.terracotta;

import net.sf.ehcache.Ehcache;
import net.sf.ehcache.cluster.CacheCluster;
import net.sf.ehcache.event.CacheEventListener;
import net.sf.ehcache.store.Store;
import net.sf.ehcache.transaction.SoftLockFactory;
import net.sf.ehcache.transaction.TransactionIDFactory;
import net.sf.ehcache.writer.writebehind.WriteBehind;

/**
 * Factory for creating clustered instances
 *
 * @author Tim Eck
 * @author Geert Bevin
 * @since 1.7
 */
public interface ClusteredInstanceFactory {

    /**
     * Create a Store instance for the given cache
     *
     * @param cache the cache will backed by the returned store
     * @return store instance
     */
    Store createStore(Ehcache cache);

    /**
     * Get an api for looking at the clustered node topology.
     */
    CacheCluster getTopology();

    /**
     * Create an WriteBehind instance for the given cache
     *
     * @param cache the cache to which the write behind will be tied
     * @return write behind instance
     */
    WriteBehind createWriteBehind(Ehcache cache);

    /**
     * Create a replicator for the cache events of a given cache
     *
     * @param cache the cache to which the replicator will be bound
     * @return cache event replicator
     */
    CacheEventListener createEventReplicator(Ehcache cache);
    
    /**
     * Returns a universally unique identifiers for this factory.
     * 
     * @return the identifier as a string
     */
    String getUUID();
    
    /**
     * Cleans up any resources left behind after the shutdown of the associated CacheManager
     */
    void shutdown();

    /**
     * Create a TransactionIDFactory
     * @param clusterUUID a UUID unique to the cluster
     * @return a TransactionIDFactory
     */
    TransactionIDFactory createTransactionIDFactory(String clusterUUID);

    /**
     * Create a SoftLockFactory for a cache
     * @param cacheName the cache name for which to create a SoftLockFactory
     * @return a SoftLockFactory
     */
    SoftLockFactory getOrCreateSoftLockFactory(String cacheName);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy