primarykeygeneratorimpl.java
来自「EJB3.0请一定要上载质量高而且本站没有的源码」· Java 代码 · 共 29 行
JAVA
29 行
package examples.jndi;
import java.rmi.RemoteException;
import javax.rmi.PortableRemoteObject;
/**
* The implementation of a remote object which generates primary keys
*/
public class PrimaryKeyGeneratorImpl
extends PortableRemoteObject
implements PrimaryKeyGenerator {
private static long i = System.currentTimeMillis();
public PrimaryKeyGeneratorImpl() throws Exception, RemoteException {
/*
* Since we extend PortableRemoteObject, the super
* class will export our remote object here.
*/
super();
}
/**
* Generates a unique primary key
*/
public synchronized long generate() throws RemoteException {
return i++;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?