Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handling first hit on a site
Message
From
27/09/2010 18:05:25
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
27/09/2010 17:37:40
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01482914
Message ID:
01482955
Views:
50
>>>My whole class is static.
>>
>>Do you see any problem I have a local declaration on the lock object?
>>
>>BTW, I do not know if that is related but I am having a problem with some event being logged in the event viewer with this new architecture.
>>
>>Application: w3wp.exe
>>Framework Version: v4.0.30319
>>Description: The process was terminated due to stack overflow.
>>
>>So, when this happens, the application will restart and I then have a bunch of errors.
>
>I might not have seen enough of your code, but how will other instances know about the lFirstHit variable? I created my class and variable as static so it's a singleton throughout the application.

Just a side note Mike for clarification on your comment. You may already realize this. A static object does not constitute a singleton. An instance object can be kept to a single instance through the use of a singleton pattern. An object is referenced through a property and if the instance already exists the existing instance is passed back instead of creating another instance of the object. Here is an example in my EventLogger class. I use it because I want the same event log throughout the application. Notice the constructor is protected so it cannot be constructed directly.
public class EventLogger
{
	#region Private Singleton

	private static EventLogger instance = null;
	private static EventLogger Instance
	{
		get
		{
			if(instance == null)
				instance = new EventLogger();

			return instance;
		}
	}

	protected EventLogger()
	{
	}

	#endregion Private Singleton
       // All other stuff stripped out.
}
Tim
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform