bank.java

来自「基于eclipse环境下开发的servicemix例程」· Java 代码 · 共 53 行

JAVA
53
字号
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 + =
减小字号Ctrl + -
显示快捷键?