?? identityclientsocketfactory.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 + -