• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ServiceException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.vertx.serviceproxy.ServiceException的典型用法代码示例。如果您正苦于以下问题:Java ServiceException类的具体用法?Java ServiceException怎么用?Java ServiceException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ServiceException类属于io.vertx.serviceproxy包,在下文中一共展示了ServiceException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: PortfolioServiceVertxProxyHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public PortfolioServiceVertxProxyHandler(Vertx vertx, PortfolioService service, boolean topLevel, long timeoutSeconds) {
  this.vertx = vertx;
  this.service = service;
  this.timeoutSeconds = timeoutSeconds;
  try {
    this.vertx.eventBus().registerDefaultCodec(ServiceException.class,
        new ServiceExceptionMessageCodec());
  } catch (IllegalStateException ex) {}
  if (timeoutSeconds != -1 && !topLevel) {
    long period = timeoutSeconds * 1000 / 2;
    if (period > 10000) {
      period = 10000;
    }
    this.timerID = vertx.setPeriodic(period, this::checkTimedOut);
  } else {
    this.timerID = -1;
  }
  accessed();
}
 
开发者ID:cescoffier,项目名称:vertx-kubernetes-workshop,代码行数:20,代码来源:PortfolioServiceVertxProxyHandler.java


示例2: createHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
private <T> Handler<AsyncResult<T>> createHandler(Message msg) {
  return res -> {
    if (res.failed()) {
      if (res.cause() instanceof ServiceException) {
        msg.reply(res.cause());
      } else {
        msg.reply(new ServiceException(-1, res.cause().getMessage()));
      }
    } else {
      if (res.result() != null  && res.result().getClass().isEnum()) {
        msg.reply(((Enum) res.result()).name());
      } else {
        msg.reply(res.result());
      }
    }
  };
}
 
开发者ID:cescoffier,项目名称:vertx-kubernetes-workshop,代码行数:18,代码来源:PortfolioServiceVertxProxyHandler.java


示例3: createListCharHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
private Handler<AsyncResult<List<Character>>> createListCharHandler(Message msg) {
  return res -> {
    if (res.failed()) {
      if (res.cause() instanceof ServiceException) {
        msg.reply(res.cause());
      } else {
        msg.reply(new ServiceException(-1, res.cause().getMessage()));
      }
    } else {
      JsonArray arr = new JsonArray();
      for (Character chr: res.result()) {
        arr.add((int) chr);
      }
      msg.reply(arr);
    }
  };
}
 
开发者ID:cescoffier,项目名称:vertx-kubernetes-workshop,代码行数:18,代码来源:PortfolioServiceVertxProxyHandler.java


示例4: createSetCharHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
private Handler<AsyncResult<Set<Character>>> createSetCharHandler(Message msg) {
  return res -> {
    if (res.failed()) {
      if (res.cause() instanceof ServiceException) {
        msg.reply(res.cause());
      } else {
        msg.reply(new ServiceException(-1, res.cause().getMessage()));
      }
    } else {
      JsonArray arr = new JsonArray();
      for (Character chr: res.result()) {
        arr.add((int) chr);
      }
      msg.reply(arr);
    }
  };
}
 
开发者ID:cescoffier,项目名称:vertx-kubernetes-workshop,代码行数:18,代码来源:PortfolioServiceVertxProxyHandler.java


示例5: NotificationServiceVertxProxyHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public NotificationServiceVertxProxyHandler(Vertx vertx, NotificationService service, boolean topLevel, long timeoutSeconds) {
  this.vertx = vertx;
  this.service = service;
  this.timeoutSeconds = timeoutSeconds;
  try {
    this.vertx.eventBus().registerDefaultCodec(ServiceException.class,
        new ServiceExceptionMessageCodec());
  } catch (IllegalStateException ex) {}
  if (timeoutSeconds != -1 && !topLevel) {
    long period = timeoutSeconds * 1000 / 2;
    if (period > 10000) {
      period = 10000;
    }
    this.timerID = vertx.setPeriodic(period, this::checkTimedOut);
  } else {
    this.timerID = -1;
  }
  accessed();
}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:20,代码来源:NotificationServiceVertxProxyHandler.java


示例6: handle

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public void handle(Message<JsonObject> msg) {
  try {
    JsonObject json = msg.body();
    String action = msg.headers().get("action");
    if (action == null) {
      throw new IllegalStateException("action not specified");
    }
    accessed();
    switch (action) {
      case "createNotification": {
        service.createNotification(createHandler(msg));
        break;
      }
      default: {
        throw new IllegalStateException("Invalid action: " + action);
      }
    }
  } catch (Throwable t) {
    msg.reply(new ServiceException(500, t.getMessage()));
    throw t;
  }
}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:23,代码来源:NotificationServiceVertxProxyHandler.java


示例7: MailServiceVertxProxyHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public MailServiceVertxProxyHandler(Vertx vertx, MailService service, boolean topLevel, long timeoutSeconds) {
  this.vertx = vertx;
  this.service = service;
  this.timeoutSeconds = timeoutSeconds;
  try {
    this.vertx.eventBus().registerDefaultCodec(ServiceException.class,
        new ServiceExceptionMessageCodec());
  } catch (IllegalStateException ex) {}
  if (timeoutSeconds != -1 && !topLevel) {
    long period = timeoutSeconds * 1000 / 2;
    if (period > 10000) {
      period = 10000;
    }
    this.timerID = vertx.setPeriodic(period, this::checkTimedOut);
  } else {
    this.timerID = -1;
  }
  accessed();
}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:20,代码来源:MailServiceVertxProxyHandler.java


示例8: ConfigurationProviderVertxProxyHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public ConfigurationProviderVertxProxyHandler(Vertx vertx, ConfigurationProvider service, boolean topLevel, long timeoutSeconds) {
  this.vertx = vertx;
  this.service = service;
  this.timeoutSeconds = timeoutSeconds;
  try {
    this.vertx.eventBus().registerDefaultCodec(ServiceException.class,
        new ServiceExceptionMessageCodec());
  } catch (IllegalStateException ex) {}
  if (timeoutSeconds != -1 && !topLevel) {
    long period = timeoutSeconds * 1000 / 2;
    if (period > 10000) {
      period = 10000;
    }
    this.timerID = vertx.setPeriodic(period, this::checkTimedOut);
  } else {
    this.timerID = -1;
  }
  accessed();
}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:20,代码来源:ConfigurationProviderVertxProxyHandler.java


示例9: handle

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public void handle(Message<JsonObject> msg) {
  try {
    JsonObject json = msg.body();
    String action = msg.headers().get("action");
    if (action == null) {
      throw new IllegalStateException("action not specified");
    }
    accessed();
    switch (action) {
      case "getConfiguration": {
        service.getConfiguration((java.lang.String)json.getValue("name"), createHandler(msg));
        break;
      }
      default: {
        throw new IllegalStateException("Invalid action: " + action);
      }
    }
  } catch (Throwable t) {
    msg.reply(new ServiceException(500, t.getMessage()));
    throw t;
  }
}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:23,代码来源:ConfigurationProviderVertxProxyHandler.java


示例10: KnowledgeServiceVertxProxyHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public KnowledgeServiceVertxProxyHandler(Vertx vertx, KnowledgeService service, boolean topLevel, long timeoutSeconds) {
  this.vertx = vertx;
  this.service = service;
  this.timeoutSeconds = timeoutSeconds;
  try {
    this.vertx.eventBus().registerDefaultCodec(ServiceException.class,
        new ServiceExceptionMessageCodec());
  } catch (IllegalStateException ex) {}
  if (timeoutSeconds != -1 && !topLevel) {
    long period = timeoutSeconds * 1000 / 2;
    if (period > 10000) {
      period = 10000;
    }
    this.timerID = vertx.setPeriodic(period, this::checkTimedOut);
  } else {
    this.timerID = -1;
  }
  accessed();
}
 
开发者ID:diabolicallabs,项目名称:vertx-process-manager,代码行数:20,代码来源:KnowledgeServiceVertxProxyHandler.java


示例11: ShoppingCartServiceVertxProxyHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public ShoppingCartServiceVertxProxyHandler(Vertx vertx, ShoppingCartService service, boolean topLevel, long timeoutSeconds) {
  this.vertx = vertx;
  this.service = service;
  this.timeoutSeconds = timeoutSeconds;
  try {
    this.vertx.eventBus().registerDefaultCodec(ServiceException.class,
        new ServiceExceptionMessageCodec());
  } catch (IllegalStateException ex) {}
  if (timeoutSeconds != -1 && !topLevel) {
    long period = timeoutSeconds * 1000 / 2;
    if (period > 10000) {
      period = 10000;
    }
    this.timerID = vertx.setPeriodic(period, this::checkTimedOut);
  } else {
    this.timerID = -1;
  }
  accessed();
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:20,代码来源:ShoppingCartServiceVertxProxyHandler.java


示例12: OrderServiceVertxProxyHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public OrderServiceVertxProxyHandler(Vertx vertx, OrderService service, boolean topLevel, long timeoutSeconds) {
  this.vertx = vertx;
  this.service = service;
  this.timeoutSeconds = timeoutSeconds;
  try {
    this.vertx.eventBus().registerDefaultCodec(ServiceException.class,
        new ServiceExceptionMessageCodec());
  } catch (IllegalStateException ex) {}
  if (timeoutSeconds != -1 && !topLevel) {
    long period = timeoutSeconds * 1000 / 2;
    if (period > 10000) {
      period = 10000;
    }
    this.timerID = vertx.setPeriodic(period, this::checkTimedOut);
  } else {
    this.timerID = -1;
  }
  accessed();
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:20,代码来源:OrderServiceVertxProxyHandler.java


示例13: ProductServiceVertxProxyHandler

import io.vertx.serviceproxy.ServiceException; //导入依赖的package包/类
public ProductServiceVertxProxyHandler(Vertx vertx, ProductService service, boolean topLevel, long timeoutSeconds) {
  this.vertx = vertx;
  this.service = service;
  this.timeoutSeconds = timeoutSeconds;
  try {
    this.vertx.eventBus().registerDefaultCodec(ServiceException.class,
        new ServiceExceptionMessageCodec());
  } catch (IllegalStateException ex) {}
  if (timeoutSeconds != -1 && !topLevel) {
    long period = timeoutSeconds * 1000 / 2;
    if (period > 10000) {
      period = 10000;
    }
    this.timerID = vertx.setPeriodic(period, this::checkTimedOut);
  } else {
    this.timerID = -1;
  }
  accessed();
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:20,代码来源:ProductServiceVertxProxyHandler.java



注:本文中的io.vertx.serviceproxy.ServiceException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TaskRepository类代码示例发布时间:2022-05-22
下一篇:
Java SETATTR3Request类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap