1 22 package org.jboss.net.sockets; 23 24 import java.io.IOException ; 25 import java.io.Serializable ; 26 import java.rmi.server.RMIClientSocketFactory ; 27 import java.net.Socket ; 28 import EDU.oswego.cs.dl.util.concurrent.FIFOSemaphore; 29 30 37 public class TimeoutClientSocketFactory 38 implements RMIClientSocketFactory , Serializable 39 { 40 private static final long serialVersionUID = -920483051658660269L; 41 42 public TimeoutClientSocketFactory() 43 { 44 } 45 46 55 public Socket createSocket(String host, int port) throws IOException 56 { 57 Socket s = new Socket (host, port); 58 s.setSoTimeout(1000); 59 TimeoutSocket ts = new TimeoutSocket(s); 60 return ts; 61 } 62 63 public boolean equals(Object obj) 64 { 65 return obj instanceof TimeoutClientSocketFactory; 66 } 67 public int hashCode() 68 { 69 return getClass().getName().hashCode(); 70 } 71 72 } 73 | Popular Tags |