File tree 2 files changed +11
-1
lines changed
services-camel-app/src/main
java/edu/unc/lib/boxc/services/camel/images
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 21
21
public class ImageEnhancementsRouter extends RouteBuilder {
22
22
private static final Logger log = getLogger (ImageEnhancementsRouter .class );
23
23
24
+ private static final int CACHE_INVALIDATE_THREADS = 5 ;
25
+ private static final int CACHE_INVALIDATE_REQUESTS_PER_SEC = 10 ;
26
+
24
27
@ BeanInject (value = "addAccessCopyProcessor" )
25
28
private AddDerivativeProcessor addAccessCopyProcessor ;
26
29
@@ -59,7 +62,12 @@ public void configure() throws Exception {
59
62
.recipientList (simple ("exec:/bin/sh?args=${properties:cdr.enhancement.bin}/convertJp2.sh "
60
63
+ "${headers[CdrImagePath]} ${headers[CdrMimeType]} ${headers[CdrTempPath]}" ))
61
64
.bean (addAccessCopyProcessor )
62
- .bean (imageCacheInvalidationProcessor )
65
+ // Process cache invalidation asynchronously with a limited number of threads
66
+ .threads (CACHE_INVALIDATE_THREADS )
67
+ // Limit the max number of requests per second
68
+ .throttle (CACHE_INVALIDATE_REQUESTS_PER_SEC )
69
+ .bean (imageCacheInvalidationProcessor )
70
+ .end ()
63
71
.endDoTry ()
64
72
.doFinally ()
65
73
.bean (addAccessCopyProcessor , "cleanupTempFile" )
Original file line number Diff line number Diff line change 98
98
<!-- ACL related beans -->
99
99
<bean id =" httpClientConnectionManager" class =" org.apache.http.impl.conn.PoolingHttpClientConnectionManager"
100
100
destroy-method =" shutdown" >
101
+ <property name =" maxTotal" value =" 100" />
102
+ <property name =" defaultMaxPerRoute" value =" 5" />
101
103
</bean >
102
104
103
105
<bean id =" sparqlQueryService" class =" edu.unc.lib.boxc.model.fcrepo.sparql.FusekiSparqlQueryServiceImpl" >
You can’t perform that action at this time.
0 commit comments