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
0a075bd8
Commit
0a075bd8
authored
10 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-1324: list commands of all command queues.
SVN: 33022
parent
cdfe85f4
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/DataSetCommandExecutor.java
+47
-16
47 additions, 16 deletions
...sd/openbis/dss/generic/server/DataSetCommandExecutor.java
with
47 additions
and
16 deletions
datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataSetCommandExecutor.java
+
47
−
16
View file @
0a075bd8
...
@@ -17,6 +17,9 @@
...
@@ -17,6 +17,9 @@
package
ch.systemsx.cisd.openbis.dss.generic.server
;
package
ch.systemsx.cisd.openbis.dss.generic.server
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FilenameFilter
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -46,6 +49,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
...
@@ -46,6 +49,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
*/
*/
class
DataSetCommandExecutor
implements
IDataSetCommandExecutor
class
DataSetCommandExecutor
implements
IDataSetCommandExecutor
{
{
private
static
final
String
COMMAND_QUEUE_FILE_PREFIX
=
"commandQueue"
;
private
final
static
Logger
operationLog
=
LogFactory
.
getLogger
(
LogCategory
.
OPERATION
,
private
final
static
Logger
operationLog
=
LogFactory
.
getLogger
(
LogCategory
.
OPERATION
,
DataSetCommandExecutor
.
class
);
DataSetCommandExecutor
.
class
);
...
@@ -82,7 +87,7 @@ class DataSetCommandExecutor implements IDataSetCommandExecutor
...
@@ -82,7 +87,7 @@ class DataSetCommandExecutor implements IDataSetCommandExecutor
private
static
File
getCommandQueueFile
(
File
store
,
String
nameOrNull
)
private
static
File
getCommandQueueFile
(
File
store
,
String
nameOrNull
)
{
{
String
fileName
=
"commandQueue"
;
String
fileName
=
COMMAND_QUEUE_FILE_PREFIX
;
if
(
StringUtils
.
isNotBlank
(
nameOrNull
))
if
(
StringUtils
.
isNotBlank
(
nameOrNull
))
{
{
fileName
+=
"-"
+
nameOrNull
;
fileName
+=
"-"
+
nameOrNull
;
...
@@ -212,28 +217,54 @@ class DataSetCommandExecutor implements IDataSetCommandExecutor
...
@@ -212,28 +217,54 @@ class DataSetCommandExecutor implements IDataSetCommandExecutor
*/
*/
public
static
void
listQueuedCommands
(
File
store
)
public
static
void
listQueuedCommands
(
File
store
)
{
{
final
File
queueFile
=
getCommandQueueFile
(
store
);
List
<
File
>
commandQueueFiles
=
listCommandQueueFiles
(
store
);
final
IExtendedBlockingQueue
<
IDataSetCommand
>
commandQueue
=
for
(
File
queueFile
:
commandQueueFiles
)
PersistentExtendedBlockingQueueFactory
.<
IDataSetCommand
>
createSmartPersist
(
queueFile
);
if
(
commandQueue
.
isEmpty
())
{
System
.
out
.
println
(
"Command queue is empty."
);
}
else
{
{
System
.
out
.
println
(
"Found "
+
commandQueue
.
size
()
+
" items in command queue:"
);
if
(
commandQueueFiles
.
size
()
!=
1
)
for
(
final
IDataSetCommand
cmd
:
commandQueue
)
{
{
try
String
fileName
=
queueFile
.
getName
();
String
queueName
=
"Default command queue"
;
if
(
fileName
.
length
()
>
COMMAND_QUEUE_FILE_PREFIX
.
length
())
{
{
System
.
out
.
println
(
cmd
.
getDescription
());
queueName
=
"Command queue '"
+
fileName
.
substring
(
COMMAND_QUEUE_FILE_PREFIX
.
length
()
+
1
)
+
"'"
;
}
catch
(
RuntimeException
ex
)
}
System
.
out
.
println
(
"======= "
+
queueName
+
" ("
+
queueFile
+
")"
);
}
final
IExtendedBlockingQueue
<
IDataSetCommand
>
commandQueue
=
PersistentExtendedBlockingQueueFactory
.<
IDataSetCommand
>
createSmartPersist
(
queueFile
);
if
(
commandQueue
.
isEmpty
())
{
System
.
out
.
println
(
"Command queue is empty."
);
}
else
{
System
.
out
.
println
(
"Found "
+
commandQueue
.
size
()
+
" items in command queue:"
);
for
(
final
IDataSetCommand
cmd
:
commandQueue
)
{
{
System
.
err
.
printf
(
"Error showing description of command '%s':\n"
,
cmd
try
.
getClass
().
getSimpleName
());
{
ex
.
printStackTrace
();
System
.
out
.
println
(
cmd
.
getDescription
());
}
catch
(
RuntimeException
ex
)
{
System
.
err
.
printf
(
"Error showing description of command '%s':\n"
,
cmd
.
getClass
().
getSimpleName
());
ex
.
printStackTrace
();
}
}
}
}
}
}
}
}
}
private
static
List
<
File
>
listCommandQueueFiles
(
File
store
)
{
File
[]
commandQueueFiles
=
store
.
listFiles
(
new
FilenameFilter
()
{
@Override
public
boolean
accept
(
File
file
,
String
name
)
{
return
name
.
startsWith
(
COMMAND_QUEUE_FILE_PREFIX
);
}
});
return
commandQueueFiles
==
null
?
Collections
.<
File
>
emptyList
()
:
Arrays
.
asList
(
commandQueueFiles
);
}
}
}
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