Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
f1c84156
Commit
f1c84156
authored
14 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
LMS-2077 hardening ShareIdManager
SVN: 20199
parent
3b731a01
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ShareIdManager.java
+16
-13
16 additions, 13 deletions
...temsx/cisd/openbis/dss/generic/server/ShareIdManager.java
with
16 additions
and
13 deletions
datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/ShareIdManager.java
+
16
−
13
View file @
f1c84156
...
...
@@ -56,7 +56,7 @@ public class ShareIdManager implements IShareIdManager
GuardedShareID
(
String
dataSetCode
,
String
shareId
,
int
lockingTimeOut
)
{
this
.
dataSetCode
=
dataSetCode
;
this
.
shareId
=
shareId
;
this
.
shareId
=
shareId
==
null
?
Constants
.
DEFAULT_SHARE_ID
:
shareId
;
this
.
lockingTimeOut
=
lockingTimeOut
;
}
...
...
@@ -110,7 +110,7 @@ public class ShareIdManager implements IShareIdManager
private
final
IEncapsulatedOpenBISService
service
;
private
final
int
lockingTimeOut
;
private
final
Map
<
String
,
Set
<
Thread
>>
lockedDataSets
=
new
HashMap
<
String
,
Set
<
Thread
>>();
private
final
Object
dataSetCodeToShareIdMapMonitor
=
new
Object
();
private
Map
<
String
,
GuardedShareID
>
dataSetCodeToShareIdMap
;
public
ShareIdManager
(
IEncapsulatedOpenBISService
service
,
int
lockingTimeOutInSeconds
)
...
...
@@ -158,8 +158,9 @@ public class ShareIdManager implements IShareIdManager
if
(
set
==
null
)
{
set
=
new
LinkedHashSet
<
Thread
>();
GuardedShareID
guardedShareId
=
getGuardedShareId
(
dataSetCode
);
lockedDataSets
.
put
(
dataSetCode
,
set
);
g
etG
uardedShareId
(
dataSetCode
)
.
lock
();
guardedShareId
.
lock
();
if
(
operationLog
.
isDebugEnabled
())
{
operationLog
.
debug
(
"Data set "
+
dataSetCode
+
" has been locked."
);
...
...
@@ -196,8 +197,8 @@ public class ShareIdManager implements IShareIdManager
{
operationLog
.
debug
(
"Unlock data set "
+
dataSetCode
);
}
getGuardedShareId
(
dataSetCode
).
unlock
();
lockedDataSets
.
remove
(
dataSetCode
);
getGuardedShareId
(
dataSetCode
).
unlock
();
}
log
(
dataSetCode
,
set
);
}
...
...
@@ -247,17 +248,19 @@ public class ShareIdManager implements IShareIdManager
{
if
(
dataSetCodeToShareIdMap
==
null
)
{
dataSetCodeToShareIdMap
=
new
HashMap
<
String
,
GuardedShareID
>();
List
<
SimpleDataSetInformationDTO
>
dataSets
=
service
.
listDataSets
();
for
(
SimpleDataSetInformationDTO
dataSet
:
dataSets
)
synchronized
(
dataSetCodeToShareIdMapMonitor
)
{
String
dataSetCode
=
dataSet
.
getDataSetCode
();
String
shareId
=
dataSet
.
getDataSetShareId
();
addShareId
(
dataSetCodeToShareIdMap
,
dataSetCode
,
shareId
==
null
?
Constants
.
DEFAULT_SHARE_ID
:
shareId
);
dataSetCodeToShareIdMap
=
new
HashMap
<
String
,
GuardedShareID
>();
List
<
SimpleDataSetInformationDTO
>
dataSets
=
service
.
listDataSets
();
for
(
SimpleDataSetInformationDTO
dataSet
:
dataSets
)
{
String
dataSetCode
=
dataSet
.
getDataSetCode
();
String
shareId
=
dataSet
.
getDataSetShareId
();
addShareId
(
dataSetCodeToShareIdMap
,
dataSetCode
,
shareId
);
}
operationLog
.
info
(
"Share id manager initialized with "
+
dataSets
.
size
()
+
" data sets."
);
}
operationLog
.
info
(
"Share id manager initialized with "
+
dataSets
.
size
()
+
" data sets."
);
}
return
dataSetCodeToShareIdMap
;
}
...
...
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