java.rmi.RemoteException.getCause()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中java.rmi.RemoteException.getCause方法的一些代码示例,展示了RemoteException.getCause的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteException.getCause方法的具体详情如下:
包路径:java.rmi.RemoteException
类名称:RemoteException
方法名:getCause

RemoteException.getCause介绍

[英]Returns the wrapped remote exception (the cause).
[中]返回包装的远程异常(原因)。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Determine whether the given RMI exception indicates a connect failure.
 * <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException,
 * NoSuchObjectException and StubNotFoundException as connect failure.
 * @param ex the RMI exception to check
 * @return whether the exception should be treated as connect failure
 * @see java.rmi.ConnectException
 * @see java.rmi.ConnectIOException
 * @see java.rmi.UnknownHostException
 * @see java.rmi.NoSuchObjectException
 * @see java.rmi.StubNotFoundException
 */
public static boolean isConnectFailure(RemoteException ex) {
  return (ex instanceof ConnectException || ex instanceof ConnectIOException ||
      ex instanceof UnknownHostException || ex instanceof NoSuchObjectException ||
      ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException);
}

代码示例来源:origin: org.springframework/spring-context

/**
 * Determine whether the given RMI exception indicates a connect failure.
 * <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException,
 * NoSuchObjectException and StubNotFoundException as connect failure.
 * @param ex the RMI exception to check
 * @return whether the exception should be treated as connect failure
 * @see java.rmi.ConnectException
 * @see java.rmi.ConnectIOException
 * @see java.rmi.UnknownHostException
 * @see java.rmi.NoSuchObjectException
 * @see java.rmi.StubNotFoundException
 */
public static boolean isConnectFailure(RemoteException ex) {
  return (ex instanceof ConnectException || ex instanceof ConnectIOException ||
      ex instanceof UnknownHostException || ex instanceof NoSuchObjectException ||
      ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException);
}

代码示例来源:origin: org.cojen/dirmi

/**
 * Returns the Throwable which was reconstructed, or null if not possible.
 */
@Override
public Throwable getCause() {
  return super.getCause();
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Determine whether the given RMI exception indicates a connect failure.
 * <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException,
 * NoSuchObjectException and StubNotFoundException as connect failure.
 * @param ex the RMI exception to check
 * @return whether the exception should be treated as connect failure
 * @see java.rmi.ConnectException
 * @see java.rmi.ConnectIOException
 * @see java.rmi.UnknownHostException
 * @see java.rmi.NoSuchObjectException
 * @see java.rmi.StubNotFoundException
 */
public static boolean isConnectFailure(RemoteException ex) {
  return (ex instanceof ConnectException || ex instanceof ConnectIOException ||
      ex instanceof UnknownHostException || ex instanceof NoSuchObjectException ||
      ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException);
}

代码示例来源:origin: org.apache.openejb/openejb-axis

public Throwable unwrapFault(final RemoteException re) {
    if (re instanceof AxisFault && re.getCause() != null) {
      final Throwable t = re.getCause();
      if (operationDesc.getFaultByClass(t.getClass()) != null) {
        return t;
      }
    }
    return re;
  }
}

代码示例来源:origin: edu.stanford.protege/org.protege.owl.server

private OWLServerException processException(RemoteException re) {
  for (Throwable cause = re.getCause(); cause != null; cause = cause.getCause()) {
    if (cause instanceof OWLServerException) {
      return (OWLServerException) cause;
    }
  }
  return new OWLServerException(re);
}

代码示例来源:origin: apache/jackrabbit

/**
 * Converts the {@link javax.jcr.observation.Event} instances in the given
 * iterator to an instance of {@link RemoteEventCollection} for them to be dispatched
 * to the client-side event listener.
 *
 * @param events The {@link javax.jcr.observation.Event Events} to be
 *      dispatched.
 */
public void onEvent(EventIterator events) {
  try {
    RemoteEventCollection remoteEvent = factory.getRemoteEvent(listenerId, events);
    queue.put(remoteEvent);
  } catch (RemoteException re) {
    Throwable t = (re.getCause() == null) ? re : re.getCause();
    log.error("Problem creating remote event for " + listenerId, t);
  }
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

@Override
public void sampleOccurred(SampleEvent e) {
  try {
    listener.sampleOccurred(e);
  } catch (RemoteException err) {
    if (err.getCause() instanceof java.net.ConnectException){
      throw new JMeterError("Could not return sample",err);
    }
    log.error("sampleOccurred", err);
  }
}

代码示例来源:origin: org.apache.taverna.server/taverna-server-worker

@Override
public RemoteSecurityContext getSecurityContext() throws RemoteException,
    ImplementationException {
  try {
    return new SecurityDelegate(masterToken);
  } catch (RemoteException e) {
    if (e.getCause() != null)
      throw new ImplementationException(
          "problem initializing security context", e.getCause());
    throw e;
  } catch (IOException e) {
    throw new ImplementationException(
        "problem initializing security context", e);
  }
}

代码示例来源:origin: uk.org.taverna.server/server-worker

@Override
public RemoteSecurityContext getSecurityContext() throws RemoteException,
    ImplementationException {
  try {
    return new SecurityDelegate(masterToken);
  } catch (RemoteException e) {
    if (e.getCause() != null)
      throw new ImplementationException(
          "problem initializing security context", e.getCause());
    throw e;
  } catch (IOException e) {
    throw new ImplementationException(
        "problem initializing security context", e);
  }
}

代码示例来源:origin: io.github.cloudiator.lance/client

private static void handleRemoteException(RemoteException re)
  throws LcaException, RegistrationException {
  Throwable t = re.getCause();
  if (t == null)
    throw new LcaException("network exception occurred");
  if (t instanceof LcaException)
    throw (LcaException) t;
  if (t instanceof RegistrationException)
    throw (RegistrationException) t;
  throw new LcaException("downstream exception occurred.", t);
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

listener.processBatch(l);
} catch (RemoteException err) {
  if (err.getCause() instanceof java.net.ConnectException){
    throw new JMeterError("Could not return sample",err);

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

listener.sampleOccurred((SampleEvent) obj);
} catch (RemoteException err) {
  if (err.getCause() instanceof java.net.ConnectException){
    throw new JMeterError("Could not return sample",err);

代码示例来源:origin: com.github.akurilov/fiber4j

final Throwable cause = e.getCause();
if(!(cause instanceof EOFException)) {
  LOG.log(Level.WARNING, "Invocation failure", e);

代码示例来源:origin: org.kuali.jotm/jotm-core

recoveryCoord = remoteCoord.register_resource(subcoord);
} catch (RemoteException e) {
  TraceTm.jotm.warn("Cannot make interposition :" + e.getCause());
  return;
} finally {

代码示例来源:origin: com.github.akurilov/java-concurrent

final Throwable cause = e.getCause();
if(!(cause instanceof EOFException)) {
  LOG.log(Level.WARNING, "Invocation failure", e);

代码示例来源:origin: org.ow2.jotm/jotm-core

recoveryCoord = remoteCoord.register_resource(subcoord);
} catch (RemoteException e) {
  TraceTm.jotm.warn("Cannot make interposition :" + e.getCause(), e);
  return;
} finally {

代码示例来源:origin: com.github.akurilov/java-concurrent

final Throwable cause = e.getCause();
if(cause instanceof EOFException) {
  try {

代码示例来源:origin: com.github.akurilov/fiber4j

final Throwable cause = e.getCause();
if(cause instanceof EOFException) {
  try {

代码示例来源:origin: xap/xap

@SuppressWarnings("deprecation")
public Object update(Object entry, Transaction txn, long lease, long timeout, int modifiers)
    throws TransactionException, UnusableEntryException, RemoteException, InterruptedException {
  if (!UpdateModifiers.isWriteOnly(modifiers) && !UpdateModifiers.isUpdateOrWrite(modifiers))
    modifiers = Modifiers.add(modifiers, UpdateModifiers.UPDATE_ONLY);
  if (!UpdateModifiers.isNoReturnValue(modifiers))
    modifiers = Modifiers.add(modifiers, UpdateModifiers.RETURN_PREV_ON_UPDATE);
  try {
    LeaseContext<?> result = _actionManager.write(entry, txn, lease, timeout, modifiers);
    return result == null ? null : result.getObject();
  } catch (RemoteException e) {
    Throwable cause = e.getCause();
    if (cause instanceof EntryNotInSpaceException)
      throw (EntryNotInSpaceException) cause;
    if (cause instanceof EntryAlreadyInSpaceException)
      throw (EntryAlreadyInSpaceException) cause;
    if (cause instanceof EntryVersionConflictException)
      throw (EntryVersionConflictException) cause;
    throw e;
  } catch (InterruptedSpaceException e) {
    Throwable cause = e.getCause();
    if (cause instanceof InterruptedException)
      throw (InterruptedException) cause;
    throw e;
  }
}

相关文章