I am experimenting with Dropwizard ( https://github.com/robertkuhar/dropwiz_get_start , https://github.com/robertkuhar/dropwiz_mongo_demo ) and am impressed with how easy it is to integrate with my IDE. To run my dropwizard application, I just find the class with the main method and "Debug As ... Java Application", and I'm on my way. Stopping the application is equally simple, just click the red "Finish" button from the "Debug" view. However, I noticed that I don't get to breakpoints in the stop () method of my managed classes when I stop it this way.
How do I get Dropwizard to complete a graceful shutdown when launched directly in the eclipse debugger?
@Override
public void run( BlogConfiguration configuration, Environment environment ) throws Exception {
...
MongoManaged mongoManaged = new MongoManaged( mongo );
environment.manage( mongoManaged );
...
}
Breakpoints in stop () MongoManage never hit.
public class MongoManaged implements Managed {
private final MongoClient mongo;
public MongoManaged( MongoClient mongo ) {
this.mongo = mongo;
}
@Override
public void start() throws Exception {
}
@Override
public void stop() throws Exception {
if ( mongo != null ) {
mongo.close();
}
}
}
source
share