Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
/.cproject
/.project
/.idea/
.vs/

/examples/dotnet/*/bin/
/examples/dotnet/*/obj/
10 changes: 5 additions & 5 deletions clicache/integration-test/CacheHelperN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public static void InitConfig(Properties<string, string> config, string cacheXml
config.Insert("heap-lru-delta", m_delta.ToString());
config.Insert("enable-time-statistics", "true");

CacheFactory cf = CacheFactory.CreateCacheFactory(config);
var cf = new CacheFactory(config);

if (cacheXml != null && cacheXml.Length > 0)
{
Expand All @@ -621,7 +621,7 @@ public static void InitConfig(Properties<string, string> config, string cacheXml
}
catch (CacheExistsException)
{
m_cache = CacheFactory.CreateCacheFactory(config).Create();
m_cache = new CacheFactory(config).Create();
}
}

Expand Down Expand Up @@ -1313,7 +1313,7 @@ public static IRegion<TKey, TValue> CreateLRUTCRegion_Pool<TKey, TValue>(string
}
}

Properties<string, string> sqLiteProps = Properties<string, string>.Create<string, string>();
var sqLiteProps = Properties<string, string>.Create();
sqLiteProps.Insert("PageSize", "65536");
sqLiteProps.Insert("MaxFileSize", "512000000");
sqLiteProps.Insert("MaxPageCount", "1073741823");
Expand Down Expand Up @@ -1585,8 +1585,8 @@ public static Properties<string, object> GetPkcsCredentialsForMU(Properties<stri
{
if (credentials == null)
return null;
Properties<string, object> target = Properties<string, object>.Create<string, object>();
PropsStringToObject psto = new PropsStringToObject(target);
var target = Properties<string, object>.Create();
var psto = new PropsStringToObject(target);
credentials.ForEach(new PropertyVisitorGeneric<string, string>(psto.Visit));
return target;
}
Expand Down
10 changes: 5 additions & 5 deletions clicache/integration-test/OverflowTestsN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public void XmlCacheCreationWithOverflow()
CacheHelper.CloseCache();
Util.Log("Creating cache with the configurations provided in valid_overflowAttr.xml");
string cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "valid_overflowAttr.xml";
cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
cache = new CacheFactory().Set("cache-xml-file", cachePath).Create();
Util.Log("Successfully created the cache.");
rootRegions = cache.RootRegions<object, object>();
Assert.IsNotNull(rootRegions);
Expand Down Expand Up @@ -593,7 +593,7 @@ public void XmlCacheCreationWithOverflow()
try
{
cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "non-existent.xml";
cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
cache = new CacheFactory().Set("cache-xml-file", cachePath).Create();
Assert.Fail("Creation of cache with non-existent.xml should fail!");
}
catch (CacheXmlException ex)
Expand All @@ -606,7 +606,7 @@ public void XmlCacheCreationWithOverflow()
try
{
cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_overflowAttr1.xml";
cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
cache = new CacheFactory().Set("cache-xml-file", cachePath).Create();
Assert.Fail("Creation of cache with invalid_overflowAttr1.xml should fail!");
}
catch (IllegalStateException ex)
Expand All @@ -622,7 +622,7 @@ public void XmlCacheCreationWithOverflow()
try
{
cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_overflowAttr2.xml";
cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
cache = new CacheFactory().Set("cache-xml-file", cachePath).Create();
Assert.Fail("Creation of cache with invalid_overflowAttr2.xml should fail!");
}
catch (CacheXmlException ex)
Expand All @@ -638,7 +638,7 @@ public void XmlCacheCreationWithOverflow()
try
{
cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_overflowAttr3.xml";
cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
cache = new CacheFactory().Set("cache-xml-file", cachePath).Create();
Assert.Fail("Creation of cache with invalid_overflowAttr3.xml should fail!");
}
catch (CacheXmlException ex)
Expand Down
10 changes: 5 additions & 5 deletions clicache/integration-test/ThinClientDurableTestsN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -791,12 +791,12 @@ void runDurableFailover()

void RunDurableClient(int expectedPendingQSize)
{
Properties<string, string> pp = Properties<string, string>.Create<string, string>();
var pp = Properties<string, string>.Create();
pp.Insert("durable-client-id", "DurableClientId");
pp.Insert("durable-timeout", "30s");

CacheFactory cacheFactory = CacheFactory.CreateCacheFactory(pp);
Cache cache = cacheFactory.Create();
var cacheFactory = new CacheFactory(pp);
var cache = cacheFactory.Create();
cache.GetPoolFactory().SetSubscriptionEnabled(true);
cache.GetPoolFactory().SetSubscriptionAckInterval(TimeSpan.FromMilliseconds(5000));
cache.GetPoolFactory().SetSubscriptionMessageTrackingTimeout(TimeSpan.FromMilliseconds(5000));
Expand Down Expand Up @@ -887,7 +887,7 @@ void runDurableClientWithTwoPools()

void RunFeeder()
{
CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
var cacheFactory = new CacheFactory();
Util.Log("Feeder connected to the Geode Distributed System");

Cache cache = cacheFactory.Create();
Expand Down Expand Up @@ -916,7 +916,7 @@ void RunFeeder()

void RunFeeder1()
{
CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
CacheFactory cacheFactory = new CacheFactory();
Util.Log("Feeder connected to the Geode Distributed System");

Cache cache = cacheFactory.Create();
Expand Down
4 changes: 2 additions & 2 deletions clicache/integration-test/ThinClientPdxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public void ConfigClient1AndCreateRegions_Pool(string[] regionNames,
string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
{
//Configure Client "name" for Client-1
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
props.Insert("name", "Client-1");
CacheHelper.InitConfig(props);

Expand All @@ -452,7 +452,7 @@ public void ConfigClient2AndCreateRegions_Pool(string[] regionNames,
string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
{
//Configure Client "name" for Client-2
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
props.Insert("name", "Client-2");
CacheHelper.InitConfig(props);

Expand Down
12 changes: 6 additions & 6 deletions clicache/integration-test/ThinClientPoolTestsN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void runPoolXmlCreation()
CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
xmlLocation = duplicateXMLFile;

Cache cache = CacheFactory.CreateCacheFactory()
var cache = new CacheFactory()
.Set("cache-xml-file", xmlLocation)
.Create();

Expand Down Expand Up @@ -293,7 +293,7 @@ public void runPoolXmlCreation()
duplicateXMLFile = Util.Rand(3432898).ToString() + "invalid_cache_pool.xml";
CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
xmlLocation = duplicateXMLFile;
cache = CacheFactory.CreateCacheFactory()
cache = new CacheFactory()
.Set("cache-xml-file", xmlLocation)
.Create();
Assert.Fail("invalid_cache_pool.xml did not throw exception");
Expand All @@ -310,7 +310,7 @@ public void runPoolXmlCreation()
duplicateXMLFile = Util.Rand(3432898).ToString() + "invalid_cache_pool2.xml";
CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
xmlLocation = duplicateXMLFile;
cache = CacheFactory.CreateCacheFactory()
cache = new CacheFactory()
.Set("cache-xml-file", xmlLocation)
.Create();
Assert.Fail("invalid_cache_pool2.xml did not throw exception");
Expand All @@ -327,7 +327,7 @@ public void runPoolXmlCreation()
duplicateXMLFile = "invalid_cache_pool3.xml";
CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
xmlLocation = duplicateXMLFile;
cache = CacheFactory.CreateCacheFactory()
cache = new CacheFactory()
.Set("cache-xml-file", xmlLocation)
.Create();
Assert.Fail("invalid_cache_pool3.xml did not throw exception");
Expand All @@ -344,7 +344,7 @@ public void runPoolXmlCreation()
duplicateXMLFile = Util.Rand(3432898).ToString() + "invalid_cache_pool4.xml";
CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
xmlLocation = duplicateXMLFile;
cache = CacheFactory.CreateCacheFactory()
cache = new CacheFactory()
.Set("cache-xml-file", xmlLocation)
.Create();
Assert.Fail("invalid_cache_pool4.xml did not throw exception");
Expand Down Expand Up @@ -407,7 +407,7 @@ public void testPoolAttrs(string poolName)
string duplicateXMLFile = Util.Rand(3432898).ToString() + "cacheserver_pool_client.xml";
CacheHelper.createDuplicateXMLFile(xmlFile, duplicateXMLFile);
xmlFile = duplicateXMLFile;
Properties<string, string> config = Properties<string, string>.Create<string, string>();
Properties<string, string> config = Properties<string, string>.Create();
config.Insert("cache-xml-file", xmlFile);
CacheHelper.InitConfig(config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public void VerifyUnicodeKeys(string regionName, bool updates)
public void CreateRegionsInterestNotify_Pool(string[] regionNames,
string locators, string poolName, bool notify, string nbs)
{
Properties<string, string> props = Properties<string, string>.Create<string, string>();
var props = Properties<string, string>.Create();
//props.Insert("notify-by-subscription-override", nbs);
CacheHelper.InitConfig(props);
CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
Expand Down
16 changes: 4 additions & 12 deletions clicache/src/CacheFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,14 @@ namespace Apache
using namespace msclr::interop;
namespace native = apache::geode::client;

CacheFactory^ CacheFactory::CreateCacheFactory()
CacheFactory::CacheFactory() :
CacheFactory(Properties<String^, String^>::Create())
{
return CacheFactory::CreateCacheFactory(Properties<String^, String^>::Create<String^, String^>());
}

CacheFactory^ CacheFactory::CreateCacheFactory(Properties<String^, String^>^ dsProps)
CacheFactory::CacheFactory(Properties<String^, String^>^ dsProps) :
CacheFactory(native::CacheFactory(dsProps->GetNative()), dsProps)
{
_GF_MG_EXCEPTION_TRY2

auto nativeCacheFactory = native::CacheFactory::createCacheFactory(dsProps->GetNative());
if (nativeCacheFactory)
return gcnew CacheFactory( nativeCacheFactory, dsProps );

return nullptr;

_GF_MG_EXCEPTION_CATCH_ALL2
}

Cache^ CacheFactory::Create()
Expand Down
27 changes: 8 additions & 19 deletions clicache/src/CacheFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
#include <geode/CacheFactory.hpp>
#include "end_native.hpp"

#include "native_shared_ptr.hpp"
#include "Properties.hpp"
#include "native_conditional_shared_ptr.hpp"
#include "IAuthInitialize.hpp"

using namespace System::Collections::Generic;
Expand Down Expand Up @@ -56,31 +55,20 @@ namespace Apache

/// <summary>
/// A factory class that must be used to obtain instance of <see cref="Cache" />.
/// This should be called once. Using this one can set default values of <see cref="Pool" />.
/// </summary>
/// <param name="dsProps">Properties which are applicable at client level.</param>
// static CacheFactory^ CreateCacheFactory(Dictionary<Object^, Object^>^ dsProps);
static CacheFactory^ CreateCacheFactory(Properties<String^, String^>^ dsProps);
CacheFactory(Properties<String^, String^>^ dsProps);

/// <summary>
/// A factory class that must be used to obtain instance of <see cref="Cache" />.
/// This should be called once. Using this one can set default values of <see cref="Pool" />.
/// </summary>
static CacheFactory^ CreateCacheFactory();
CacheFactory();

/// <summary>
/// To create the instance of <see cref="Cache" />.
/// </summary>
Cache^ Create();

/// <summary>
/// Set allocators for non default Microsoft CRT versions.
/// </summary>
/* static void SetNewAndDelete()
{
native::setNewAndDelete(&operator new, &operator delete);
}
*/
/// <summary>
/// Returns the version of the cache implementation.
/// For the 1.0 release of Geode, the string returned is <c>1.0</c>.
Expand Down Expand Up @@ -135,7 +123,7 @@ namespace Apache
/// <returns>
/// a instance of <c>CacheFactory</c>
/// </returns>
CacheFactory^ SetPdxReadSerialized(bool pdxReadSerialized);
CacheFactory^ SetPdxReadSerialized(bool pdxReadSerialized);


/// <summary>
Expand Down Expand Up @@ -170,17 +158,18 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
inline CacheFactory(std::shared_ptr<native::CacheFactory> nativeptr, Properties<String^, String^>^ dsProps)
inline CacheFactory(native::CacheFactory nativeptr, Properties<String^, String^>^ dsProps)
{
m_nativeptr = gcnew native_shared_ptr<native::CacheFactory>(nativeptr);
m_nativeptr = gcnew native_conditional_shared_ptr<native::CacheFactory>(
std::unique_ptr<native::CacheFactory>(new native::CacheFactory(nativeptr)));
m_dsProps = dsProps;
}

Properties<String^, String^>^ m_dsProps;

static System::Object^ m_singletonSync = gcnew System::Object();

native_shared_ptr<native::CacheFactory>^ m_nativeptr;
native_conditional_shared_ptr<native::CacheFactory>^ m_nativeptr;

};
} // namespace Client
Expand Down
Loading