我@Stateless在异步Servlet中注入一个bean并@Asynchronous从Serrvlet 调用方法.在jboss的服务器日志中,我无法看到任何异常但是在启动Java Mission Control时,我会看到ContextNotActiveExcetionServlet调用该@Asyncrhonous方法的时候.
Servlet ::
@WebServlet(urlPatterns = { "/asyncservice" }, asyncSupported = true)
public class AsyncServiceServlet extends HttpServlet {
@Inject
private Service service;
protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
final AsyncContext asyncContext = request.startAsync(request, response);
asyncContext.start(new Runnable() {
@Override
public void run() {
try {
service.service(asyncContext);
} catch (ContextNotActiveException | IOException e) {
e.printStackTrace();
}
});
}
Run Code Online (Sandbox Code Playgroud)
服务类::
@Stateless
public class Service {
@Asynchronous
public …Run Code Online (Sandbox Code Playgroud) 有时当我尝试在rails中打印Float时,我收到如下错误:
TypeError at /delivery_requests/33/edit
no implicit conversion of Float into String
on the line:
= this_is_a_float
Run Code Online (Sandbox Code Playgroud)
我知道我可以添加.to_s到浮点数,但为什么这不是默认情况下完成的?
我需要创建生成名称的文件.我boost::lexical_cast用来将整数转换为std::string.是否有可能获得带填充零的字符串; 我没有c++11 tools,只有MSVS 2008支持的一切.
示例:
int i = 10;
std::string str = boost::lexical_cast<std::string>(i);
// str = "10"
// expect str = "000010"
Run Code Online (Sandbox Code Playgroud)
ps不建议使用sprintf.