Skip to content

Commit 9e3a841

Browse files
graham-macmasternayato
authored andcommitted
Convert javadoc to C# xmldoc in the DotNetty.Common project (Azure#395)
This is a progressive commit towards completing Azure#386. No code changes have been made, only changes to comments. These changes to comments include: - Transforming {@link Symbol} occurrences to <see cref="Symbol"/> - Updating Java example code in comments with C# equivalents - Translating/removing comments that do not apply to .NET generally - Removing Netty-specific comments that do not yet apply to this port - Various grammar and typo corrections
1 parent 59f18f2 commit 9e3a841

19 files changed

+341
-293
lines changed

src/DotNetty.Common/Concurrency/SingleThreadEventExecutor.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ protected void WakeUp(bool inEventLoop)
147147
this.Execute(WAKEUP_TASK);
148148
}
149149
}
150-
151-
/**
152-
* Add a {@link Runnable} which will be executed on shutdown of this instance
153-
*/
150+
151+
/// <summary>
152+
/// Adds an <see cref="Action"/> which will be executed on shutdown of this instance.
153+
/// </summary>
154+
/// <param name="action">The <see cref="Action"/> to run on shutdown.</param>
154155
public void AddShutdownHook(Action action)
155156
{
156157
if (this.InEventLoop)
@@ -163,9 +164,11 @@ public void AddShutdownHook(Action action)
163164
}
164165
}
165166

166-
/**
167-
* Remove a previous added {@link Runnable} as a shutdown hook
168-
*/
167+
/// <summary>
168+
/// Removes a previously added <see cref="Action"/> from the collection of <see cref="Action"/>s which will be
169+
/// executed on shutdown of this instance.
170+
/// </summary>
171+
/// <param name="action">The <see cref="Action"/> to remove.</param>
169172
public void RemoveShutdownHook(Action action)
170173
{
171174
if (this.InEventLoop)

src/DotNetty.Common/FastThreadLocal.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public abstract class FastThreadLocal
1111
static readonly int VariablesToRemoveIndex = InternalThreadLocalMap.NextVariableIndex();
1212

1313
/// <summary>
14-
/// Removes all {@link FastThreadLocal} variables bound to the current thread. This operation is useful when you
14+
/// Removes all <see cref="FastThreadLocal"/> variables bound to the current thread. This operation is useful when you
1515
/// are in a container environment, and you don't want to leave the thread local variables in the threads you do not
1616
/// manage.
1717
/// </summary>
@@ -41,10 +41,12 @@ public static void RemoveAll()
4141
}
4242
}
4343

44-
/// Destroys the data structure that keeps all {@link FastThreadLocal} variables accessed from
45-
/// non-{@link FastThreadLocalThread}s. This operation is useful when you are in a container environment, and you
46-
/// do not want to leave the thread local variables in the threads you do not manage. Call this method when your
47-
/// application is being unloaded from the container.
44+
/// <summary>
45+
/// Destroys the data structure that keeps all <see cref="FastThreadLocal"/> variables accessed from
46+
/// non-<see cref="FastThreadLocal"/>s. This operation is useful when you are in a container environment, and
47+
/// you do not want to leave the thread local variables in the threads you do not manage. Call this method when
48+
/// your application is being unloaded from the container.
49+
/// </summary>
4850
public static void Destroy() => InternalThreadLocalMap.Destroy();
4951

5052
protected static void AddToVariablesToRemove(InternalThreadLocalMap threadLocalMap, FastThreadLocal variable)
@@ -135,7 +137,7 @@ T Initialize(InternalThreadLocalMap threadLocalMap)
135137
}
136138

137139
/// <summary>
138-
/// Set the value for the specified thread local map. The specified thread local map must be for the current thread.
140+
/// Set the value for the specified thread local map. The specified thread local map must be for the current thread.
139141
/// </summary>
140142
[MethodImpl(MethodImplOptions.AggressiveInlining)]
141143
public void Set(InternalThreadLocalMap threadLocalMap, T value)
@@ -147,27 +149,32 @@ public void Set(InternalThreadLocalMap threadLocalMap, T value)
147149
}
148150

149151
/// <summary>
150-
/// Returns {@code true} if and only if this thread-local variable is set.
152+
/// Returns <c>true</c> if and only if this thread-local variable is set.
151153
/// </summary>
152154
public bool IsSet() => this.IsSet(InternalThreadLocalMap.GetIfSet());
153155

154156
/// <summary>
155-
/// Returns {@code true} if and only if this thread-local variable is set.
156-
/// The specified thread local map must be for the current thread.
157+
/// Returns <c>true</c> if and only if this thread-local variable is set.
158+
/// The specified thread local map must be for the current thread.
157159
/// </summary>
158160
[MethodImpl(MethodImplOptions.AggressiveInlining)]
159161
public bool IsSet(InternalThreadLocalMap threadLocalMap) => threadLocalMap != null && threadLocalMap.IsIndexedVariableSet(this.index);
160162

161163
/// <summary>
162-
/// Returns the initial value for this thread-local variable.
164+
/// Returns the initial value for this thread-local variable.
163165
/// </summary>
164166
protected virtual T GetInitialValue() => null;
165167

166168
public void Remove() => this.Remove(InternalThreadLocalMap.GetIfSet());
167169

170+
/// <summary>
168171
/// Sets the value to uninitialized for the specified thread local map;
169-
/// a proceeding call to get() will trigger a call to GetInitialValue().
172+
/// a proceeding call to <see cref="Get"/> will trigger a call to <see cref="GetInitialValue"/>.
170173
/// The specified thread local map must be for the current thread.
174+
/// </summary>
175+
/// <param name="threadLocalMap">
176+
/// The <see cref="InternalThreadLocalMap"/> from which this <see cref="FastThreadLocal"/> should be removed.
177+
/// </param>
171178
[MethodImpl(MethodImplOptions.AggressiveInlining)]
172179
public sealed override void Remove(InternalThreadLocalMap threadLocalMap)
173180
{
@@ -186,7 +193,7 @@ public sealed override void Remove(InternalThreadLocalMap threadLocalMap)
186193
}
187194

188195
/// <summary>
189-
/// Invoked when this thread local variable is removed by {@link #remove()}.
196+
/// Invoked when this thread local variable is removed by <see cref="Remove()"/>.
190197
/// </summary>
191198
protected virtual void OnRemoval(T value)
192199
{

src/DotNetty.Common/Internal/AppendableCharSequence.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ public IAppendable Append(ICharSequence sequence, int start, int end)
176176
return this;
177177
}
178178

179-
// Reset the {@link AppendableCharSequence}. Be aware this will only reset the current internal position and not
180-
// shrink the internal char array.
179+
/// <summary>
180+
/// Resets the <see cref="AppendableCharSequence"/>. Be aware this will only reset the current internal
181+
/// position and not shrink the internal char array.
182+
/// </summary>
181183
public void Reset() => this.pos = 0;
182184

183185
public string ToString(int start)
@@ -190,8 +192,10 @@ public string ToString(int start)
190192

191193
public AsciiString ToAsciiString() => this.pos == 0 ? AsciiString.Empty : new AsciiString(this.chars, 0, this.pos, true);
192194

193-
// Create a new ascii string, this method assumes all chars has been sanitized
194-
// to ascii chars when appending to the array
195+
/// <summary>
196+
/// Create a new ascii string, this method assumes all chars has been sanitized to ascii chars when appending
197+
/// to the array.
198+
/// </summary>
195199
[MethodImpl(MethodImplOptions.AggressiveInlining)]
196200
public unsafe AsciiString SubStringUnsafe(int start, int end)
197201
{

src/DotNetty.Common/Internal/ConcurrentCircularArrayQueue.cs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,39 @@ protected ConcurrentCircularArrayQueue(int capacity)
3434
this.Buffer = new T[actualCapacity + RefArrayAccessUtil.RefBufferPad * 2];
3535
}
3636

37-
/// @param index desirable element index
38-
/// @return the offset in bytes within the array for a given index.
37+
/// <summary>
38+
/// Calculates an element offset based on a given array index.
39+
/// </summary>
40+
/// <param name="index">The desirable element index.</param>
41+
/// <returns>The offset in bytes within the array for a given index.</returns>
3942
protected long CalcElementOffset(long index) => RefArrayAccessUtil.CalcElementOffset(index, this.Mask);
4043

41-
/// A plain store (no ordering/fences) of an element to a given offset
42-
/// @param offset computed via {@link ConcurrentCircularArrayQueue#calcElementOffset(long)}
43-
/// @param e a kitty
44+
/// <summary>
45+
/// A plain store (no ordering/fences) of an element to a given offset.
46+
/// </summary>
47+
/// <param name="offset">Computed via <see cref="CalcElementOffset"/>.</param>
48+
/// <param name="e">A kitty.</param>
4449
protected void SpElement(long offset, T e) => RefArrayAccessUtil.SpElement(this.Buffer, offset, e);
4550

46-
/// An ordered store(store + StoreStore barrier) of an element to a given offset
47-
/// @param offset computed via {@link ConcurrentCircularArrayQueue#calcElementOffset(long)}
48-
/// @param e an orderly kitty
51+
/// <summary>
52+
/// An ordered store(store + StoreStore barrier) of an element to a given offset.
53+
/// </summary>
54+
/// <param name="offset">Computed via <see cref="CalcElementOffset"/>.</param>
55+
/// <param name="e">An orderly kitty.</param>
4956
protected void SoElement(long offset, T e) => RefArrayAccessUtil.SoElement(this.Buffer, offset, e);
5057

58+
/// <summary>
5159
/// A plain load (no ordering/fences) of an element from a given offset.
52-
/// @param offset computed via {@link ConcurrentCircularArrayQueue#calcElementOffset(long)}
53-
/// @return the element at the offset
60+
/// </summary>
61+
/// <param name="offset">Computed via <see cref="CalcElementOffset"/>.</param>
62+
/// <returns>The element at the offset.</returns>
5463
protected T LpElement(long offset) => RefArrayAccessUtil.LpElement(this.Buffer, offset);
5564

65+
/// <summary>
5666
/// A volatile load (load + LoadLoad barrier) of an element from a given offset.
57-
/// @param offset computed via {@link ConcurrentCircularArrayQueue#calcElementOffset(long)}
58-
/// @return the element at the offset
67+
/// </summary>
68+
/// <param name="offset">Computed via <see cref="CalcElementOffset"/>.</param>
69+
/// <returns>The element at the offset.</returns>
5970
protected T LvElement(long offset) => RefArrayAccessUtil.LvElement(this.Buffer, offset);
6071

6172
public override void Clear()

src/DotNetty.Common/Internal/Logging/AbstractInternalLogger.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ namespace DotNetty.Common.Internal.Logging
77
using System.Diagnostics.Contracts;
88

99
/// <summary>
10-
/// A skeletal implementation of {@link IInternalLogger}. This class implements
11-
/// all methods that have a { @link InternalLogLevel } parameter by default to call
12-
/// specific logger methods such as {@link #Info(String)} or {@link #isInfoEnabled()}.
10+
/// A skeletal implementation of <see cref="IInternalLogger"/>. This class implements
11+
/// all methods that have a <see cref="InternalLogLevel"/> parameter by default to call
12+
/// specific logger methods such as <see cref="Info(string)"/> or <see cref="InfoEnabled"/>.
1313
/// </summary>
1414
public abstract class AbstractInternalLogger : IInternalLogger
1515
{
1616
static readonly string EXCEPTION_MESSAGE = "Unexpected exception:";
1717

1818
/// <summary>
19-
/// Creates a new instance.
19+
/// Creates a new instance.
2020
/// </summary>
21-
/// <param name="name"></param>
21+
/// <param name="name">A friendly name for the new logger instance.</param>
2222
protected AbstractInternalLogger(string name)
2323
{
2424
Contract.Requires(name != null);

src/DotNetty.Common/Internal/Logging/FormattingTuple.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace DotNetty.Common.Internal.Logging
77
using System.Diagnostics.Contracts;
88

99
/// <summary>
10-
/// Holds the results of formatting done by {@link MessageFormatter}.
10+
/// Holds the results of formatting done by <see cref="MessageFormatter"/>.
1111
/// </summary>
1212
public struct FormattingTuple
1313
{

0 commit comments

Comments
 (0)