1 /*
2 * Copyright (c) 1998, 2008, 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.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 */
111 * object on the native stack and not clear the weak reference to
112 * it in the RMI runtime's object table.
113 */
114 Object dummy = new Object();
115
116 System.setSecurityManager(new RMISecurityManager());
117
118 try {
119 String protocol = "";
120 if (args.length >= 1)
121 protocol = args[0];
122
123 System.out.println("EchoServer: creating remote object");
124 ActivationGroupDesc groupDesc =
125 new ActivationGroupDesc(null, null);
126 ActivationSystem system = ActivationGroup.getSystem();
127 ActivationGroupID groupID = system.registerGroup(groupDesc);
128 ActivationGroup.createGroup(groupID, groupDesc, 0);
129
130 EchoImpl impl = new EchoImpl(protocol);
131 System.out.println("EchoServer: binding in registry");
132 Naming.rebind("//:" + UseCustomSocketFactory.REGISTRY_PORT +
133 "/EchoServer", impl);
134 System.out.println("EchoServer ready.");
135 } catch (Exception e) {
136 System.err.println("EXCEPTION OCCURRED:");
137 e.printStackTrace();
138 }
139 }
140 }
|
1 /*
2 * Copyright (c) 1998, 2012, 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.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 */
111 * object on the native stack and not clear the weak reference to
112 * it in the RMI runtime's object table.
113 */
114 Object dummy = new Object();
115
116 System.setSecurityManager(new RMISecurityManager());
117
118 try {
119 String protocol = "";
120 if (args.length >= 1)
121 protocol = args[0];
122
123 System.out.println("EchoServer: creating remote object");
124 ActivationGroupDesc groupDesc =
125 new ActivationGroupDesc(null, null);
126 ActivationSystem system = ActivationGroup.getSystem();
127 ActivationGroupID groupID = system.registerGroup(groupDesc);
128 ActivationGroup.createGroup(groupID, groupDesc, 0);
129
130 EchoImpl impl = new EchoImpl(protocol);
131 int registryPort = Integer.parseInt(System.getProperty("rmi.registry.port"));
132 System.out.println("EchoServer: binding in registry on port:" + registryPort);
133 Naming.rebind("//:" + registryPort +
134 "/EchoServer", impl);
135 System.out.println("EchoServer ready.");
136 } catch (Exception e) {
137 System.err.println("EXCEPTION OCCURRED:");
138 e.printStackTrace();
139 }
140 }
141 }
|