general clean up, add file contents to getdocumentbyx methods
This commit is contained in:
@@ -8,10 +8,10 @@ Public Class JobRunner
|
||||
Private WithEvents _workerThread As BackgroundWorker
|
||||
Private WithEvents _workerTimer As Timer
|
||||
|
||||
Private _interval As Long
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _firebird As Firebird
|
||||
Private ReadOnly _interval As Long
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _firebird As Firebird
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, Interval As Long)
|
||||
_logConfig = LogConfig
|
||||
@@ -21,7 +21,7 @@ Public Class JobRunner
|
||||
|
||||
_workerTimer = New Timer()
|
||||
_workerThread = New BackgroundWorker() With {
|
||||
.WorkerReportsProgress = False,
|
||||
.WorkerReportsProgress = True,
|
||||
.WorkerSupportsCancellation = True
|
||||
}
|
||||
End Sub
|
||||
@@ -34,6 +34,7 @@ Public Class JobRunner
|
||||
|
||||
Public Sub [Stop]()
|
||||
Try
|
||||
_logger.Debug("Stopping Background worker...")
|
||||
If _workerThread.IsBusy Then
|
||||
_workerThread.CancelAsync()
|
||||
_logger.Debug("Background Worker cancelled.")
|
||||
@@ -49,35 +50,32 @@ Public Class JobRunner
|
||||
If Not _workerThread.IsBusy Then
|
||||
_workerThread.RunWorkerAsync()
|
||||
Else
|
||||
_logger.Warn("Background Worker is busy")
|
||||
_logger.Warn("Background Worker is busy. Waiting for next interval.")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DoWork(sender As Object, e As DoWorkEventArgs) Handles _workerThread.DoWork
|
||||
Try
|
||||
Dim args As WorkerArgs = e.Argument
|
||||
_logger.Debug("Background worker running..")
|
||||
|
||||
_logger.Debug("Background worker running..")
|
||||
Dim args As WorkerArgs = e.Argument
|
||||
Dim oJob As New ADSyncJob(_logConfig, _firebird)
|
||||
Dim oArgs As New ADSyncArgs() With {
|
||||
.Enabled = My.Settings.JOB_ADSYNC_ENABLED,
|
||||
.Interval = My.Settings.JOB_ADSYNC_INTERVAL,
|
||||
.RootPath = My.Settings.JOB_ADSYNC_ROOT_PATH
|
||||
}
|
||||
|
||||
' TODO: WORK
|
||||
|
||||
Dim oJob As New ADSyncJob(_logConfig, _firebird)
|
||||
Dim oArgs As New ADSyncArgs() With {
|
||||
.Enabled = My.Settings.JOB_ADSYNC_ENABLED,
|
||||
.Interval = My.Settings.JOB_ADSYNC_INTERVAL,
|
||||
.RootPath = My.Settings.JOB_ADSYNC_ROOT_PATH
|
||||
}
|
||||
If oJob.ShouldStart(oArgs) Then
|
||||
oJob.Start(oArgs)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Background worker failed!")
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
If oJob.ShouldStart(oArgs) Then
|
||||
oJob.Start(oArgs)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub WorkCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles _workerThread.RunWorkerCompleted
|
||||
_logger.Debug("Background worker completed!")
|
||||
If e.Error Is Nothing Then
|
||||
_logger.Debug("Background worker completed!")
|
||||
Else
|
||||
_logger.Warn("Background worker failed!")
|
||||
_logger.Error(e.Error)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user