use of sun.rmi.server.UnicastServerRef2 in project jdk8u_jdk by JetBrains.
the class RMIJRMPServerImpl method export.
private void export(Remote obj) throws RemoteException {
final RMIExporter exporter = (RMIExporter) env.get(RMIExporter.EXPORTER_ATTRIBUTE);
final boolean daemon = EnvHelp.isServerDaemon(env);
if (daemon && exporter != null) {
throw new IllegalArgumentException("If " + EnvHelp.JMX_SERVER_DAEMON + " is specified as true, " + RMIExporter.EXPORTER_ATTRIBUTE + " cannot be used to specify an exporter!");
}
if (daemon) {
if (csf == null && ssf == null) {
new UnicastServerRef(port).exportObject(obj, null, true);
} else {
new UnicastServerRef2(port, csf, ssf).exportObject(obj, null, true);
}
} else if (exporter != null) {
exporter.exportObject(obj, port, csf, ssf);
} else {
UnicastRemoteObject.exportObject(obj, port, csf, ssf);
}
}
use of sun.rmi.server.UnicastServerRef2 in project jdk8u_jdk by JetBrains.
the class FilterUSRTest method UnicastServerRef2.
/*
* Test exporting an object with a serialFilter using UnicastServerRef2.exportObject()
* with explicit (but null) SocketFactories.
* Send some objects and check the number of calls to the serialFilter.
*/
@Test(dataProvider = "bindData")
public void UnicastServerRef2(String name, Object obj, int expectedFilterCount) throws RemoteException {
try {
RemoteImpl impl = RemoteImpl.create();
UnicastServerRef2 ref = new UnicastServerRef2(0, null, null, impl.checker);
Echo client = (Echo) ref.exportObject(impl, null, false);
int count = client.filterCount(obj);
System.out.printf("count: %d, obj: %s%n", count, obj);
Assert.assertEquals(count, expectedFilterCount, "wrong number of filter calls");
} catch (RemoteException rex) {
if (expectedFilterCount == -1 && UnmarshalException.class.equals(rex.getCause().getClass()) && InvalidClassException.class.equals(rex.getCause().getCause().getClass())) {
// normal expected exception
return;
}
rex.printStackTrace();
Assert.fail("unexpected remote exception", rex);
} catch (Exception rex) {
Assert.fail("unexpected exception", rex);
}
}
Aggregations