Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
6c44a771
Commit
6c44a771
authored
Mar 11, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: ConnectionMultiplexer partials
parent
8748d222
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
ConnectionMultiplexer.Profiling.cs
...is/StackExchange/Redis/ConnectionMultiplexer.Profiling.cs
+8
-6
ConnectionMultiplexer.ReaderWriter.cs
...StackExchange/Redis/ConnectionMultiplexer.ReaderWriter.cs
+2
-1
No files found.
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.Profiling.cs
View file @
6c44a771
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
StackExchange.Redis
namespace
StackExchange.Redis
{
{
partial
class
ConnectionMultiplexer
p
ublic
p
artial
class
ConnectionMultiplexer
{
{
private
IProfiler
profiler
;
private
IProfiler
profiler
;
...
@@ -16,13 +16,13 @@ partial class ConnectionMultiplexer
...
@@ -16,13 +16,13 @@ partial class ConnectionMultiplexer
/// IProfiledCommand with. See BeginProfiling(object) and FinishProfiling(object)
/// IProfiledCommand with. See BeginProfiling(object) and FinishProfiling(object)
/// for more details.
/// for more details.
/// </summary>
/// </summary>
/// <param name="profiler">The profiler to register.</param>
public
void
RegisterProfiler
(
IProfiler
profiler
)
public
void
RegisterProfiler
(
IProfiler
profiler
)
{
{
if
(
profiler
==
null
)
throw
new
ArgumentNullException
(
nameof
(
profiler
));
if
(
this
.
profiler
!=
null
)
throw
new
InvalidOperationException
(
"IProfiler already registered for this ConnectionMultiplexer"
);
if
(
this
.
profiler
!=
null
)
throw
new
InvalidOperationException
(
"IProfiler already registered for this ConnectionMultiplexer"
);
this
.
profiler
=
profiler
;
this
.
profiler
=
profiler
??
throw
new
ArgumentNullException
(
nameof
(
profiler
))
;
this
.
profiledCommands
=
new
ProfileContextTracker
();
profiledCommands
=
new
ProfileContextTracker
();
}
}
/// <summary>
/// <summary>
...
@@ -35,6 +35,7 @@ public void RegisterProfiler(IProfiler profiler)
...
@@ -35,6 +35,7 @@ public void RegisterProfiler(IProfiler profiler)
///
///
/// Note that forContext cannot be a WeakReference or a WeakReference<T>
/// Note that forContext cannot be a WeakReference or a WeakReference<T>
/// </summary>
/// </summary>
/// <param name="forContext">The context to begin profiling.</param>
public
void
BeginProfiling
(
object
forContext
)
public
void
BeginProfiling
(
object
forContext
)
{
{
if
(
profiler
==
null
)
throw
new
InvalidOperationException
(
"Cannot begin profiling if no IProfiler has been registered with RegisterProfiler"
);
if
(
profiler
==
null
)
throw
new
InvalidOperationException
(
"Cannot begin profiling if no IProfiler has been registered with RegisterProfiler"
);
...
@@ -52,13 +53,14 @@ public void BeginProfiling(object forContext)
...
@@ -52,13 +53,14 @@ public void BeginProfiling(object forContext)
///
///
/// By default this may do a sweep for dead profiling contexts, you can disable this by passing "allowCleanupSweep: false".
/// By default this may do a sweep for dead profiling contexts, you can disable this by passing "allowCleanupSweep: false".
/// </summary>
/// </summary>
/// <param name="forContext">The context to begin profiling.</param>
/// <param name="allowCleanupSweep">Whether to allow cleanup of old profiling sessions.</param>
public
ProfiledCommandEnumerable
FinishProfiling
(
object
forContext
,
bool
allowCleanupSweep
=
true
)
public
ProfiledCommandEnumerable
FinishProfiling
(
object
forContext
,
bool
allowCleanupSweep
=
true
)
{
{
if
(
profiler
==
null
)
throw
new
InvalidOperationException
(
"Cannot begin profiling if no IProfiler has been registered with RegisterProfiler"
);
if
(
profiler
==
null
)
throw
new
InvalidOperationException
(
"Cannot begin profiling if no IProfiler has been registered with RegisterProfiler"
);
if
(
forContext
==
null
)
throw
new
ArgumentNullException
(
nameof
(
forContext
));
if
(
forContext
==
null
)
throw
new
ArgumentNullException
(
nameof
(
forContext
));
ProfiledCommandEnumerable
ret
;
if
(!
profiledCommands
.
TryRemove
(
forContext
,
out
ProfiledCommandEnumerable
ret
))
if
(!
profiledCommands
.
TryRemove
(
forContext
,
out
ret
))
{
{
throw
ExceptionFactory
.
FinishedProfilingWithInvalidContext
(
forContext
);
throw
ExceptionFactory
.
FinishedProfilingWithInvalidContext
(
forContext
);
}
}
...
...
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.ReaderWriter.cs
View file @
6c44a771
namespace
StackExchange.Redis
namespace
StackExchange.Redis
{
{
partial
class
ConnectionMultiplexer
p
ublic
p
artial
class
ConnectionMultiplexer
{
{
internal
SocketManager
SocketManager
=>
socketManager
;
internal
SocketManager
SocketManager
=>
socketManager
;
...
@@ -29,6 +29,7 @@ internal void RequestWrite(PhysicalBridge bridge, bool forced)
...
@@ -29,6 +29,7 @@ internal void RequestWrite(PhysicalBridge bridge, bool forced)
tmp
.
RequestWrite
(
bridge
,
forced
);
tmp
.
RequestWrite
(
bridge
,
forced
);
}
}
}
}
partial
void
OnWriterCreated
();
partial
void
OnWriterCreated
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment