Java Code Examples for java.rmi.UnmarshalException

The following examples show how to use java.rmi.UnmarshalException. These examples are extracted from open source projects. 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 Project: jdk1.8-source-analysis   Source File: ActivationID.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Activate the object for this id.
 *
 * @param force if true, forces the activator to contact the group
 * when activating the object (instead of returning a cached reference);
 * if false, returning a cached value is acceptable.
 * @return the reference to the active remote object
 * @exception ActivationException if activation fails
 * @exception UnknownObjectException if the object is unknown
 * @exception RemoteException if remote call fails
 * @since 1.2
 */
public Remote activate(boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    try {
        MarshalledObject<? extends Remote> mobj =
            activator.activate(this, force);
        return AccessController.doPrivileged(
            new PrivilegedExceptionAction<Remote>() {
                public Remote run() throws IOException, ClassNotFoundException {
                    return mobj.get();
                }
            }, NOPERMS_ACC);
    } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof RemoteException) {
            throw (RemoteException) ex;
        } else {
            throw new UnmarshalException("activation failed", ex);
        }
    }

}
 
Example 2
Source Project: jdk1.8-source-analysis   Source File: RMIConnector.java    License: Apache License 2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 3
Source Project: dragonwell8_jdk   Source File: ActivationID.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Activate the object for this id.
 *
 * @param force if true, forces the activator to contact the group
 * when activating the object (instead of returning a cached reference);
 * if false, returning a cached value is acceptable.
 * @return the reference to the active remote object
 * @exception ActivationException if activation fails
 * @exception UnknownObjectException if the object is unknown
 * @exception RemoteException if remote call fails
 * @since 1.2
 */
public Remote activate(boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    try {
        MarshalledObject<? extends Remote> mobj =
            activator.activate(this, force);
        return AccessController.doPrivileged(
            new PrivilegedExceptionAction<Remote>() {
                public Remote run() throws IOException, ClassNotFoundException {
                    return mobj.get();
                }
            }, NOPERMS_ACC);
    } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof RemoteException) {
            throw (RemoteException) ex;
        } else {
            throw new UnmarshalException("activation failed", ex);
        }
    }

}
 
Example 4
Source Project: dragonwell8_jdk   Source File: RMIConnector.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 5
Source Project: gemfirexd-oss   Source File: ClientMgr.java    License: Apache License 2.0 6 votes vote down vote up
/**
 *  Tells the given client vm to exit.  Optionally asks it to disconnect
 *  from GemFire before exiting.
 */
private static void stopClient( ClientVmRecord vm,
                                boolean closeConnection,
		  boolean runShutdownHook) {
  log().info( "Issuing stop request to " + vm.toInfoString() );
  synchronized( vm ) {
    if ( vm.getPid() == ClientVmRecord.NO_PID ) {
      log().info( vm.toInfoString() + " is already stopped" );
      return;
    }
    ClientRecord cr = vm.getRepresentativeClient();
    try {
      cr.getTestModule().shutDownVM( closeConnection, runShutdownHook );
    } catch( UnmarshalException ignore ) {
      // vm is shutting down, don't expect clean reply
    } catch( RemoteException e ) {
      String reason = "Unable to reach client " + cr + " in " + vm;
      throw new HydraRuntimeException( reason, e );
    }
  }
  log().info( "Issued stop request to " + vm.toInfoString() );
}
 
Example 6
Source Project: TencentKona-8   Source File: ActivationID.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Activate the object for this id.
 *
 * @param force if true, forces the activator to contact the group
 * when activating the object (instead of returning a cached reference);
 * if false, returning a cached value is acceptable.
 * @return the reference to the active remote object
 * @exception ActivationException if activation fails
 * @exception UnknownObjectException if the object is unknown
 * @exception RemoteException if remote call fails
 * @since 1.2
 */
public Remote activate(boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    try {
        MarshalledObject<? extends Remote> mobj =
            activator.activate(this, force);
        return AccessController.doPrivileged(
            new PrivilegedExceptionAction<Remote>() {
                public Remote run() throws IOException, ClassNotFoundException {
                    return mobj.get();
                }
            }, NOPERMS_ACC);
    } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof RemoteException) {
            throw (RemoteException) ex;
        } else {
            throw new UnmarshalException("activation failed", ex);
        }
    }

}
 
Example 7
Source Project: TencentKona-8   Source File: RMIConnector.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 8
Source Project: jdk8u60   Source File: RMIConnector.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 9
Source Project: JDKSourceCode1.8   Source File: ActivationID.java    License: MIT License 6 votes vote down vote up
/**
 * Activate the object for this id.
 *
 * @param force if true, forces the activator to contact the group
 * when activating the object (instead of returning a cached reference);
 * if false, returning a cached value is acceptable.
 * @return the reference to the active remote object
 * @exception ActivationException if activation fails
 * @exception UnknownObjectException if the object is unknown
 * @exception RemoteException if remote call fails
 * @since 1.2
 */
public Remote activate(boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    try {
        MarshalledObject<? extends Remote> mobj =
            activator.activate(this, force);
        return AccessController.doPrivileged(
            new PrivilegedExceptionAction<Remote>() {
                public Remote run() throws IOException, ClassNotFoundException {
                    return mobj.get();
                }
            }, NOPERMS_ACC);
    } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof RemoteException) {
            throw (RemoteException) ex;
        } else {
            throw new UnmarshalException("activation failed", ex);
        }
    }

}
 
Example 10
Source Project: JDKSourceCode1.8   Source File: RMIConnector.java    License: MIT License 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 11
Source Project: openjdk-jdk8u   Source File: ActivationID.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Activate the object for this id.
 *
 * @param force if true, forces the activator to contact the group
 * when activating the object (instead of returning a cached reference);
 * if false, returning a cached value is acceptable.
 * @return the reference to the active remote object
 * @exception ActivationException if activation fails
 * @exception UnknownObjectException if the object is unknown
 * @exception RemoteException if remote call fails
 * @since 1.2
 */
public Remote activate(boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    try {
        MarshalledObject<? extends Remote> mobj =
            activator.activate(this, force);
        return AccessController.doPrivileged(
            new PrivilegedExceptionAction<Remote>() {
                public Remote run() throws IOException, ClassNotFoundException {
                    return mobj.get();
                }
            }, NOPERMS_ACC);
    } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof RemoteException) {
            throw (RemoteException) ex;
        } else {
            throw new UnmarshalException("activation failed", ex);
        }
    }

}
 
Example 12
Source Project: openjdk-jdk8u   Source File: RMIConnector.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 13
Source Project: openjdk-jdk8u   Source File: FilterUSRTest.java    License: 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 14
Source Project: jdk8u-dev-jdk   Source File: RMIConnector.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 15
/**
 * Activate the object for this id.
 *
 * @param force if true, forces the activator to contact the group
 * when activating the object (instead of returning a cached reference);
 * if false, returning a cached value is acceptable.
 * @return the reference to the active remote object
 * @exception ActivationException if activation fails
 * @exception UnknownObjectException if the object is unknown
 * @exception RemoteException if remote call fails
 * @since 1.2
 */
public Remote activate(boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    try {
        MarshalledObject<? extends Remote> mobj =
            activator.activate(this, force);
        return AccessController.doPrivileged(
            new PrivilegedExceptionAction<Remote>() {
                public Remote run() throws IOException, ClassNotFoundException {
                    return mobj.get();
                }
            }, NOPERMS_ACC);
    } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof RemoteException) {
            throw (RemoteException) ex;
        } else {
            throw new UnmarshalException("activation failed", ex);
        }
    }

}
 
Example 16
Source Project: jdk8u_jdk   Source File: RMIConnector.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 17
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 18
@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 19
Source Project: openjdk-jdk9   Source File: ActivationID.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Activate the object for this id.
 *
 * @param force if true, forces the activator to contact the group
 * when activating the object (instead of returning a cached reference);
 * if false, returning a cached value is acceptable.
 * @return the reference to the active remote object
 * @exception ActivationException if activation fails
 * @exception UnknownObjectException if the object is unknown
 * @exception RemoteException if remote call fails
 * @since 1.2
 */
public Remote activate(boolean force)
    throws ActivationException, UnknownObjectException, RemoteException
{
    try {
        MarshalledObject<? extends Remote> mobj =
            activator.activate(this, force);
        return AccessController.doPrivileged(
            new PrivilegedExceptionAction<Remote>() {
                public Remote run() throws IOException, ClassNotFoundException {
                    return mobj.get();
                }
            }, NOPERMS_ACC);
    } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof RemoteException) {
            throw (RemoteException) ex;
        } else {
            throw new UnmarshalException("activation failed", ex);
        }
    }

}
 
Example 20
Source Project: jdk8u-jdk   Source File: RMIConnector.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 21
Source Project: jdk8u-jdk   Source File: FilterUSRTest.java    License: 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 22
Source Project: Java8CN   Source File: RMIConnector.java    License: Apache License 2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 23
Source Project: hottub   Source File: RMIConnector.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void rethrowDeserializationException(IOException ioe)
        throws ClassNotFoundException, IOException {
    // specially treating for an UnmarshalException
    if (ioe instanceof UnmarshalException) {
        throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
                   // fetch one by one with UnmarshalException
    } else if (ioe instanceof MarshalException) {
        // IIOP will throw MarshalException wrapping a NotSerializableException
        // when a server fails to serialize a response.
        MarshalException me = (MarshalException)ioe;
        if (me.detail instanceof NotSerializableException) {
            throw (NotSerializableException)me.detail;
        }
    }

    // Not serialization problem, return.
}
 
Example 24
Source Project: gemfirexd-oss   Source File: ClientMgr.java    License: Apache License 2.0 6 votes vote down vote up
/**
 *  Tells the given client vm to exit.  Optionally asks it to disconnect
 *  from GemFire before exiting.
 */
private static void stopClient( ClientVmRecord vm,
                                boolean closeConnection,
		  boolean runShutdownHook) {
  log().info( "Issuing stop request to " + vm.toInfoString() );
  synchronized( vm ) {
    if ( vm.getPid() == ClientVmRecord.NO_PID ) {
      log().info( vm.toInfoString() + " is already stopped" );
      return;
    }
    ClientRecord cr = vm.getRepresentativeClient();
    try {
      cr.getTestModule().shutDownVM( closeConnection, runShutdownHook );
    } catch( UnmarshalException ignore ) {
      // vm is shutting down, don't expect clean reply
    } catch( RemoteException e ) {
      String reason = "Unable to reach client " + cr + " in " + vm;
      throw new HydraRuntimeException( reason, e );
    }
  }
  log().info( "Issued stop request to " + vm.toInfoString() );
}
 
Example 25
Source Project: gemfirexd-oss   Source File: ClientMgr.java    License: Apache License 2.0 6 votes vote down vote up
private static void runClientShutdownHook( ClientVmRecord vm ) {
  log().info( "Running client shutdown hook in " + vm.toInfoString() );
  ClientRecord cr = null;
  synchronized( vm ) {
    if ( vm.getPid() == ClientVmRecord.NO_PID ) {
      log().info( vm.toInfoString() + " is stopped: can't run client shutdown hook" );
      return;
    }
    cr = vm.getRepresentativeClient();
  }
  // must run hook outside vm synchronization since it is a fully synchronous
  // RMI call that could hang, deadlocking master attempt to do stack dumps,
  // but all is well since the cr test module is never unset and we already
  // handle an intervening shutdown
  try {
    cr.getTestModule().runShutdownHook( );
  } catch( UnmarshalException ignore ) {
    // vm is shutting down, don't expect clean reply
  } catch( RemoteException e ) {
    String reason = "Unable to reach client " + cr + " in " + vm;
    log().severe(reason, e);
  }
  log().info( "Ran client shutdown hook in " + vm.toInfoString() );
}
 
Example 26
private NotificationResult fetchNotifs() {
    try {
        NotificationResult nr = ClientNotifForwarder.this.
            fetchNotifs(clientSequenceNumber,maxNotifications,
                        timeout);

        if (logger.traceOn()) {
            logger.trace("NotifFetcher-run",
                         "Got notifications from the server: "+nr);
        }

        return nr;
    } catch (ClassNotFoundException | NotSerializableException | UnmarshalException e) {
        logger.trace("NotifFetcher.fetchNotifs", e);
        return fetchOneNotif();
    } catch (IOException ioe) {
        if (!shouldStop()) {
            logger.error("NotifFetcher-run",
                         "Failed to fetch notification, " +
                         "stopping thread. Error is: " + ioe, ioe);
            logger.debug("NotifFetcher-run",ioe);
        }

        // no more fetching
        return null;
    }
}
 
Example 27
Source Project: jdk1.8-source-analysis   Source File: RMIConnectionImpl.java    License: Apache License 2.0 5 votes vote down vote up
private <T> T unwrap(final MarshalledObject<?> mo,
                            final ClassLoader cl1,
                            final ClassLoader cl2,
                            final Class<T> wrappedClass,
                            Subject delegationSubject)
    throws IOException {
    if (mo == null) {
        return null;
    }
    try {
        ClassLoader orderCL = AccessController.doPrivileged(
            new PrivilegedExceptionAction<ClassLoader>() {
                public ClassLoader run() throws Exception {
                    return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(),
                            new OrderClassLoaders(cl1, cl2));
                }
            }
        );
        return unwrap(mo, orderCL, wrappedClass,delegationSubject);
    } catch (PrivilegedActionException pe) {
        Exception e = extractException(pe);
        if (e instanceof IOException) {
            throw (IOException) e;
        }
        if (e instanceof ClassNotFoundException) {
            throw new UnmarshalException(e.toString(), e);
        }
        logger.warning("unwrap", "Failed to unmarshall object: " + e);
        logger.debug("unwrap", e);
    }
    return null;
}
 
Example 28
/**
 * Handle server-side dispatch using the RMI 1.1 stub/skeleton
 * protocol, given a non-negative operation number or negative method hash
 * that has already been read from the call stream.
 * Exceptions are handled by the caller to be sent to the remote client.
 *
 * @param obj the target remote object for the call
 * @param call the "remote call" from which operation and
 * method arguments can be obtained.
 * @param op the operation number
 * @throws Exception if unable to marshal return result or
 * release input or output streams
 */
private void oldDispatch(Remote obj, RemoteCall call, int op)
    throws Exception
{
    long hash;              // hash for matching stub with skeleton

    // read remote call header
    ObjectInput in;
    in = call.getInputStream();
    try {
        Class<?> clazz = Class.forName("sun.rmi.transport.DGCImpl_Skel");
        if (clazz.isAssignableFrom(skel.getClass())) {
            ((MarshalInputStream)in).useCodebaseOnly();
        }
    } catch (ClassNotFoundException ignore) { }

    try {
        hash = in.readLong();
    } catch (Exception ioe) {
        throw new UnmarshalException("error unmarshalling call header", ioe);
    }

    // if calls are being logged, write out object id and operation
    Operation[] operations = skel.getOperations();
    logCall(obj, op >= 0 && op < operations.length ?  operations[op] : "op: " + op);
    unmarshalCustomCallData(in);
    // dispatch to skeleton for remote object
    skel.dispatch(obj, call, op, hash);
}
 
Example 29
private NotificationResult fetchNotifs() {
    try {
        NotificationResult nr = ClientNotifForwarder.this.
            fetchNotifs(clientSequenceNumber,maxNotifications,
                        timeout);

        if (logger.traceOn()) {
            logger.trace("NotifFetcher-run",
                         "Got notifications from the server: "+nr);
        }

        return nr;
    } catch (ClassNotFoundException | NotSerializableException | UnmarshalException e) {
        logger.trace("NotifFetcher.fetchNotifs", e);
        return fetchOneNotif();
    } catch (IOException ioe) {
        if (!shouldStop()) {
            logger.error("NotifFetcher-run",
                         "Failed to fetch notification, " +
                         "stopping thread. Error is: " + ioe, ioe);
            logger.debug("NotifFetcher-run",ioe);
        }

        // no more fetching
        return null;
    }
}
 
Example 30
Source Project: gemfirexd-oss   Source File: HostAgentMgr.java    License: Apache License 2.0 5 votes vote down vote up
/**
*
* Tell a particular hostagent to exit.
*
*/
private static void shutDownHostAgent( HostAgentRecord har ) {
  try {
    har.getHostAgent().shutDownHostAgent();
  } catch ( UnmarshalException ignore ) {
    // vm is shutting down, don't expect clean reply
  } catch ( RemoteException e ) {
    // vm is shutting down, don't expect clean reply
  }
}