Skip to content

Commit e5d8573

Browse files
Extract methods
To be more consistent with the rest of the method handling code.
1 parent 1a9cefc commit e5d8573

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

projects/client/RabbitMQ.Client/src/client/impl/ConnectionBase.cs

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,13 @@ public void PrettyPrintShutdownReport()
899899

900900
public void HandleConnectionBlocked(string reason)
901901
{
902-
ConnectionBlockedEventHandler handler;
903902
ConnectionBlockedEventArgs args = new ConnectionBlockedEventArgs(reason);
903+
OnConnectionBlocked(args);
904+
}
905+
906+
public void OnConnectionBlocked(ConnectionBlockedEventArgs args)
907+
{
908+
ConnectionBlockedEventHandler handler;
904909
lock (m_eventLock)
905910
{
906911
handler = m_connectionBlocked;
@@ -919,27 +924,33 @@ public void HandleConnectionBlocked(string reason)
919924
}
920925
}
921926

927+
922928
public void HandleConnectionUnblocked()
923929
{
924-
ConnectionUnblockedEventHandler handler;
925-
lock (m_eventLock)
926-
{
927-
handler = m_connectionUnblocked;
928-
}
929-
if (handler != null)
930-
{
931-
foreach (ConnectionUnblockedEventHandler h in handler.GetInvocationList()) {
932-
try {
933-
h(this);
934-
} catch (Exception e) {
935-
CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
936-
args.Detail["context"] = "OnConnectionUnblocked";
937-
OnCallbackException(args);
938-
}
939-
}
940-
}
930+
OnConnectionUnblocked();
941931
}
942932

933+
public void OnConnectionUnblocked()
934+
{
935+
ConnectionUnblockedEventHandler handler;
936+
lock (m_eventLock)
937+
{
938+
handler = m_connectionUnblocked;
939+
}
940+
if (handler != null)
941+
{
942+
foreach (ConnectionUnblockedEventHandler h in handler.GetInvocationList()) {
943+
try {
944+
h(this);
945+
} catch (Exception e) {
946+
CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
947+
args.Detail["context"] = "OnConnectionUnblocked";
948+
OnCallbackException(args);
949+
}
950+
}
951+
}
952+
}
953+
943954
///<summary>Broadcasts notification of the final shutdown of the connection.</summary>
944955
public void OnShutdown()
945956
{

0 commit comments

Comments
 (0)