Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

A Custom Proxy that Handles Thread Creation and Object Pooling

Generally, when a good programmer has to design a type (or a hierarchy of types), he does an analysis of the problem and then starts to write properties and methods that describe the type behavior. If a method requires long processing time, it is the perfect candidate for being called in a separate thread. To handle asynchronous method calls you often have to write the same code to create threads and pass data to them. The .NET Framework provides delegate types that allow you to handle both synchronous and asynchronous calls through the BeginInvoke/EndInvoke idiom. The main purpose of this article is to show you a different approach to this problem, by implementing a custom proxy that delegates each method call of a type to a thread of a thread pool, by using declarative programming at design time. After this, we will extend the proxy capabilities by including object pooling.


advertisement


enerally, when a good programmer has to design a type (or a hierarchy of types), he does an analysis of the problem and then starts to write properties and methods that describe the type behavior. If a method requires long processing time, it is the perfect candidate for being called in a separate thread. To handle asynchronous method calls you often have to write the same code to create threads and pass data to them. The .NET Framework provides delegate types that allow you to handle both synchronous and asynchronous calls through the BeginInvoke/EndInvoke idiom. The main purpose of this article is to show you a different approach to this problem, by implementing a custom proxy that delegates each method call of a type to a thread of a thread pool, by using declarative programming at design time. After this, we will extend the proxy capabilities by including


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date