Public Class SingleTon
#Region "declaration"
Private Shared instance As SingleTon
Private Shared m_nNofReference As Integer
Private m_ArrJob As ArrayList
#End Region
''' <summary>
'''
''' </summary>
Private Sub New()
'
' TODO: Add constructor logic here
'
m_nNofReference = 0
m_ArrJob = New ArrayList()
'''
'''Add three job types in the queue for
'''the time being
'''
m_ArrJob.Add(New Job(1,"INSERT INTO TABLE"))
m_ArrJob.Add(New Job(2,"DELETE FROM TABLE"))
m_ArrJob.Add(New Job(2,"UPDATE TABLE"))
End Sub
''' <summary>
''' Return the object if it is existing
''' OR create new ONE and return
''' </summary>
Public Shared Function GetObject() As SingleTon
If instance Is Nothing Then
instance = New SingleTon()
End If
m_nNofReference += 1
Return instance
End Function
''' <summary>
'''
''' </summary>
Public Shared Sub Release()
m_nNofReference -= 1
End Sub
''' <summary>
'''
''' </summary>
''' <param name="nJob"></param>
''' <returns></returns>
Public Function GetJOB(ByVal nJob As Integer) As Object
If nJob < m_ArrJob.Count Then
Return m_ArrJob(nJob)
Else
Return Nothing
End If
End Function
End Class