[ 
https://issues.apache.org/jira/browse/AMQ-9129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kai Kunstmann updated AMQ-9129:
-------------------------------
    Description: 
The fact, that the RMI registry is wrapped into a Proxy right after its 
creation [1] prevents the corresponding cleanup call [2] from succeeding. This 
has the consequence that a single remote connection persists after cleanup, 
which prevents the backing RMI server-socket from being closed. As a 
consequence, the port remains blocked and a broker with the same configuration 
cannot be (re)started within the same JVM or even the same computer until the 
JVM shuts down. This is especially problematic with unit and integration tests, 
that involve an embedded broker, and expect a proper cleanup.

The cleanup call should be made with the original Registry instance instead of 
its proxy.
In order to get a hand on the original Registry the proxy needs to be 
refactored to expose it.


[1] 
https://github.com/apache/activemq/blob/0b8e9f97685840af85bf3be6f7dc3db6ecf8fff5/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java#L677

[2] 
https://github.com/apache/activemq/blob/0b8e9f97685840af85bf3be6f7dc3db6ecf8fff5/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java#L254

  was:
The fact, that the RMI registry is wrapped into a Proxy right after its 
creation [1] prevents the corresponding cleanup call [2] from succeeding. This 
has the consequence that a single remote connection persists after cleanup, 
which prevents the backing RMI server-socket from being closed. As a 
consequence, the port remains blocked and a broker with the same configuration 
cannot be (re)started within the same JVM. This is especially problematic with 
unit and integration tests, that involve an embedded broker, and expect a 
proper clean-up.

The cleanup call should be made with the original Registry instance instead of 
its proxy.
In order to get a hand on the original Registry the proxy needs to be 
refactored to expose it.


[1] 
https://github.com/apache/activemq/blob/0b8e9f97685840af85bf3be6f7dc3db6ecf8fff5/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java#L677

[2] 
https://github.com/apache/activemq/blob/0b8e9f97685840af85bf3be6f7dc3db6ecf8fff5/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java#L254


> ManagementContext not cleaning up RMI Registry properly
> -------------------------------------------------------
>
>                 Key: AMQ-9129
>                 URL: https://issues.apache.org/jira/browse/AMQ-9129
>             Project: ActiveMQ
>          Issue Type: Bug
>            Reporter: Kai Kunstmann
>            Priority: Major
>
> The fact, that the RMI registry is wrapped into a Proxy right after its 
> creation [1] prevents the corresponding cleanup call [2] from succeeding. 
> This has the consequence that a single remote connection persists after 
> cleanup, which prevents the backing RMI server-socket from being closed. As a 
> consequence, the port remains blocked and a broker with the same 
> configuration cannot be (re)started within the same JVM or even the same 
> computer until the JVM shuts down. This is especially problematic with unit 
> and integration tests, that involve an embedded broker, and expect a proper 
> cleanup.
> The cleanup call should be made with the original Registry instance instead 
> of its proxy.
> In order to get a hand on the original Registry the proxy needs to be 
> refactored to expose it.
> [1] 
> https://github.com/apache/activemq/blob/0b8e9f97685840af85bf3be6f7dc3db6ecf8fff5/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java#L677
> [2] 
> https://github.com/apache/activemq/blob/0b8e9f97685840af85bf3be6f7dc3db6ecf8fff5/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java#L254



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to