싱글 톤 원격 객체 MBRO에서 다음 코드를 사용하고 있습니다. 이 함수는 서버 측에서만 호출됩니다.원격 캐시 객체
''' <summary>
''' Return a cached DataCentricObject
''' </summary>
''' <created_by>CodingBarfield</created_by>
''' <date>04-08-2011</date>
Function DataCentricObjectName(ByVal intID As Integer) As String
Try
SyncLock dictDataCentricObject
If Not dictDataCentricObject.ContainsKey(intID) Then
Dim st As struct = dcLoader.LoadRecord(intID)
dictDataCentricObject(intID) = st.Descript
End If
Return dictDataCentricObject(intID)
End SyncLock
Catch ex As Exception
Throw New Exception("Error in GetTargName", ex)
End Try
End Function
Private dictDataCentricObject As New Dictionary(Of Integer, String)
Dim dcLoader As New DataCentricObject
LoadRecord 함수는 데이터베이스 테이블에서 행을 읽고 필드를 작은 데이터 구조로 복사합니다.
질문
- 의 (a 원격 환경에서) 안전 멀티 스레딩이 코드
- 그것은
dcLoader.LoadRecord
가하는 일에 따라 다른 코드