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
Hide whitespace changes
Inline
Side-by-side
src/main/java/alien/taskQueue/TaskQueueUtils.java
View file @
18e71a00
...
@@ -2379,6 +2379,8 @@ public class TaskQueueUtils {
...
@@ -2379,6 +2379,8 @@ public class TaskQueueUtils {
}
}
}
}
private
static
final
String
JOBMESSAGES_INSERT
=
"INSERT INTO JOBMESSAGES (timestamp, jobId, procinfo, tag) VALUES (?, ?, ?, ?);"
;
/**
/**
* @param queueId
* @param queueId
* @param action
* @param action
...
@@ -2398,22 +2400,15 @@ public class TaskQueueUtils {
...
@@ -2398,22 +2400,15 @@ public class TaskQueueUtils {
monitor
.
incrementCounter
(
"TQ_JOBMESSAGES_insert"
);
monitor
.
incrementCounter
(
"TQ_JOBMESSAGES_insert"
);
}
}
final
Map
<
String
,
Object
>
insertValues
=
new
HashMap
<>(
4
);
final
Long
now
=
Long
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
final
Long
qid
=
Long
.
valueOf
(
queueId
);
insertValues
.
put
(
"timestamp"
,
Long
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
));
insertValues
.
put
(
"jobId"
,
Long
.
valueOf
(
queueId
));
insertValues
.
put
(
"procinfo"
,
message
);
insertValues
.
put
(
"tag"
,
action
);
if
(!
db
.
query
(
DBFunctions
.
composeInsert
(
"JOBMESSAGES"
,
insertValues
)
))
if
(!
db
.
query
(
JOBMESSAGES_INSERT
,
false
,
now
,
qid
,
message
,
action
))
return
false
;
return
false
;
if
(
joblogtags
!=
null
&&
joblogtags
.
size
()
>
0
)
if
(
joblogtags
!=
null
&&
joblogtags
.
size
()
>
0
)
for
(
final
Map
.
Entry
<
String
,
String
>
entry
:
joblogtags
.
entrySet
())
{
for
(
final
Map
.
Entry
<
String
,
String
>
entry
:
joblogtags
.
entrySet
())
{
insertValues
.
put
(
"tag"
,
entry
.
getKey
());
if
(!
db
.
query
(
JOBMESSAGES_INSERT
,
false
,
now
,
qid
,
entry
.
getValue
(),
entry
.
getKey
()))
insertValues
.
put
(
"procinfo"
,
entry
.
getValue
());
if
(!
db
.
query
(
DBFunctions
.
composeInsert
(
"JOBMESSAGES"
,
insertValues
)))
return
false
;
return
false
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
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