public Object intercept(Invocation invocation) throws Exception {
   try {
     logger.info("{} starting", invocation.getPath());
     return invocation.invoke();
   } catch (Exception e) {
     logger.error("{} exception thrown", invocation.getPath(), e);
     throw e;
   } finally {
     logger.info("{} completed", invocation.getPath());
   }
 }
예제 #2
0
  public Object intercept(Invocation invocation) throws Exception {
    Channel channel = null;
    try {
      channel = beanFactory.establish(protocol, Channel.class);
      channel.initialize(host, port, invocation.getPath(), timeout, format);

      channel.getAttributes().putAll(client.getAttributes());
      channel.addAttribute(CHANNEL_INVOCATION_ATTRIBUTE_KEY, invocation);

      Set<Filter<Channel>> _filters = new LinkedHashSet<Filter<Channel>>();
      _filters.add(this);
      new FixedFilterChain<Channel>(_filters).go(channel);

      return invocation.getResult();
    } catch (Exception e) {
      throw e;
    } finally {
      IOToolkit.close(channel);
    }
  }