();
- for (Field f : Locale.class.getFields()) {
- int modifiers = f.getModifiers();
- if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Locale.class.equals(f.getType())) {
- try {
- locales.put((Locale) f.get(null), null);
- } catch (IllegalArgumentException e) {
- continue;
- } catch (IllegalAccessException e) {
- continue;
- }
- }
- }
- GLOBAL_LOCALES = locales.keySet();
- }
-
- private final Class> clazz;
-
- private FlyweightType(final Class> clazz) {
- this.clazz = clazz;
- }
-
- /**
- * Whether this is a shared object
- * @param obj the object to check for
- * @return true, if shared
- */
- abstract boolean isShared(Object obj);
-
- /**
- * Will return the Flyweight enum instance for the flyweight Class, or null if type isn't flyweight
- * @param aClazz the class we need the FlyweightType instance for
- * @return the FlyweightType, or null
- */
- static FlyweightType getFlyweightType(final Class> aClazz) {
- if (aClazz.isEnum() || (aClazz.getSuperclass() != null && aClazz.getSuperclass().isEnum())) {
- return ENUM;
- } else {
- FlyweightType flyweightType = TYPE_MAPPINGS.get(aClazz);
- return flyweightType != null ? flyweightType : MISC;
- }
- }
-}
Index: rctags/ehcache-2.10.8.2.20/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionIDSerializedForm.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.8.2.20/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionIDSerializedForm.java (revision 11355)
+++ rctags/ehcache-2.10.8.2.20/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionIDSerializedForm.java (revision 0)
@@ -1,110 +0,0 @@
-/**
- * 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.transaction;
-
-import net.sf.ehcache.CacheManager;
-
-import java.io.Serializable;
-
-/**
- * A replacement serialized form for transaction IDs. It can be used by transaction ID factories
- * to create IDs that serialize to this form (using writeReplace()) if they don't want or cannot
- * provide directly serializable IDs.
- *
- * During deserialization, objects of this class will be replaced by the result of the
- * CacheManager.restoreTransactionID() call.
- *
- * @author Ludovic Orban
- */
-public class TransactionIDSerializedForm implements Serializable {
- private final String cacheManagerName;
- private final String clusterUUID;
- private final String ownerID;
- private final long creationTime;
- private final int id;
-
- /**
- * Constructor
- *
- * @param cacheManagerName the name of the cache manager which contains the factory
- * that created the original TransactionID
- * @param clusterUUID the TransactionID's cluster UUID
- * @param creationTime the TransactionID's creation time
- * @param id the TransactionID's internal ID
- */
- public TransactionIDSerializedForm(String cacheManagerName, String clusterUUID, String ownerID, long creationTime, int id) {
- this.cacheManagerName = cacheManagerName;
- this.clusterUUID = clusterUUID;
- this.ownerID = ownerID;
- this.creationTime = creationTime;
- this.id = id;
- }
-
- /**
- * Get the name of the cache manager which contains the factory that created the
- * original TransactionID
- *
- * @return the cache manager name
- */
- public String getCacheManagerName() {
- return cacheManagerName;
- }
-
- /**
- * Get the original TransactionID's cluster UUID
- *
- * @return the original TransactionID's cluster UUID
- */
- public String getClusterUUID() {
- return clusterUUID;
- }
-
- /**
- * Get the original TransactionID's owner id
- *
- * @return the original TransactionID's owner id
- */
- public String getOwnerID() {
- return ownerID;
- }
-
- /**
- * Get the original TransactionID's creation time
- *
- * @return the original TransactionID's creation time
- */
- public long getCreationTime() {
- return creationTime;
- }
-
- /**
- * Get the original TransactionID's internal ID
- *
- * @return the original TransactionID's internal ID
- */
- public int getId() {
- return id;
- }
-
- private Object readResolve() {
- CacheManager cacheManager = CacheManager.getCacheManager(cacheManagerName);
- if (cacheManager == null) {
- throw new TransactionException("unable to restore transaction ID from " + cacheManagerName);
- }
- return cacheManager.getOrCreateTransactionIDFactory().restoreTransactionID(this);
- }
-
-}
Index: rctags/ehcache-2.10.8.2.20/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.8.2.20/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java (revision 11355)
+++ rctags/ehcache-2.10.8.2.20/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java (revision 0)
@@ -1,52 +0,0 @@
-/*
- * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright
- * notice. All rights reserved.
- */
-package org.terracotta.ehcache.tests;
-
-import com.tc.test.config.model.TestConfig;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
-/**
- * @author cdennis
- */
-public class NoTcConfigStandaloneCacheTest extends AbstractCacheTestBase {
-
- public NoTcConfigStandaloneCacheTest(TestConfig testConfig) {
- super("no-tcconfig-cache-test.xml", testConfig);
- }
-
- @Override
- protected void evaluateClientOutput(String clientName, int exitCode, File output) throws Throwable {
- if ((exitCode == 0)) { throw new AssertionError("Client " + clientName + " exited with exit code: " + exitCode); }
-
- FileReader fr = null;
- boolean cacheException = false;
- boolean tcConfig = false;
- try {
- fr = new FileReader(output);
- BufferedReader reader = new BufferedReader(fr);
- String st = "";
- while ((st = reader.readLine()) != null) {
- if (st.contains("CacheException")) cacheException = true;
- if (st.contains("")) tcConfig = true;
- }
- } catch (Exception e) {
- throw new AssertionError(e);
- } finally {
- try {
- fr.close();
- } catch (Exception e) {
- //
- }
- }
-
- if (!cacheException) { throw new AssertionError("Expected Exception"); }
-
- if (!tcConfig) { throw new AssertionError("Expected "); }
- }
-
-}
Index: rctags/ehcache-2.10.8.2.20/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.8.2.20/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java (revision 11355)
+++ rctags/ehcache-2.10.8.2.20/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java (revision 0)
@@ -1,89 +0,0 @@
-/**
- * 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.search.parser;
-
-public class MOrderBy {
-
- /**
- * The attr.
- */
- private final MAttribute attr;
-
- /**
- * The asc.
- */
- private final boolean asc;
-
- /**
- * Instantiates a new model order by.
- *
- * @param attr the attr
- * @param asc the asc
- */
- public MOrderBy(MAttribute attr, boolean asc) {
- this.attr = attr;
- this.asc = asc;
- }
-
- /**
- * Gets the attribute.
- *
- * @return the attribute
- */
- public MAttribute getAttribute() {
- return attr;
- }
-
- /**
- * Checks if is order ascending.
- *
- * @return true, if is order ascending
- */
- public boolean isOrderAscending() {
- return asc;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "order by " + attr + (asc ? " ascending" : " descending");
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (asc ? 1231 : 1237);
- result = prime * result + ((attr == null) ? 0 : attr.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
- MOrderBy other = (MOrderBy)obj;
- if (asc != other.asc) return false;
- if (attr == null) {
- if (other.attr != null) return false;
- } else if (!attr.equals(other.attr)) return false;
- return true;
- }
-
-}
Index: rctags/ehcache-2.10.8.2.20/ehcache-core/src/main/java/net/sf/ehcache/terracotta/ClusteredInstanceFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.8.2.20/ehcache-core/src/main/java/net/sf/ehcache/terracotta/ClusteredInstanceFactory.java (revision 11355)
+++ rctags/ehcache-2.10.8.2.20/ehcache-core/src/main/java/net/sf/ehcache/terracotta/ClusteredInstanceFactory.java (revision 0)
@@ -1,149 +0,0 @@
-/**
- * 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.terracotta;
-
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.cluster.CacheCluster;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.event.CacheEventListener;
-import net.sf.ehcache.management.event.ManagementEventSink;
-import net.sf.ehcache.store.Store;
-import net.sf.ehcache.store.TerracottaStore;
-import net.sf.ehcache.transaction.SoftLockManager;
-import net.sf.ehcache.transaction.TransactionIDFactory;
-import net.sf.ehcache.writer.writebehind.WriteBehind;
-
-import java.util.concurrent.Callable;
-
-/**
- * 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();
-
- /**
- * Enable or disable NonStop for the current thread only.
- *
- * @param enable true to enable NonStop, false otherwise.
- */
- void enableNonStopForCurrentThread(boolean enable);
-
- /**
- * Cleans up any resources left behind after the shutdown of the associated CacheManager
- */
- void shutdown();
-
- /**
- * Create a TransactionIDFactory
- *
- * @param uuid a UUID unique to the cluster
- * @param cacheManagerName the name of the cache manager creating a TransactionIDFactory
- * @return a TransactionIDFactory
- */
- TransactionIDFactory createTransactionIDFactory(String uuid, String cacheManagerName);
-
- /**
- * Create a SoftLockManager for a cache
- *
- * @param cache the cache for which to create a SoftLockManager
- * @return a SoftLockManager
- */
- SoftLockManager getOrCreateSoftLockManager(Ehcache cache);
-
- /**
- * Create a NonStopStoreWrapper for a terracottaStore
- *
- * @param store the store for which to create a NonStopStore
- * @return a NonStopStore
- */
- TerracottaStore createNonStopStore(Callable store, Ehcache cache);
-
- /**
- * Destroys the specified cache
- *
- * @param cacheManagerName name of the cache manager the cache belongs to
- * @param cacheName name of the cache
- * @return true if the cache existed before being destroyed
- */
- boolean destroyCache(String cacheManagerName, String cacheName);
-
- /**
- * Wait until the Orchestrator is running for the given CacheManager
- * @param cacheManagerName name of the CacheManager
- */
- public void waitForOrchestrator(String cacheManagerName);
-
- /**
- * Links this cache manager to the cluster
- *
- * @param cacheManagerName the name of the cache manager
- * @param configuration the cache manager configuration
- */
- void linkClusteredCacheManager(String cacheManagerName, Configuration configuration);
-
- /**
- * Un-links the cache from its cluster entity
- *
- * @param cacheName the cache to unlink
- */
- void unlinkCache(String cacheName);
-
- /**
- * Create a management event sink
- *
- * @return a management event sink
- */
- ManagementEventSink createEventSink();
-}
Index: rctags/ehcache-2.10.8.2.20/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm
===================================================================
diff -u -N
--- rctags/ehcache-2.10.8.2.20/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 11355)
+++ rctags/ehcache-2.10.8.2.20/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 0)
@@ -1,40 +0,0 @@
-RULE trace RemoteTransactionManagerImpl commitWithoutThrottling
-CLASS RemoteTransactionManagerImpl
-METHOD commitWithoutThrottling
-AT ENTRY
-IF true
-DO traceln("COMMITTRANSACTION :" + Thread.currentThread().getName());
-ENDRULE
-
-RULE trace ClusteredStore putWithWriterEntry
-CLASS ClusteredStore
-METHOD putWithWriter
-AT ENTRY
-IF true
-DO traceln("BEGINOPERATION putWithWriterThread :" + Thread.currentThread().getName());
-ENDRULE
-
-RULE trace ClusteredStore putWithWriterExit
-CLASS ClusteredStore
-METHOD putWithWriter
-AT EXIT
-IF true
-DO traceln("ENDOPERATION putWithWriter Thread :" + Thread.currentThread().getName());
-ENDRULE
-
-RULE trace ClusteredStore removeWithWriterEntry
-CLASS ClusteredStore
-METHOD removeWithWriter
-AT ENTRY
-IF true
-DO traceln("BEGINOPERATION removeWithWriterThread :" + Thread.currentThread().getName());
-ENDRULE
-
-RULE trace ClusteredStore removeWithWriterExit
-CLASS ClusteredStore
-METHOD removeWithWriter
-AT EXIT
-IF true
-DO traceln("ENDOPERATION removeWithWriter Thread :" + Thread.currentThread().getName());
-ENDRULE
-
Index: rctags/ehcache-2.10.8.2.20/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.8.2.20/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 11355)
+++ rctags/ehcache-2.10.8.2.20/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 0)
@@ -1,113 +0,0 @@
-/**
- * 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;
-
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.DiskStoreConfiguration;
-import net.sf.ehcache.config.MemoryUnit;
-import net.sf.ehcache.config.PersistenceConfiguration;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.terracotta.test.categories.CheckShorts;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-@Category(CheckShorts.class)
-@RunWith(Parameterized.class)
-public class CacheCopyOnRwReplaceRemoveTest {
-
- public static final String MEMORY_CACHE = "memoryCache";
- public static final String DISK_CACHE = "diskCache";
-
- @Parameters(name = "copyOnRead:{0}, copyOnWrite:{1}")
- public static Collection