.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Concurrency and instance modes

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :WCF

i just need a little clarification on something real quick if someone has a few moments..

i have a service which utilizes a singleton instance because i utilize async callbacks (subscription list etc). it's also set to use multithreading because of some of the operations the service needs to perform.

at the moment i only have 1 middleware client, another service which is multithreaded to handle multiple web clients which acts as a 'proxy' to my service.

i know that right now there will only be 1 instance, but with multiple concurrent calls. keeping in line with the architecture above, does each call made come in on the same thread, same instance or different thread same instance? and if it is the same thread, doesn't it strike anyone as odd that i would need to bottleneck each call by locking it?

second thought: the per-call semantics are what i'd like to use, however then everything is just instanced out and messes up the callbacks, right?

ideally, what i'd like is to use the same instance, but have it automatically create a new thread on each call so that i don't have to lock.. or is that what it does and i'm not understanding correctly? 

please advise?

View Complete Post

More Related Resource Links

How to turn off optimistic concurrency checking?


I have run into a problem with optimistic concurrency in my dynamic data application (where all relevant settings are at their default values); when I try to update or delete one of my tables, I see the following error:

 Exception type: ChangeConflictException
 Exception message: Row not found or changed.

I am the only user of my database at the moment, so I can guarantee that the data both exists and has not been changed outside the application!

Various forums have suggested that the way to deal with this is to set the column attributes so that the concurrency checking is disabled; i.e.

[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PropSurname", DbType="NVarChar(255)", UpdateCheck=UpdateCheck.Never)]

However, to do this manually through the Visual Studio designer will take me hours (I have a lot of tables) and if I then change the schema of one of the tables in the DB, won't I then have to do it all again?  I've tried editing the .designer.cs file directly but my changes are subsequently overwritten (as expected).

All suggestions gratefully received!

Ed Graham

Activation error occured while trying to get instance of type Database, key "DBName"


Im using Enterprise library 5.0
I have a scenario, where I have to access two different databases in my application.

Basically this application is a webservice,delployed on my local for testing purpose.
I'm trying to access this web method from diffent windows application, default connection works fine but the other database throw's exception.

Problem is only my defaultDatabase is works fine, if I change defaultDatabase="MYCON1" with "MYCON2" it works fine, if I try to access the other database which is not default, throws exception.

<dataConfiguration defaultDatabase="MYCON1" />
<add name="MYCON1" connectionString="Data Source=server1;Initial Catalog=dbName1;User Id=Username1;Password=password1;"

" />
<add name="MYCON2" connectionString="Data Source=Server2;Initial Catalog=dbName2;User Id=Username2;Password=password2;"
providerName="System.Data.SqlClient" />

Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>(); --> works fine for the default database (MYCON1)

Database myDB=EnterpriseLibraryCo

SQL Server Express2008 R2 brings app down, instance problem


I have tried dozens of changes and modifications to many settings as I will outilne here and all to no avail.

The short answer here though is that I uninstalled SQL Sever Express 2008 R2 and went back to the "NON" 2008 R2 and got things working. But like the fool I am wanted to run on the more current rev and updated again, all problems returned....



Win Server 2003 R2 SP2


VWD2008 Express (removed)




XP Sp3

VWD2008 Express

SQL Server Express 2008


I was orginally getting this message after updating to SQL Sever Express 2008 R2, I removed VWD 2008 Express from the web server, no good, then uninstalled SQL Server 2008 Express R2 and reinstalled SQL Server 2008 Express. worked but had issues, couldn't install MGTM Studio. Then I removed SQL 2008, cleaned folders and reg. Reloaded SQL Server 2008 Express, still flaky, couldn't get the Management Studio to install. So I removed it again and used the Web Platform Installer, which worked but loaded 2008 R2 again. Which brought back the message.

Failed to genera

Thread Performance: Resource Contention Concurrency Profiling in Visual Studio 2010


Visual Studio 2010 includes new resource contention profiling features that help detect concurrency contention among threads. We walk through a profiling investigation to demonstrate how you can pinpoint and fix resource contention problems in your code.

Maxim Goldin

MSDN Magazine June 2010

Thread Diagnostics: Performance Tuning with The Concurrency Visualizer in Visual Studio 2010


Understanding performance bottlenecks in multithreaded apps used to require significant instrumentation and analysis by expert developers. The Concurrency Visualizer in Visual Studio 2010 significantly reduces the burden of parallel performance analysis.

Hazim Shafi

MSDN Magazine March 2010

Concurrent Affairs: Four Ways to Use the Concurrency Runtime in Your C++ Projects


This article describes how to integrate the new parallel computing libraries in the Visual Studio 2010 Beta into existing C++ projects. Based on four common scenarios, the column explains a few of the ways developers can use the APIs and classes that are part of the Parallel Pattern Library (PPL), Asynchronous Agents Library, and Concurrency Runtime.

Rick Molloy

MSDN Magazine October 2009

Synchronization Coverage: Code Coverage for Concurrency


As more and more multi-threaded software applications get developed, software development professionals need to adopt new tools, techniques and metrics that can deal with multi-threaded software. Synchronization coverage is a simple, practical way to do this and this article covers a prototype synchronization coverage tool for .NET, called Sync Cover.

Chris Dern, Roy Tan

MSDN Magazine September 2009

The Polyglot Programmer: Concurrency with Channels, Domains and Messages


Axum is not a general-purpose language like C# or VB, but one aimed squarely at the problem of concurrency, designed from the outset to be part of a suite of languages that collectively cooperate to solve a business problem.

Ted Neward

MSDN Magazine September 2009

Concurrency Hazards: Solving 11 Likely Problems In Your Multithreaded Code


Here we describe some of the more common challenges to concurrent programming and present advice for coping with them in your software.

Joe Duffy

MSDN Magazine October 2008

Concurrency: Tools And Techniques to Identify Concurrency Issues


Efficient parallel applications aren't born by merely running an old app on a parallel processor machine. Tuning needs to be done if you're to gain maximum benefit.

Rahul V. Patil and Boby George

MSDN Magazine June 2008

CONCURRENCY: Synchronization Primitives New To Windows Vista


Windows Vista has lots of goodies for native C++ developers including condition variables, slim reader/writer locks, and one-time initialization.

Robert Saccone and Alexander Taskov

MSDN Magazine June 2007

CLR Inside Out: Using concurrency for scalability


Because of the popularity of multiprocessor machines, many concurrency articles focus on how to make concurrency safe in your code. However, they don't deal with how to get concurrency into your code in the first place.

Joe Duffy

MSDN Magazine September 2006

Concurrent Affairs: Concurrency and Coordination Runtime


What can a robot-programming toolkit do for you? Read on and find out.

Jeffrey Richter

MSDN Magazine September 2006

WCF Essentials: Discover Mighty Instance Management Techniques For Developing WCF Apps


Instance management refers to a set of techniques used by Windows Communication Foundation to bind a set of messages to a service instance. This article introduces the concept and shows you why you need instance management.

Juval Lowy

MSDN Magazine June 2006

Concurrency: What Every Dev Must Know About Multithreaded Apps


Multithreading offers lots of benefits, but it's not a technique you can employ willy nilly without first learning about all the potential pitfalls. To get you started, Vance Morrison covers multithreading and the shared memory threading model, race conditions and how concurrent access can break invariants. He also discusses how to use locks so you can understand the costs involved.

Vance Morrison

MSDN Magazine August 2005

Data Points: Handling Data Concurrency Using ADO.NET, Part 2


Enterprise development has been moving towards a discon-nected model in recent years and ADO. NET development is no exception. While the disconnected model of the ADO. NET DataSet offers great flexibility, that adaptability also means looser control over data updates than you get with a connected data access model.

John Papa

MSDN Magazine October 2004

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend