Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
JAliEn
JAliEn
Commits
18e71a00
Commit
18e71a00
authored
Apr 22, 2021
by
Costin Grigoras
Browse files
Use prepared statements for inserting into the JOBMESSAGES table
parent
8b39e752
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/alien/taskQueue/TaskQueueUtils.java
View file @
18e71a00
...
...
@@ -2379,6 +2379,8 @@ public class TaskQueueUtils {
}
}
private
static
final
String
JOBMESSAGES_INSERT
=
"INSERT INTO JOBMESSAGES (timestamp, jobId, procinfo, tag) VALUES (?, ?, ?, ?);"
;
/**
* @param queueId
* @param action
...
...
@@ -2398,22 +2400,15 @@ public class TaskQueueUtils {
monitor
.
incrementCounter
(
"TQ_JOBMESSAGES_insert"
);
}
final
Map
<
String
,
Object
>
insertValues
=
new
HashMap
<>(
4
);
insertValues
.
put
(
"timestamp"
,
Long
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
));
insertValues
.
put
(
"jobId"
,
Long
.
valueOf
(
queueId
));
insertValues
.
put
(
"procinfo"
,
message
);
insertValues
.
put
(
"tag"
,
action
);
final
Long
now
=
Long
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
final
Long
qid
=
Long
.
valueOf
(
queueId
);
if
(!
db
.
query
(
DBFunctions
.
composeInsert
(
"JOBMESSAGES"
,
insertValues
)
))
if
(!
db
.
query
(
JOBMESSAGES_INSERT
,
false
,
now
,
qid
,
message
,
action
))
return
false
;
if
(
joblogtags
!=
null
&&
joblogtags
.
size
()
>
0
)
for
(
final
Map
.
Entry
<
String
,
String
>
entry
:
joblogtags
.
entrySet
())
{
insertValues
.
put
(
"tag"
,
entry
.
getKey
());
insertValues
.
put
(
"procinfo"
,
entry
.
getValue
());
if
(!
db
.
query
(
DBFunctions
.
composeInsert
(
"JOBMESSAGES"
,
insertValues
)))
if
(!
db
.
query
(
JOBMESSAGES_INSERT
,
false
,
now
,
qid
,
entry
.
getValue
(),
entry
.
getKey
()))
return
false
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment