UnicastServerRef2.java revision 10444:f08705540498
1/*
2 * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package sun.rmi.server;
27
28import java.io.IOException;
29import java.io.ObjectOutput;
30import java.rmi.*;
31import java.rmi.server.*;
32import sun.rmi.transport.*;
33import sun.rmi.transport.tcp.*;
34
35/**
36 * Server-side ref for a remote impl that uses a custom socket factory.
37 *
38 * @author Ann Wollrath
39 * @author Roger Riggs
40 */
41public class UnicastServerRef2 extends UnicastServerRef
42{
43    // use serialVersionUID from JDK 1.2.2 for interoperability
44    private static final long serialVersionUID = -2289703812660767614L;
45
46    /**
47     * Create a new (empty) Unicast server remote reference.
48     */
49    public UnicastServerRef2()
50    {}
51
52    /**
53     * Construct a Unicast server remote reference for a specified
54     * liveRef.
55     */
56    public UnicastServerRef2(LiveRef ref)
57    {
58        super(ref);
59    }
60
61    /**
62     * Construct a Unicast server remote reference to be exported
63     * on the specified port.
64     */
65    public UnicastServerRef2(int port,
66                             RMIClientSocketFactory csf,
67                             RMIServerSocketFactory ssf)
68    {
69        super(new LiveRef(port, csf, ssf));
70    }
71
72    /**
73     * Returns the class of the ref type to be serialized
74     */
75    public String getRefClass(ObjectOutput out)
76    {
77        return "UnicastServerRef2";
78    }
79
80    /**
81     * Return the client remote reference for this remoteRef.
82     * In the case of a client RemoteRef "this" is the answer.
83     * For  a server remote reference, a client side one will have to
84     * found or created.
85     */
86    protected RemoteRef getClientRef() {
87        return new UnicastRef2(ref);
88    }
89}
90