15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* @test 25 * @bug 4486732 26 * @summary When a remote stub contains a client socket factory and a 27 * remote invocation is made using that stub, the factory should not 28 * be held strongly reachable by the RMI implementation forever; in 29 * particular, after the stub has become unreachable and all 30 * connections to its endpoint have been closed, then the factory 31 * should become unreachable too (through the RMI implementation). 32 * @author Peter Jones 33 * 34 * @library ../../testlibrary 35 * @build TestLibrary 36 * @run main/othervm -Dsun.rmi.transport.connectionTimeout=2000 37 * PinClientSocketFactory 38 */ 39 40 import java.io.IOException; 41 import java.io.ObjectInputStream; 42 import java.io.Serializable; 43 import java.lang.ref.Reference; 44 import java.lang.ref.WeakReference; 45 import java.net.ServerSocket; 46 import java.net.Socket; 47 import java.rmi.Remote; 48 import java.rmi.RemoteException; 49 import java.rmi.registry.LocateRegistry; 50 import java.rmi.registry.Registry; 51 import java.rmi.server.RMIClientSocketFactory; 52 import java.rmi.server.RMIServerSocketFactory; 53 import java.rmi.server.UnicastRemoteObject; 54 import java.util.ArrayList; | 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* @test 25 * @bug 4486732 26 * @summary When a remote stub contains a client socket factory and a 27 * remote invocation is made using that stub, the factory should not 28 * be held strongly reachable by the RMI implementation forever; in 29 * particular, after the stub has become unreachable and all 30 * connections to its endpoint have been closed, then the factory 31 * should become unreachable too (through the RMI implementation). 32 * @author Peter Jones 33 * 34 * @library ../../testlibrary 35 * @modules java.rmi/sun.rmi.registry 36 * java.rmi/sun.rmi.server 37 * java.rmi/sun.rmi.transport 38 * java.rmi/sun.rmi.transport.tcp 39 * @build TestLibrary 40 * @run main/othervm -Dsun.rmi.transport.connectionTimeout=2000 41 * PinClientSocketFactory 42 */ 43 44 import java.io.IOException; 45 import java.io.ObjectInputStream; 46 import java.io.Serializable; 47 import java.lang.ref.Reference; 48 import java.lang.ref.WeakReference; 49 import java.net.ServerSocket; 50 import java.net.Socket; 51 import java.rmi.Remote; 52 import java.rmi.RemoteException; 53 import java.rmi.registry.LocateRegistry; 54 import java.rmi.registry.Registry; 55 import java.rmi.server.RMIClientSocketFactory; 56 import java.rmi.server.RMIServerSocketFactory; 57 import java.rmi.server.UnicastRemoteObject; 58 import java.util.ArrayList; |