Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
0c6b6ed4
Commit
0c6b6ed4
authored
Jan 30, 2014
by
igoshin
Committed by
Matija Obreza
Jan 31, 2014
Browse files
Final version of user story "Scheduled job execution"
#10488
parent
fdcb6ec9
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/service/impl/GeoServiceImpl.java
View file @
0c6b6ed4
...
...
@@ -40,6 +40,7 @@ import org.genesys2.server.service.ContentService;
import
org.genesys2.server.service.GeoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -190,6 +191,7 @@ public class GeoServiceImpl implements GeoService {
@Override
@Transactional
(
readOnly
=
false
)
@Scheduled
(
cron
=
"${scheduler.country.data.cron}"
)
public
void
updateCountryData
()
throws
IOException
{
// update current countries
updateGeoNamesCountries
();
...
...
src/main/java/org/genesys2/server/servlet/controller/AdminController.java
View file @
0c6b6ed4
...
...
@@ -42,6 +42,7 @@ import org.genesys2.server.service.worker.SGSVUpdate;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.RowCallbackHandler
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
@@ -85,7 +86,7 @@ public class AdminController {
private
GenesysLowlevelRepository
genesysLowlevelRepository
;
@RequestMapping
(
"/"
)
public
String
root
()
{
public
String
root
(
Model
model
)
{
return
"/admin/index"
;
}
...
...
@@ -185,9 +186,9 @@ public class AdminController {
list
.
clear
();
System
.
err
.
println
(
"FOOBAR!"
);
final
Set
<
Long
>
toRemove
=
new
HashSet
<
Long
>();
// Remove stupid stuff
// List<Long> aliasesToRemove = new ArrayList<Long>();
genesysLowlevelRepository
.
listAccessionsAlias
(
new
RowCallbackHandler
()
{
...
...
@@ -215,7 +216,7 @@ public class AdminController {
for
(
Object
[]
alias
:
existingAliases
)
{
System
.
err
.
println
(
""
+
accessionId
+
" = "
+
ArrayUtils
.
toString
(
alias
,
"NULL"
));
}
for
(
int
i
=
0
;
i
<
existingAliases
.
size
()
-
1
;
i
++)
{
Object
[]
name1
=
existingAliases
.
get
(
i
);
if
(
toRemove
.
contains
(
name1
[
0
]))
...
...
@@ -265,7 +266,7 @@ public class AdminController {
return
score
;
}
});
this
.
genesysService
.
removeAliases
(
toRemove
);
return
"redirect:/admin/"
;
...
...
src/main/resources/spring/application-context.xml
View file @
0c6b6ed4
...
...
@@ -32,5 +32,6 @@
<import
resource=
"spring-security-acl.xml"
/>
<import
resource=
"spring-security.xml"
/>
<import
resource=
"spring-mail.xml"
/>
<import
resource=
"spring-scheduler.xml"
/>
</beans>
src/main/resources/spring/spring-common.xml
View file @
0c6b6ed4
...
...
@@ -53,11 +53,6 @@
</property>
</bean>
<bean
id=
"taskExecutor"
class=
"org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"
>
<property
name=
"corePoolSize"
value=
"4"
/>
<property
name=
"maxPoolSize"
value=
"16"
/>
</bean>
<!-- Has to be here, otherwise JSP TAGLIB doesn't pick it up -->
<bean
id=
"webExpressionHandler"
class=
"org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"
>
<property
name=
"permissionEvaluator"
ref=
"permissionEvaluator"
/>
...
...
src/main/resources/spring/spring-scheduler.xml
0 → 100644
View file @
0c6b6ed4
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:task=
"http://www.springframework.org/schema/task"
xmlns:context=
"http://www.springframework.org/schema/context"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd"
default-autowire=
"no"
>
<task:annotation-driven
executor=
"taskExecutor"
scheduler=
"taskScheduler"
/>
<context:component-scan
base-package=
"org.genesys2.server.scheduler"
/>
<task:executor
id=
"taskExecutor"
pool-size=
"${executor.core.pool.size}-${executor.max.pool.size}"
queue-capacity=
"${executor.queue.capacity}"
/>
<task:scheduler
id=
"taskScheduler"
pool-size=
"${scheduler.max.pool.size}"
/>
</beans>
\ No newline at end of file
src/main/resources/spring/spring.properties
View file @
0c6b6ed4
...
...
@@ -19,8 +19,8 @@ base.url=http://localhost:8080
db.url
=
jdbc:mysql://localhost/genesys4?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
db.driverClassName
=
com.mysql.jdbc.Driver
db.username
=
root
db.password
=
db.showSql=
tru
e
db.password
=
db.showSql
=
fals
e
db.hbm2ddl
=
do-nothing
c3p0.acquireIncrement
=
1
...
...
@@ -80,3 +80,19 @@ google.consumerKey=
google.consumerSecret
=
#executor properties
executor.core.pool.size
=
4
executor.max.pool.size
=
16
executor.queue.capacity
=
100
#scheduler properties
scheduler.max.pool.size
=
16
# second, minute, hour, day, month, weekday
# Month and weekday names can be given as the first three letters of the English names.
# call country updater every six hours
scheduler.country.data.cron
=
10 47 */6 * * ?
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment