Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
45
Issues
45
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
88594865
Commit
88594865
authored
Aug 01, 2014
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scheduler uses CALLER_RUNS policy
Catch multiple accessions for 1 alias exception
parent
d709287c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
22 deletions
+34
-22
src/main/java/org/genesys2/server/persistence/domain/AccessionAliasRepository.java
...2/server/persistence/domain/AccessionAliasRepository.java
+1
-1
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
.../org/genesys2/server/service/impl/GenesysServiceImpl.java
+23
-17
src/main/java/org/genesys2/spring/config/SpringSchedulerConfig.java
...ava/org/genesys2/spring/config/SpringSchedulerConfig.java
+10
-4
No files found.
src/main/java/org/genesys2/server/persistence/domain/AccessionAliasRepository.java
View file @
88594865
...
...
@@ -36,6 +36,6 @@ public interface AccessionAliasRepository extends JpaRepository<AccessionAlias,
@Query
(
"delete from AccessionAlias aa where aa.accession in (from Accession a where a.id in ( :ids ))"
)
void
deleteForAccessions
(
@Param
(
"ids"
)
Collection
<
Long
>
accessionIds
);
@Query
(
"select aa.accession from AccessionAlias aa where aa.usedBy=?1 and aa.name=?2 and aa.aliasType=?3 and aa.accession.institute.code=?1"
)
@Query
(
"select
distinct
aa.accession from AccessionAlias aa where aa.usedBy=?1 and aa.name=?2 and aa.aliasType=?3 and aa.accession.institute.code=?1"
)
Accession
findAccession
(
String
instCode
,
String
name
,
int
aliasType
);
}
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
View file @
88594865
...
...
@@ -92,6 +92,7 @@ import org.genesys2.server.service.TaxonomyService;
import
org.genesys2.server.service.TraitService
;
import
org.genesys2.spring.SecurityContextUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.IncorrectResultSizeDataAccessException
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -224,26 +225,31 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
if
(
accn
!=
null
)
{
result
.
add
(
accn
);
}
else
{
Accession
accnByAlias
=
accessionAliasRepository
.
findAccession
(
aid3
.
getHoldingInstitute
(),
aid3
.
getAccessionName
(),
AccessionAlias
.
AliasType
.
OTHERNUMB
.
getId
());
if
(
accnByAlias
!=
null
)
{
LOG
.
info
(
"Found accession by alias "
+
accnByAlias
);
// Genus must match
if
(
StringUtils
.
equalsIgnoreCase
(
aid3
.
getGenus
(),
accnByAlias
.
getTaxonomy
().
getGenus
()))
result
.
add
(
accnByAlias
);
else
{
LOG
.
info
(
"... but genus doesn't match"
);
try
{
Accession
accnByAlias
=
accessionAliasRepository
.
findAccession
(
aid3
.
getHoldingInstitute
(),
aid3
.
getAccessionName
(),
AccessionAlias
.
AliasType
.
OTHERNUMB
.
getId
());
if
(
accnByAlias
!=
null
)
{
LOG
.
info
(
"Found accession by alias "
+
accnByAlias
);
// Genus must match
if
(
StringUtils
.
equalsIgnoreCase
(
aid3
.
getGenus
(),
accnByAlias
.
getTaxonomy
().
getGenus
()))
result
.
add
(
accnByAlias
);
else
{
LOG
.
info
(
"... but genus doesn't match"
);
result
.
add
(
null
);
}
}
else
{
result
.
add
(
null
);
if
(
LOG
.
isDebugEnabled
())
{
// Only log full miss
LOG
.
debug
(
"No accession "
+
aid3
);
}
}
}
else
{
}
catch
(
IncorrectResultSizeDataAccessException
e
)
{
LOG
.
warn
(
"Multple accessions with alias "
+
aid3
);
result
.
add
(
null
);
if
(
LOG
.
isDebugEnabled
())
{
// Only log full miss
LOG
.
debug
(
"No accession "
+
aid3
);
}
}
}
}
...
...
src/main/java/org/genesys2/spring/config/SpringSchedulerConfig.java
View file @
88594865
...
...
@@ -16,8 +16,11 @@
package
org.genesys2.spring.config
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.task.TaskExecutor
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
...
...
@@ -27,11 +30,14 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@Configuration
public
class
SpringSchedulerConfig
{
@Bean
public
T
hreadPoolT
askExecutor
taskExecutor
()
{
@Bean
(
destroyMethod
=
"shutdown"
)
public
TaskExecutor
taskExecutor
()
{
final
ThreadPoolTaskExecutor
pool
=
new
ThreadPoolTaskExecutor
();
pool
.
setCorePoolSize
(
5
);
pool
.
setMaxPoolSize
(
16
);
pool
.
setCorePoolSize
(
4
);
pool
.
setMaxPoolSize
(
8
);
pool
.
setQueueCapacity
(
10
);
pool
.
setThreadNamePrefix
(
"genesys-background-"
);
pool
.
setRejectedExecutionHandler
(
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
return
pool
;
}
...
...
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