1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.messaging.web;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.apache.struts.action.ActionForm;
20 import org.apache.struts.action.ActionForward;
21 import org.apache.struts.action.ActionMapping;
22 import org.apache.struts.action.ActionMessages;
23 import org.kuali.rice.core.api.config.property.ConfigContext;
24 import org.kuali.rice.ksb.service.KSBServiceLocator;
25 import org.kuali.rice.ksb.util.KSBConstants;
26
27 import javax.servlet.ServletException;
28 import javax.servlet.http.HttpServletRequest;
29 import javax.servlet.http.HttpServletResponse;
30 import java.io.IOException;
31
32
33
34
35
36
37
38 public class ThreadPoolAction extends KSBAction {
39
40 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ThreadPoolAction.class);
41
42 public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request,
43 HttpServletResponse response) throws IOException, ServletException {
44 return mapping.findForward("basic");
45 }
46
47 public ActionMessages establishRequiredState(HttpServletRequest request, ActionForm actionForm) throws Exception {
48 ThreadPoolForm form = (ThreadPoolForm)actionForm;
49 form.setThreadPool(KSBServiceLocator.getThreadPool());
50 if (form.getCorePoolSize() == null) {
51 form.setCorePoolSize(form.getThreadPool().getCorePoolSize());
52 }
53 if (form.getMaximumPoolSize() == null) {
54 form.setMaximumPoolSize(form.getThreadPool().getMaximumPoolSize());
55 }
56 if (form.getTimeIncrement() == null) {
57 String timeIncrementValue = ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.ROUTE_QUEUE_TIME_INCREMENT_KEY);
58 if (!StringUtils.isEmpty(timeIncrementValue)) {
59 form.setTimeIncrement(Long.parseLong(timeIncrementValue));
60 }
61 }
62 if (form.getMaxRetryAttempts() == null) {
63 String maxRetryAttemptsValue = ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.ROUTE_QUEUE_MAX_RETRY_ATTEMPTS_KEY);
64 if (!StringUtils.isEmpty(maxRetryAttemptsValue)) {
65 form.setMaxRetryAttempts(Long.parseLong(maxRetryAttemptsValue));
66 }
67 }
68 return null;
69 }
70
71 }