| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.rice.ksb.messaging.service.impl; |
| 18 | |
|
| 19 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
| 20 | |
import org.kuali.rice.core.api.lifecycle.BaseLifecycle; |
| 21 | |
import org.kuali.rice.ksb.messaging.service.BusAdminService; |
| 22 | |
import org.kuali.rice.ksb.messaging.threadpool.KSBThreadPool; |
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | 0 | public class BusAdminServiceImpl extends BaseLifecycle implements BusAdminService { |
| 31 | |
|
| 32 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BusAdminServiceImpl.class); |
| 33 | |
|
| 34 | |
private KSBThreadPool threadPool; |
| 35 | |
|
| 36 | |
public void setThreadPool(KSBThreadPool threadPool) { |
| 37 | 0 | this.threadPool = threadPool; |
| 38 | 0 | } |
| 39 | |
|
| 40 | |
protected KSBThreadPool getThreadPool() { |
| 41 | 0 | return this.threadPool; |
| 42 | |
} |
| 43 | |
|
| 44 | |
public void ping() { |
| 45 | 0 | } |
| 46 | |
|
| 47 | |
public void setCorePoolSize(int corePoolSize) { |
| 48 | 0 | LOG.info("Setting core pool size to " + corePoolSize); |
| 49 | 0 | getThreadPool().setCorePoolSize(corePoolSize); |
| 50 | 0 | } |
| 51 | |
|
| 52 | |
public void setMaximumPoolSize(int maxPoolSize) { |
| 53 | 0 | LOG.info("Setting max pool size to " + maxPoolSize); |
| 54 | 0 | if (maxPoolSize < getThreadPool().getCorePoolSize()) { |
| 55 | 0 | maxPoolSize = getThreadPool().getCorePoolSize(); |
| 56 | |
} |
| 57 | 0 | getThreadPool().setMaximumPoolSize(maxPoolSize); |
| 58 | 0 | } |
| 59 | |
|
| 60 | |
public void setConfigProperty(String propertyName, String propertyValue) { |
| 61 | 0 | String originalValue = ConfigContext.getCurrentContextConfig().getProperty(propertyName); |
| 62 | 0 | LOG.info("Changing config property '" + propertyName + "' from " + originalValue + " to " + propertyValue); |
| 63 | 0 | if (propertyValue == null) { |
| 64 | 0 | ConfigContext.getCurrentContextConfig().removeProperty(propertyName); |
| 65 | |
} else { |
| 66 | 0 | ConfigContext.getCurrentContextConfig().putProperty(propertyName, propertyValue); |
| 67 | |
} |
| 68 | 0 | } |
| 69 | |
|
| 70 | |
public void start() throws Exception { |
| 71 | 0 | if (getThreadPool() == null) { |
| 72 | 0 | throw new IllegalStateException("The threadPool has not been set on the busAdminService"); |
| 73 | |
} |
| 74 | 0 | setStarted(true); |
| 75 | 0 | } |
| 76 | |
|
| 77 | |
public void stop() throws Exception { |
| 78 | 0 | setStarted(false); |
| 79 | 0 | } |
| 80 | |
|
| 81 | |
} |