⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 primarykeygeneratorimpl.java

📁 EJB3.0请一定要上载质量高而且本站没有的源码
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -