小编age*_*ntx的帖子

Spring MVC WebApp:@schedule:java-sdk-http-connection-reaper:无法停止

我有一个Web应用程序(使用Spring 3.1),它使用@Scheduled Annotation定期执行一个worker任务(计划延迟).工作人员任务打开与AWS DynamoDb的连接,并执行一些数据库读取/更新.当我停止webapp(来自Tomcat经理)时,我在catalina.out中收到此消息:

"严重:Web应用程序[]似乎已经启动了一个名为[java-sdk-http-connection-reaper]但未能阻止它的线程.这很可能会造成内存泄漏."

我感觉这与我的计划任务有关,即使在Tomcat停止之后仍在运行.

@Service
public class TaskScheduler implements ApplicationListener<ContextClosedEvent>{

@Autowired
private WorkerTask workerTask;

AmazonDynamoDBClient myDbConn = null;

   private TaskScheduler() {    
   myDbConn = new AWSConnector("aws.properties").getDynamoConnection();
   }

/*
 * Will be repeatedly called, 10 seconds after the finish of the previous 
 * invocation.
 */
@Scheduled(fixedDelay=100000)
public void process() {
    System.out.println("Scheduling worker task");
            //worker task does some db read/writes
    Future<String> status = workerTask.work(myDbConn);
    if (status.isDone()) {
        System.out.println("Completed Task");
        return;
    }

}

@Override
public void onApplicationEvent(ContextClosedEvent arg0) {
    if(event instanceof ContextClosedEvent) …
Run Code Online (Sandbox Code Playgroud)

java spring tomcat spring-mvc amazon-dynamodb

15
推荐指数
2
解决办法
6852
查看次数

访谈:哈希函数:正弦函数

我被问到这个面试问题.我不确定它的正确答案是什么(以及答案背后的原因):

sin(x)是一个很好的哈希函数吗?

c trigonometry

7
推荐指数
1
解决办法
1030
查看次数

如何在Bootstrap Modal对话框中显示URL:单击On按钮

我必须在模态窗口中加载页面(内部URL).我一直在使用window.showModalDialog(url,null,features),但这在Safari,Chrome上无法正常工作.所以我们决定使用Bootstrap的模态对话框.我无法完成这项工作.我有什么想法可能做错了吗?

    //imports
    <script src="http://code.jquery.com/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet">


    //activate content as modal
      $(document).ready(function(){
            $('#test_modal').modal({

                });
    }

    .......
    .......

    $("#btnSubmit").click(function(){
     var url = constructRequestURL();
      $('#test_modal').modal(data-remote=url,data-show="true");
    });


    -----
    -----
    <div class="modal fade" id="test_modal">
</div>
Run Code Online (Sandbox Code Playgroud)

jquery jsp modal-dialog twitter-bootstrap

7
推荐指数
1
解决办法
6万
查看次数