-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure Vertx is closed #290
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,18 @@ | |
import com.microsoft.gctoolkit.vertx.io.JVMEventCodec; | ||
import io.vertx.core.Vertx; | ||
|
||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
public class VertxChannel { | ||
|
||
private Vertx vertx; | ||
protected static final Logger LOGGER = Logger.getLogger(VertxChannel.class.getName()); | ||
|
||
// | ||
// Note well! This cannot be a static final field. | ||
// UnifiedJavaVirtualMachineConfigurationTest hangs if it is. | ||
// | ||
private final Vertx vertx; | ||
|
||
{ | ||
//Disable unused Vert.x functionality | ||
|
@@ -23,4 +32,14 @@ protected Vertx vertx() { | |
return vertx; | ||
} | ||
|
||
public void close() { | ||
vertx().close(result -> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am concerned that this is a race condition in cases where there is more than 1 channel setup. I've not seen Censum not shutdown because of this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run the sample in the gctoolkit repository from the main branch. The app should exit when main exits. It does not. One should not have to explicitly call System.exit(). |
||
if (result.succeeded()) { | ||
LOGGER.log(Level.FINE, "Vertx: closed"); | ||
} else { | ||
LOGGER.log(Level.FINE, "Vertx: close failed", result.cause()); | ||
} | ||
}); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why?