📄 bank.java
字号:
package houseloan;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.servicemix.components.util.TransformComponentSupport;import javax.jbi.messaging.MessageExchange;import javax.jbi.messaging.MessagingException;import javax.jbi.messaging.NormalizedMessage;public class Bank extends TransformComponentSupport { private static final Log log = LogFactory.getLog(Bank.class); private double rate; private double firstPaidRatio; public double getFirstPaidRatio() { return firstPaidRatio; } public void setFirstPaidRatio(double firstPaidRatio) { this.firstPaidRatio = firstPaidRatio; } public void setRate(double rate1) { rate = rate1; } public double getRate() { return rate; } protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws MessagingException { log.info("Receiving bank request"); out.setProperty(Constants.PROPERTY_RATE, new Double(getRate())); out.setProperty(Constants.FIRST_PAID_RATIO, new Double(getFirstPaidRatio())); // Sleep some time try { Thread.sleep((int) (Math.random() * 10) * 10); } catch (InterruptedException e) { // Discard } return true; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -