📄 teller.java
字号:
//定义本类在包examples.cluster.ejb.teller 中
package examples.cluster.ejb.teller;
import javax.ejb.*;
import java.rmi.RemoteException;
/**
* 这是TellerBean的远程接口定义。远程接口中定义了客户端能远程调用EJBean的方法。这些方法除了
* 要抛出异常java.rmi.RemoteException之外,和EJBean中的定义是一致的。但并不是EJBean来实
* 现这个接口,而是由容器自动产生的类TellerBeanE实现的。
*/
//这个接口必须继承javax.ejb.EJBObject接口
public interface Teller extends EJBObject {
/**
* 远程方法:结算
* @参数 String accountId 账号id
* @返回 TellerResult 结算结果
* @异常 RemoteException 当系统通讯发生故障时抛出
* @异常 TellerException 操作错误
*/
public TellerResult balance(String accountId)
throws TellerException, RemoteException;
/**
* 存入
*
*@参数 accountId string 账号ID
*@参数 amount double 存入的数目
*@参数 transactionId string 业务ID
* @返回 TellerResult 结果
* @异常 examples.cluster.ejb.teller.TellerException
* 如果存入发生异常
* @异常 RemoteException 如果通信错误
*/
public TellerResult deposit(String accountId, double amount, String transactionId)
throws TellerException, RemoteException;
/**
* 提取
*
*@参数 accountId string 账号ID
*@参数 amount double 提取的数目
*@参数 transactionId string 业务ID
* @返回 TellerResult 结果
* @异常 examples.cluster.ejb.teller.TellerException
* 如果提取发生异常
* @异常 RemoteException 如果通信错误
*/
public TellerResult withdraw (String accountId, double amount, String transactionId)
throws TellerException, RemoteException;
/**
* 使用给定的账号转账
*
*@参数 accountFrom string 源账号ID
*@参数 accountTo string 目的账号
*@参数 amount double 转账数目
*@参数 transactionId string 业务ID
* @返回 TellerResult 业务结果
* @异常 examples.cluster.ejb.teller.TellerException
* 如果转账发生异常
* @异常 RemoteException 如果通信错误
*/
public TellerResult transfer(String accountFromId, String accountToId, double amount, String transactionId)
throws TellerException, RemoteException;
/**
* 如果指定id的业务完成了,则返回true(即,业务ID在业务日志业务表中)
* 注意这个代码特定于Oracle数据库,对于其他数据库需修正
*
* @参数 transactionID string 业务ID
* @返回 Boolean
* @异常 RemoteException 如果通信错误
*/
public boolean checkTransactionId(String transactionId)
throws RemoteException;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -