Skip to content

Instantly share code, notes, and snippets.

As noted in various Service Broker sources, it is often advantageous to minimize the overhead of creating dialogs to send messages on. This blog shows how to create a shared pool of dialogs to be able to reuse dialogs instead of creating new ones. The dialog pool is a variation of Remus Rusanu's reusing and recycling conversations as shown in his blog. One of the main differences is that the dialog pool is keyed only on services and contract, not SPID. This allows the same SPID to obtain multiple dialogs from the pool should the need arise. As importantly, different SPIDs can reuse the same dialog sequentially instead of creating two of them. Measurements show equivalent performance using the dialog pool compared to the SPID-based reuse scheme.
The following code shows how to get, free and delete dialogs from a dialog pool table. Initially empty, a new dialog is created in the pool when a request for an existing free dialog cannot be met. Thus the pool will grow during bursts of high demand.
The dialog poo
System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.
---> System.Data.SqlClient.SqlException: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
---> System.ComponentModel.Win32Exception: The wait operation timed out
--- End of inner exception stack trace ---
at void System.Data.SqlClient.SqlConnection.OnError(SqlException exception, bool breakConnection, Action<Action> wrapCloseInAction)
at void System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, bool callerHasConnectionLock, bool asyncClose)
at bool System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, out bool dataReady)
at bool System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at _
AAA
About
Access
ACRE
ACT
Acts
Adapt
Adjust
Affinity
Text
EscapeSF
1AM
Gagosian
FraenkelLAB
ArtSeed
sfclayworks
Arthaus
Goforaloop
Venezia
asking for a cab
calling for a cab
can i find
can i find a cab
/* "can I get" is extremely common but feels dangerous even with all the two letter words in - "can I get top cuts" */
can i get a cab
can i have a cab
can i please get a cab
can i please have
can i please have a cab
4th Street
4th St
Alana Way
Alana Way, California, USA
Alta Vista Terrace
Alta Vista Terrace, Fremont, CA 94539, USA
Alvord Street
for /d /r . %%d in (bin,obj,csx,App_Data,packages) do @if exist "%%d" rd /s/q "%%d"
Option Explicit
Dim objWMIService, objProcess, colProcess, fileSystemObject, shell
Dim strComputer, strList, folder, f
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
tfpt unshelve /migrate /source:"$/VendorGraph/VendorGraph_v2.7" /target:"$/VendorGraph/FeatureBranches/Luis" "Luis"
// Adapted from http://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode
namespace Utilities
{
public struct HashCode
{
private readonly int hashCode;
private HashCode(int hashCode)
{
this.hashCode = hashCode;