예제 #1
0
 public int compare(Object o1, Object o2) {
   try {
     return ((UMOEvent) o1).getMessageAsString().compareTo(((UMOEvent) o2).getMessageAsString());
   } catch (UMOException e) {
     throw new IllegalArgumentException(e.getMessage());
   }
 }
예제 #2
0
 /**
  * Used to log the error passed into this Exception Listener
  *
  * @param t the exception thrown
  */
 protected void logException(Throwable t) {
   UMOException umoe = ExceptionHelper.getRootMuleException(t);
   if (umoe != null) {
     logger.error(umoe.getDetailedMessage());
   } else {
     logger.error("Caught exception in Exception Strategy: " + t.getMessage(), t);
   }
 }
예제 #3
0
 public void testBadMethodName() throws Exception {
   UMOImmutableEndpoint ep =
       new ImmutableMuleEndpoint("jnp://localhost/TestService?method=foo", false);
   try {
     ep.send(getTestEvent("hello", ep));
   } catch (UMOException e) {
     assertTrue(e.getCause() instanceof NoSuchMethodException);
   }
 }
예제 #4
0
 public void testCorrectMethodType() throws Exception {
   UMOEndpoint ep = new MuleEndpoint("jnp://localhost/TestService?method=reverseString", false);
   ep.setProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES, String.class.getName());
   try {
     ep.send(getTestEvent("hello", ep));
   } catch (UMOException e) {
     assertTrue(e.getCause() instanceof NoSuchMethodException);
   }
 }
예제 #5
0
 public void testNoMethodSet() throws Exception {
   UMOImmutableEndpoint ep = new ImmutableMuleEndpoint("jnp://localhost/TestService", false);
   try {
     ep.send(getTestEvent("hello", ep));
   } catch (UMOException e) {
     assertTrue(e instanceof DispatchException);
     assertTrue(
         e.getMessage()
             .startsWith(Messages.get("rmi", RmiConnector.MSG_PARAM_SERVICE_METHOD_NOT_SET)));
   }
 }
예제 #6
0
  public final synchronized void dispose() {
    // TODO lifecycleManager.checkPhase(Disposable.PHASE_NAME);

    if (isDisposed()) {
      return;
    }

    try {
      doDispose();
      lifecycleManager.firePhase(getManagementContext(), Disposable.PHASE_NAME);
      if (getParent() != null) {
        parent.dispose();
      } else {
        // remove this referenceonce there is no one else left to dispose
        RegistryContext.setRegistry(null);
      }
    } catch (UMOException e) {
      // TO-DO
      logger.error("Failed to cleanly dispose: " + e.getMessage(), e);
    }
  }
예제 #7
0
  /**
   * Will shut down the server displaying the cause and time of the shutdown
   *
   * @param e the exception that caused the shutdown
   */
  void shutdown(Throwable e) {
    Message msg = new Message(Messages.FATAL_ERROR_WHILE_RUNNING);
    UMOException muleException = ExceptionHelper.getRootMuleException(e);
    if (muleException != null) {
      logger.fatal(muleException.getDetailedMessage());
    } else {
      logger.fatal(msg.toString() + " " + e.getMessage(), e);
    }
    List msgs = new ArrayList();
    msgs.add(msg.getMessage());
    Throwable root = ExceptionHelper.getRootException(e);
    msgs.add(root.getMessage() + " (" + root.getClass().getName() + ")");
    msgs.add(" ");
    msgs.add(new Message(Messages.FATAL_ERROR_SHUTDOWN));
    msgs.add(
        new Message(
            Messages.SERVER_STARTED_AT_X, new Date(MuleManager.getInstance().getStartDate())));
    msgs.add(new Message(Messages.SERVER_SHUTDOWN_AT_X, new Date().toString()));

    shutdownMessage = StringMessageHelper.getBoilerPlate(msgs, '*', 80);
    logger.fatal(shutdownMessage);
    System.exit(0);
  }