Skip to content

Commit

Permalink
QPID-7972: [Broker-J] Put VirtualHostNode in ERRORed state if the
Browse files Browse the repository at this point in the history
underlying VirtualHost is
  • Loading branch information
overmeulen committed Feb 20, 2018
1 parent 3aad3e3 commit edefbbc
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import org.apache.qpid.server.model.State;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -102,19 +103,15 @@ protected ListenableFuture<Void> activate()
if (host != null)
{
final QueueManagingVirtualHost<?> recoveredHost = host;
final ListenableFuture<Void> openFuture;
recoveredHost.setFirstOpening(isNew && initialRecords.length == 0);
openFuture = Subject.doAs(getSubjectWithAddedSystemRights(),
new PrivilegedAction<ListenableFuture<Void>>()
{
@Override
public ListenableFuture<Void> run()
{
return recoveredHost.openAsync();

}
});
return openFuture;

final ListenableFuture<Void> openFuture = Subject.doAs(getSubjectWithAddedSystemRights(), (PrivilegedAction<ListenableFuture<Void>>) recoveredHost::openAsync);
return doAfter(openFuture, () -> {
if (getVirtualHost().getState() == State.ERRORED )
{
throw new IllegalStateException(String.format("This virtual host node has %s children", State.ERRORED));
}
});
}
else
{
Expand Down

0 comments on commit edefbbc

Please sign in to comment.