Java Code Examples for sun.rmi.server.UnicastServerRef#exportObject()

The following examples show how to use sun.rmi.server.UnicastServerRef#exportObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilterUSRTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "bindData")
public void UnicastServerRef(String name, Object obj, int expectedFilterCount) throws RemoteException {
    try {
        RemoteImpl impl = RemoteImpl.create();
        UnicastServerRef ref = new UnicastServerRef(new LiveRef(0), 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())) {
            return; // normal expected exception
        }
        rex.printStackTrace();
        Assert.fail("unexpected remote exception", rex);
    } catch (Exception ex) {
        Assert.fail("unexpected exception", ex);
    }
}
 
Example 2
Source File: FilterUSRTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "bindData")
public void UnicastServerRef(String name, Object obj, int expectedFilterCount) throws RemoteException {
    try {
        RemoteImpl impl = RemoteImpl.create();
        UnicastServerRef ref = new UnicastServerRef(new LiveRef(0), 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())) {
            return; // normal expected exception
        }
        rex.printStackTrace();
        Assert.fail("unexpected remote exception", rex);
    } catch (Exception ex) {
        Assert.fail("unexpected exception", ex);
    }
}
 
Example 3
Source File: FilterUSRTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "bindData")
public void UnicastServerRef(String name, Object obj, int expectedFilterCount) throws RemoteException {
    try {
        RemoteImpl impl = RemoteImpl.create();
        UnicastServerRef ref = new UnicastServerRef(new LiveRef(0), 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())) {
            return; // normal expected exception
        }
        rex.printStackTrace();
        Assert.fail("unexpected remote exception", rex);
    } catch (Exception ex) {
        Assert.fail("unexpected exception", ex);
    }
}
 
Example 4
Source File: Activation.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
ActivationSystemImpl(int port, RMIServerSocketFactory ssf)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote object
     * 'this' can be exported.
     */
    LiveRef lref = new LiveRef(new ObjID(4), port, null, ssf);
    UnicastServerRef uref = new UnicastServerRef(lref);
    ref = uref;
    uref.exportObject(this, null);
}
 
Example 5
Source File: RegistryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void setup(UnicastServerRef uref)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote
     * object 'this' can be exported.
     */
    ref = uref;
    uref.exportObject(this, null, true);
}
 
Example 6
Source File: UnicastRemoteObject.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Exports the specified object using the specified server ref.
 */
private static Remote exportObject(Remote obj, UnicastServerRef sref)
    throws RemoteException
{
    // if obj extends UnicastRemoteObject, set its ref.
    if (obj instanceof UnicastRemoteObject) {
        ((UnicastRemoteObject) obj).ref = sref;
    }
    return sref.exportObject(obj, null, false);
}
 
Example 7
Source File: RegistryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void setup(UnicastServerRef uref)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote
     * object 'this' can be exported.
     */
    ref = uref;
    uref.exportObject(this, null, true);
}
 
Example 8
Source File: Activation.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
ActivationSystemImpl(int port, RMIServerSocketFactory ssf)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote object
     * 'this' can be exported.
     */
    LiveRef lref = new LiveRef(new ObjID(4), port, null, ssf);
    UnicastServerRef uref = new UnicastServerRef(lref);
    ref = uref;
    uref.exportObject(this, null);
}
 
Example 9
Source File: UnicastRemoteObject.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Exports the specified object using the specified server ref.
 */
private static Remote exportObject(Remote obj, UnicastServerRef sref)
    throws RemoteException
{
    // if obj extends UnicastRemoteObject, set its ref.
    if (obj instanceof UnicastRemoteObject) {
        ((UnicastRemoteObject) obj).ref = sref;
    }
    return sref.exportObject(obj, null, false);
}
 
Example 10
Source File: UnicastRemoteObject.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Exports the specified object using the specified server ref.
 */
private static Remote exportObject(Remote obj, UnicastServerRef sref)
    throws RemoteException
{
    // if obj extends UnicastRemoteObject, set its ref.
    if (obj instanceof UnicastRemoteObject) {
        ((UnicastRemoteObject) obj).ref = sref;
    }
    return sref.exportObject(obj, null, false);
}
 
Example 11
Source File: Activation.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a new Activator on a specified port.
 */
ActivatorImpl(int port, RMIServerSocketFactory ssf)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote object
     * 'this' can be exported.
     */
    LiveRef lref =
        new LiveRef(new ObjID(ObjID.ACTIVATOR_ID), port, null, ssf);
    UnicastServerRef uref = new UnicastServerRef(lref);
    ref = uref;
    uref.exportObject(this, null, false);
}
 
Example 12
Source File: Activation.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
ActivationSystemImpl(int port, RMIServerSocketFactory ssf)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote object
     * 'this' can be exported.
     */
    LiveRef lref = new LiveRef(new ObjID(4), port, null, ssf);
    UnicastServerRef uref = new UnicastServerRef(lref);
    ref = uref;
    uref.exportObject(this, null);
}
 
Example 13
Source File: Activation.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
ActivationSystemImpl(int port, RMIServerSocketFactory ssf)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote object
     * 'this' can be exported.
     */
    LiveRef lref = new LiveRef(new ObjID(4), port, null, ssf);
    UnicastServerRef uref = new UnicastServerRef(lref);
    ref = uref;
    uref.exportObject(this, null);
}
 
Example 14
Source File: Activation.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a new Activator on a specified port.
 */
ActivatorImpl(int port, RMIServerSocketFactory ssf)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote object
     * 'this' can be exported.
     */
    LiveRef lref =
        new LiveRef(new ObjID(ObjID.ACTIVATOR_ID), port, null, ssf);
    UnicastServerRef uref = new UnicastServerRef(lref);
    ref = uref;
    uref.exportObject(this, null, false);
}
 
Example 15
Source File: UnicastRemoteObject.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Exports the specified object using the specified server ref.
 */
private static Remote exportObject(Remote obj, UnicastServerRef sref)
    throws RemoteException
{
    // if obj extends UnicastRemoteObject, set its ref.
    if (obj instanceof UnicastRemoteObject) {
        ((UnicastRemoteObject) obj).ref = sref;
    }
    return sref.exportObject(obj, null, false);
}
 
Example 16
Source File: Activation.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a new Activator on a specified port.
 */
ActivatorImpl(int port, RMIServerSocketFactory ssf)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote object
     * 'this' can be exported.
     */
    LiveRef lref =
        new LiveRef(new ObjID(ObjID.ACTIVATOR_ID), port, null, ssf);
    UnicastServerRef uref = new UnicastServerRef(lref);
    ref = uref;
    uref.exportObject(this, null, false);
}
 
Example 17
Source File: UnicastRemoteObject.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Exports the specified object using the specified server ref.
 */
private static Remote exportObject(Remote obj, UnicastServerRef sref)
    throws RemoteException
{
    // if obj extends UnicastRemoteObject, set its ref.
    if (obj instanceof UnicastRemoteObject) {
        ((UnicastRemoteObject) obj).ref = sref;
    }
    return sref.exportObject(obj, null, false);
}
 
Example 18
Source File: Activation.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
ActivationSystemImpl(int port, RMIServerSocketFactory ssf)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote object
     * 'this' can be exported.
     */
    LiveRef lref = new LiveRef(new ObjID(4), port, null, ssf);
    UnicastServerRef uref = new UnicastServerRef(lref);
    ref = uref;
    uref.exportObject(this, null);
}
 
Example 19
Source File: RegistryImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void setup(UnicastServerRef uref)
    throws RemoteException
{
    /* Server ref must be created and assigned before remote
     * object 'this' can be exported.
     */
    ref = uref;
    uref.exportObject(this, null, true);
}
 
Example 20
Source File: UnicastRemoteObject.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Exports the specified object using the specified server ref.
 */
private static Remote exportObject(Remote obj, UnicastServerRef sref)
    throws RemoteException
{
    // if obj extends UnicastRemoteObject, set its ref.
    if (obj instanceof UnicastRemoteObject) {
        ((UnicastRemoteObject) obj).ref = sref;
    }
    return sref.exportObject(obj, null, false);
}