Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
ScanServerBeans
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Gui
TangoBeans
ScanServerBeans
Commits
55ec05c6
Commit
55ec05c6
authored
Feb 24, 2023
by
Raphael GIRARDOT
Browse files
Options
Downloads
Patches
Plain Diff
synchronized access occurs on a smaller code block (CONTROLGUI-389, PROBLEM-2297)
parent
55576af4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CurrentScanDataModel/src/main/java/fr/soleil/model/scanserver/CurrentScanDataModel.java
+96
-83
96 additions, 83 deletions
...java/fr/soleil/model/scanserver/CurrentScanDataModel.java
with
96 additions
and
83 deletions
CurrentScanDataModel/src/main/java/fr/soleil/model/scanserver/CurrentScanDataModel.java
+
96
−
83
View file @
55ec05c6
...
...
@@ -666,8 +666,8 @@ public class CurrentScanDataModel {
return
isSpectrum
;
}
protected
static
void
setAttributeInfoNoLock
(
DeviceProxy
proxy
,
AttributeInfo
attributeInfo
)
throws
DevFailed
{
proxy
.
set_attribute_info
(
new
AttributeInfo
[]
{
attributeInfo
}
);
protected
static
void
setAttributeInfoNoLock
(
DeviceProxy
proxy
,
AttributeInfo
...
attributeInfo
)
throws
DevFailed
{
proxy
.
set_attribute_info
(
attributeInfo
);
}
public
static
String
readAttributeLabel
(
String
scanServerName
,
String
attributeName
)
{
...
...
@@ -886,22 +886,17 @@ public class CurrentScanDataModel {
}
}
private
static
void
updateNexusInfoNoLock
(
String
scanServerName
,
DeviceProxy
scanProxy
)
{
try
{
private
static
boolean
isDataRecorded
(
DeviceProxy
scanProxy
)
throws
DevFailed
{
DeviceAttribute
attribute
=
scanProxy
.
read_attribute
(
DATA_RECORDED
);
boolean
dataRecorded
=
attribute
.
extractBoolean
();
if
(
dataRecorded
)
{
return
attribute
.
extractBoolean
();
}
private
static
String
readNexusFieName
(
String
scanServerName
,
DeviceProxy
scanProxy
,
int
tryCount
)
throws
DevFailed
{
String
nexusFileName
=
null
;
long
startSTMP
=
System
.
currentTimeMillis
();
long
durationTry
=
0
;
int
tryCount
=
0
;
while
((
durationTry
<
5000
)
&&
((
nexusFileName
==
null
)
||
nexusFileName
.
isEmpty
()))
{
try
{
tryCount
++;
attribute
=
scanProxy
.
read_attribute
(
NEXUS_FILE
);
DeviceAttribute
attribute
=
scanProxy
.
read_attribute
(
NEXUS_FILE
);
if
(
attribute
==
null
)
{
LOGGER
.
error
(
CANNOT_READ_ATTRIBUTE_RETURNED_ATTRIBUTE_IS_NULL_TRY_NB
,
scanServerName
,
NEXUS_FILE
,
tryCount
);
LOGGER
.
error
(
CANNOT_READ_ATTRIBUTE_RETURNED_ATTRIBUTE_IS_NULL_TRY_NB
,
scanServerName
,
NEXUS_FILE
,
tryCount
);
}
else
{
nexusFileName
=
attribute
.
extractString
();
if
(
nexusFileName
==
null
)
{
...
...
@@ -913,6 +908,40 @@ public class CurrentScanDataModel {
LOGGER
.
info
(
VALUE_EQUALS
,
scanServerName
,
NEXUS_FILE
,
nexusFileName
);
}
}
return
nexusFileName
;
}
private
static
void
updateNexusInfo
(
String
scanServerName
)
{
if
(
scanServerName
!=
null
)
{
NEXUS_FILE_NAME_MAP
.
remove
(
scanServerName
.
toLowerCase
());
NEXUS_FILE_ENTRY_MAP
.
remove
(
scanServerName
.
toLowerCase
());
if
(
TangoAttributeHelper
.
isAttributeRunning
(
scanServerName
,
NEXUS_FILE
))
{
// Read the property of DataRecorder = storage/recorder/datarecorder.1/
DeviceProxy
scanProxy
=
TangoDeviceHelper
.
getDeviceProxy
(
scanServerName
,
false
);
if
(
scanProxy
!=
null
)
{
try
{
boolean
dataRecorded
;
if
(
isSynchronizeDeviceAccesses
())
{
synchronized
(
scanProxy
)
{
dataRecorded
=
isDataRecorded
(
scanProxy
);
}
}
else
{
dataRecorded
=
isDataRecorded
(
scanProxy
);
}
if
(
dataRecorded
)
{
String
nexusFileName
=
null
;
long
startSTMP
=
System
.
currentTimeMillis
();
long
durationTry
=
0
;
int
tryCount
=
0
;
while
((
durationTry
<
5000
)
&&
((
nexusFileName
==
null
)
||
nexusFileName
.
isEmpty
()))
{
try
{
if
(
isSynchronizeDeviceAccesses
())
{
synchronized
(
scanProxy
)
{
nexusFileName
=
readNexusFieName
(
scanServerName
,
scanProxy
,
++
tryCount
);
}
}
else
{
nexusFileName
=
readNexusFieName
(
scanServerName
,
scanProxy
,
++
tryCount
);
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
CANNOT_READ_ATTRIBUTE_N_TRY_NB
,
scanServerName
,
NEXUS_FILE
,
TangoExceptionHelper
.
getErrorMessage
(
e
),
tryCount
);
...
...
@@ -931,7 +960,8 @@ public class CurrentScanDataModel {
if
(
nexusFileName
.
isEmpty
())
{
if
(
durationTry
>=
5000
)
{
LOGGER
.
warn
(
NO_NEXUS_FILE_GENERATED_IT_TOOK_TOO_MUCH_TIME
,
scanServerName
,
NEXUS_FILE
);
LOGGER
.
warn
(
NO_NEXUS_FILE_GENERATED_IT_TOOK_TOO_MUCH_TIME
,
scanServerName
,
NEXUS_FILE
);
}
else
{
LOGGER
.
warn
(
NO_NEXUS_FILE_GENERATED
);
}
...
...
@@ -947,7 +977,8 @@ public class CurrentScanDataModel {
}
if
(
TangoDeviceHelper
.
isDeviceRunning
(
dataRecorderDeviceName
))
{
DeviceProxy
dataRecorderProxy
=
TangoDeviceHelper
.
getDeviceProxy
(
dataRecorderDeviceName
);
DeviceProxy
dataRecorderProxy
=
TangoDeviceHelper
.
getDeviceProxy
(
dataRecorderDeviceName
);
if
(
dataRecorderProxy
!=
null
)
{
if
(
isSynchronizeDeviceAccesses
())
{
synchronized
(
dataRecorderProxy
)
{
...
...
@@ -965,24 +996,6 @@ public class CurrentScanDataModel {
LOGGER
.
debug
(
STACK_TRACE
,
e
);
}
}
private
static
void
updateNexusInfo
(
String
scanServerName
)
{
if
(
scanServerName
!=
null
)
{
NEXUS_FILE_NAME_MAP
.
remove
(
scanServerName
.
toLowerCase
());
NEXUS_FILE_ENTRY_MAP
.
remove
(
scanServerName
.
toLowerCase
());
if
(
TangoAttributeHelper
.
isAttributeRunning
(
scanServerName
,
NEXUS_FILE
))
{
// Read the property of DataRecorder = storage/recorder/datarecorder.1/
DeviceProxy
scanProxy
=
TangoDeviceHelper
.
getDeviceProxy
(
scanServerName
,
false
);
if
(
scanProxy
!=
null
)
{
if
(
isSynchronizeDeviceAccesses
())
{
// XXX maybe the synchronized access should not occur on such a big code block
synchronized
(
scanProxy
)
{
updateNexusInfoNoLock
(
scanServerName
,
scanProxy
);
}
}
else
{
updateNexusInfoNoLock
(
scanServerName
,
scanProxy
);
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment