当前位置: 首页>>代码示例>>Java>>正文


Java ServiceException类代码示例

本文整理汇总了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;未经允许,请勿转载。