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

📄 identityclientsocketfactory.java

📁 分别介绍RMI,分布式对象与CORBA,动态接口,CORBA客户端开发的课件,以及相关的例子
💻 JAVA
字号:
/*
 * Copyright 1999 by dreamBean Software,
 * All rights reserved.
 */
package masteringrmi.hellosocket.interfaces;

import java.io.IOException;
import java.net.Socket;
import java.rmi.RemoteException;
import java.rmi.server.RMIClientSocketFactory;

/**
 *   This is the socket factory that creates the client sockets.
 *   
 *   It implements equals and hashCode so that it, and its connections,
 *   may be reused for multiple calls.   
 *
 *   @see IdentityServerSocketFactory
 *   @see IdentitySocket
 *   @author Rickard 謆erg
 *   @version $Revision:$
 */
public class IdentityClientSocketFactory
   implements RMIClientSocketFactory, java.io.Serializable
{
   // RMIClientSocketFactory implementation -------------------------
   /**
    *   Create a remote object of this class. The default constructor
    *   of UnicastRemoteObject is automatically called, which causes
    *   this object to be exported on a default port.
    *
    * @exception   IOException  thrown if creation failed
    * @return a new socket connected to host:port
    */
   public Socket createSocket(String host, int port)
      throws IOException
   {
      
      // Create a new IdentitySocket which can identiy this client for the server
      return new IdentitySocket(host, port);
   }
   
   // Object overriders ---------------------------------------------
   
   public boolean equals(Object obj)
   {
      return obj instanceof IdentityClientSocketFactory;
   }
   
   public int hashCode()
   {
      return getClass().toString().hashCode();
   }
   
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -