Skip to content

Commit e6eeced

Browse files
committed
fix merge conflicts
2 parents cfe51bf + d98f5bf commit e6eeced

File tree

91 files changed

+3097
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3097
-467
lines changed

.github/workflows/build.yml

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ jobs:
3838
- name: Checkout
3939
uses: actions/checkout@v2
4040

41+
# Clean
42+
- name: Clean
43+
run: dotnet nuget locals all --clear
44+
4145
# Build
4246
- name: Build
4347
run: |

README.md

+191-10
Original file line numberDiff line numberDiff line change
@@ -152,27 +152,203 @@ command:
152152
```
153153
msbuild /t:clean Coherence.msbuild
154154
```
155-
The
155+
156156
# <a name="started"></a>CLI Hello Coherence Example
157-
Note: You can skipt this section for now till the Hello Coherence console example is available.
158-
## Build the example
159-
The Hello Coherence example is in the examples\Hello directory.
157+
The following example illustrates starting a storage enabled Coherence server, followed by running the HelloCoherence console application. The HelloCoherence application inserts and retrieves data from the Coherence server.
158+
159+
## Build HelloCoherence
160+
1. Using dotnet-cli to create a HelloCoherence console application:
161+
```
162+
dotnet new console -name "HelloCoherence"
163+
```
164+
1. Add the following references to the HelloCoherence.csproj (provide the Coherence.Core.dll location in the `<HintPath>`):
165+
```
166+
<ItemGroup>
167+
<Reference Include="Coherence.Core, Version=14.1.1.4, Culture=neutral, PublicKeyToken=0ada89708fdf1f9a, processorArchitecture=MSIL">
168+
<HintPath>Coherence.Core.dll</HintPath>
169+
</Reference>
170+
<PackageReference Include="Common.Logging" Version="3.4.1" />
171+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
172+
</ItemGroup>
173+
```
174+
Also include any Coherence configuration files you may have.
175+
176+
1. Replace Program.cs code with the following source:
177+
```
178+
/*
179+
* Copyright (c) 2000, 2022, Oracle and/or its affiliates.
180+
*
181+
* Licensed under the Universal Permissive License v 1.0 as shown at
182+
* http://oss.oracle.com/licenses/upl.
183+
*/
184+
using System;
185+
using Tangosol.Net;
186+
using Tangosol.Net.Cache;
187+
using Tangosol.Run.Xml;
188+
namespace Hello
189+
{
190+
class Program
191+
{
192+
static void Main(string[] args)
193+
{
194+
// Display title as the C# console Coherence app and
195+
// show user the valid commands:
196+
Console.WriteLine("Coherence for .NET Extend Client");
197+
Console.WriteLine("The following are the available cache operations:");
198+
Console.WriteLine("\tcache <cacheName> - specify a cache name to use");
199+
Console.WriteLine("\tput <key> <value> - put a <key, value> pair into the cache");
200+
Console.WriteLine("\tget <key> - get the value of a given key from the cache");
201+
Console.WriteLine("\tremove <key> - remove an entry of the given key from the cache");
202+
Console.WriteLine("\tlist - list all the entries in the cache");
203+
Console.WriteLine("\tsize - get the size of the cache");
204+
Console.WriteLine("\tbye - exit the console");
205+
Console.WriteLine();
206+
Console.Write("Map (?): ");
207+
208+
// Declare variabs.
209+
String cacheName = null;
210+
INamedCache namedCache = null;
211+
String op = Console.ReadLine().ToLower();
212+
String[] opList = op.Split();
213+
214+
// Processing cache operations.
215+
while (opList[0].CompareTo("bye") != 0)
216+
{
217+
String key;
218+
String value;
219+
220+
if (!opList[0].Equals("cache") && namedCache == null)
221+
{
222+
Console.WriteLine("No named cache. Please specify a named cache to use.");
223+
}
224+
else
225+
{
226+
switch (opList[0])
227+
{
228+
case "cache":
229+
if (opList.Length < 2)
230+
{
231+
Console.WriteLine("No cache name. Please specify a cache name to use.");
232+
}
233+
else
234+
{
235+
cacheName = opList[1];
236+
namedCache = CacheFactory.GetCache(cacheName);
237+
}
238+
break;
239+
240+
case "put":
241+
if (opList.Length < 3)
242+
{
243+
Console.WriteLine("No key/value pair. Please specify the key and value to be put into the cache.");
244+
}
245+
else
246+
{
247+
key = opList[1];
248+
value = opList[2];
249+
namedCache[key] = value;
250+
}
251+
break;
252+
253+
case "get":
254+
if (opList.Length < 2)
255+
{
256+
Console.WriteLine("No key. Please specify the key to get.");
257+
}
258+
else
259+
{
260+
key = opList[1];
261+
var result = namedCache[key];
262+
Console.WriteLine(result == null ? "NULL" : namedCache[key]);
263+
}
264+
break;
265+
266+
case "remove":
267+
if (opList.Length < 2)
268+
{
269+
Console.WriteLine("No key. Please specify the key to remove.");
270+
}
271+
else
272+
{
273+
key = opList[1];
274+
namedCache.Remove(key);
275+
}
276+
break;
277+
278+
case "list":
279+
foreach (ICacheEntry entry in namedCache.Entries)
280+
{
281+
Console.WriteLine(entry.Key + " = " + entry.Value);
282+
}
283+
break;
284+
285+
case "size":
286+
Console.WriteLine(namedCache.Count);
287+
break;
288+
289+
default:
290+
Console.WriteLine("Valid operations are: cache, put, get, remove, list, size, and bye.");
291+
break;
292+
}
293+
}
294+
295+
Console.WriteLine("");
296+
if (namedCache == null)
297+
{
298+
Console.Write("Map (?): ");
299+
}
300+
else
301+
{
302+
Console.Write("Map (" + cacheName + "): ");
303+
}
304+
305+
// Read cache operation
306+
op = Console.ReadLine().ToLower();
307+
opList = op.Split();
308+
}
309+
}
310+
}
311+
}
312+
```
313+
314+
By default, you need to provide a POF configure file, pof-config.xml, in the TargetFramework directory. Below are a sample pof-config.xml file:
315+
316+
```
317+
<?xml version="1.0"?>
318+
<!--
319+
Copyright (c) 2000, 2020, Oracle and/or its affiliates.
320+
321+
Licensed under the Universal Permissive License v 1.0 as shown at
322+
http://oss.oracle.com/licenses/upl.
323+
-->
324+
<pof-config xmlns="http://schemas.tangosol.com/pof">
325+
<user-type-list>
326+
<!-- include all "standard" Coherence POF user types -->
327+
<include>assembly://Coherence.Core/Tangosol.Config/coherence-pof-config.xml</include>
328+
329+
<!-- include all application POF user types -->
330+
</user-type-list>
331+
</pof-config>
160332
```
161-
cd examples\Hello
162-
msbuild /t:clean /t:build
333+
334+
4. Build the HelloCoherence project
335+
```
336+
dotnet build
163337
```
164338

165339
## Start a Coherence server
166340

167341
```
168-
"%JAVA_HOME%\bin\java" -Dcoherence.pof.enabled=true -Dcoherence.cacheconfig=Resources\server-cache-config.xml -jar coherence.jar
342+
"%JAVA_HOME%\bin\java" -Dcoherence.pof.enabled=true -Dcoherence.log.level=9 -jar coherence.jar
169343
```
170344

171345
## Run the Hello Coherence example
172346

173347
```shell script
174-
cd examples\Hello\Hello\bin\Debug
175-
Hello.exe
348+
dotnet run
349+
```
350+
351+
```
176352
Coherence for .NET Extend Client
177353
The following are the available cache operations:
178354
cache <cacheName> - specify a cache name to use
@@ -203,8 +379,13 @@ english = Hello
203379
spanish = Hola
204380
205381
Map (welcomes): bye
382+
```
206383

207-
Hello.exe
384+
```
385+
dotnet run
386+
```
387+
388+
```
208389
Coherence for .NET Extend Client
209390
The following are the available cache operations:
210391
cache <cacheName> - specify a cache name to use

src/Coherence.Core/Config/cache-config.xsd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<!--
3-
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
3+
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
44
55
Licensed under the Universal Permissive License v 1.0 as shown at
66
http://oss.oracle.com/licenses/upl.
@@ -13,7 +13,7 @@
1313

1414
<xs:annotation>
1515
<xs:documentation>
16-
Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
16+
Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
1717

1818
Oracle is a registered trademarks of Oracle Corporation and/or its affiliates.
1919

src/Coherence.Core/Config/coherence.xsd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<!--
3-
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
3+
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
44
55
Licensed under the Universal Permissive License v 1.0 as shown at
66
http://oss.oracle.com/licenses/upl.
@@ -13,7 +13,7 @@
1313

1414
<xs:annotation>
1515
<xs:documentation>
16-
Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
16+
Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
1717

1818
Oracle is a registered trademarks of Oracle Corporation and/or its affiliates.
1919
This software is the confidential and proprietary information of

src/Coherence.Core/Config/pof-config.xsd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<!--
3-
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
3+
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
44
55
Licensed under the Universal Permissive License v 1.0 as shown at
66
http://oss.oracle.com/licenses/upl.
@@ -13,7 +13,7 @@
1313

1414
<xs:annotation>
1515
<xs:documentation>
16-
Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
16+
Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
1717

1818
Oracle is a registered trademarks of Oracle Corporation and/or its affiliates.
1919

src/Coherence.Core/IO/IndentingWriter.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public override Encoding Encoding
9191
/// </param>
9292
public override void Write(char value)
9393
{
94-
lock (this)
94+
using (BlockingLock l = BlockingLock.Lock(this))
9595
{
9696
if (value == '\n')
9797
{
@@ -118,7 +118,7 @@ public override void Write(char value)
118118
/// </param>
119119
public override void Write(char[] buffer)
120120
{
121-
lock (this)
121+
using (BlockingLock l = BlockingLock.Lock(this))
122122
{
123123
if (buffer != null)
124124
{
@@ -141,7 +141,7 @@ public override void Write(char[] buffer)
141141
/// </param>
142142
public override void Write(char[] buffer, int index, int count)
143143
{
144-
lock (this)
144+
using (BlockingLock l = BlockingLock.Lock(this))
145145
{
146146
for (int i = 0; i < count; ++i)
147147
{
@@ -158,7 +158,7 @@ public override void Write(char[] buffer, int index, int count)
158158
/// </param>
159159
public override void Write(string value)
160160
{
161-
lock (this)
161+
using (BlockingLock l = BlockingLock.Lock(this))
162162
{
163163
Write(value.ToCharArray());
164164
}

src/Coherence.Core/IO/Pof/ConfigurablePofContext.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ public virtual IXmlElement Config
434434
}
435435
set
436436
{
437-
lock (this)
437+
using (BlockingLock l = BlockingLock.Lock(this))
438438
{
439439
if (value != null && !XmlHelper.IsEmpty(value))
440440
{
@@ -858,7 +858,7 @@ protected virtual int GetInheritedUserTypeIdentifier(Type type)
858858

859859
// update the mapping so that we don't have to
860860
// brute-force search again
861-
lock (this)
861+
using (BlockingLock l = BlockingLock.Lock(this))
862862
{
863863
mapTypeIdByType = m_cfg.m_mapTypeIdByType;
864864
if (!mapTypeIdByType.Contains(type))
@@ -889,7 +889,7 @@ protected virtual int GetInheritedUserTypeIdentifier(Type type)
889889

890890
// update the mapping so that we don't have to
891891
// brute-force search again
892-
lock (this)
892+
using (BlockingLock l = BlockingLock.Lock(this))
893893
{
894894
mapTypeIdByType = m_cfg.m_mapTypeIdByType;
895895
if (!mapTypeIdByType.Contains(type))
@@ -906,7 +906,7 @@ protected virtual int GetInheritedUserTypeIdentifier(Type type)
906906

907907
// update the mapping with the miss so that we don't have to
908908
// brute-force search again
909-
lock (this)
909+
using (BlockingLock l = BlockingLock.Lock(this))
910910
{
911911
mapTypeIdByType = m_cfg.m_mapTypeIdByType;
912912
if (!mapTypeIdByType.Contains(type))
@@ -956,7 +956,7 @@ protected virtual int GetUserTypeIdentifierInternal(string typeName)
956956
typeId = GetUserTypeIdentifierInternal(TypeResolver.Resolve(typeName));
957957
if (typeId >= 0)
958958
{
959-
lock (this)
959+
using (BlockingLock l = BlockingLock.Lock(this))
960960
{
961961
mapTypeIdByTypeName = m_cfg.m_mapTypeIdByTypeName;
962962
if (!mapTypeIdByTypeName.Contains(typeName))
@@ -1007,15 +1007,15 @@ protected internal virtual void EnsureInitialized()
10071007
/// </summary>
10081008
protected internal virtual void Initialize()
10091009
{
1010-
lock (this)
1010+
using (BlockingLock l = BlockingLock.Lock(this))
10111011
{
10121012
if (m_cfg == null)
10131013
{
10141014
// dereference by URI
10151015
IDictionary mapConfigByUri = m_mapConfigByUri;
10161016
PofConfig cfg;
10171017

1018-
lock(mapConfigByUri.SyncRoot)
1018+
using (BlockingLock l2 = BlockingLock.Lock(mapConfigByUri.SyncRoot))
10191019
{
10201020
if (m_configFile == null)
10211021
{

0 commit comments

Comments
 (0)