Only alow config reloads to ADD servers.
This commit is contained in:
parent
dc6835c21b
commit
26cee397e6
@ -81,9 +81,30 @@ public class Configuration
|
||||
listeners = adapter.getListeners();
|
||||
Preconditions.checkArgument( listeners != null && !listeners.isEmpty(), "No listeners defined." );
|
||||
|
||||
servers = adapter.getServers();
|
||||
Map<String, ServerInfo> newServers = adapter.getServers();
|
||||
Preconditions.checkArgument( servers != null && !servers.isEmpty(), "No servers defined" );
|
||||
|
||||
if ( servers == null )
|
||||
{
|
||||
servers = newServers;
|
||||
} else
|
||||
{
|
||||
for ( ServerInfo oldServer : servers.values() )
|
||||
{
|
||||
// Don't allow servers to be removed
|
||||
Preconditions.checkArgument( newServers.containsValue( oldServer ), "Server %s removed on reload!", oldServer.getName() );
|
||||
}
|
||||
|
||||
// Add new servers
|
||||
for ( Map.Entry<String, ServerInfo> newServer : newServers.entrySet() )
|
||||
{
|
||||
if ( !servers.containsValue( newServer.getValue() ) )
|
||||
{
|
||||
servers.put( newServer.getKey(), newServer.getValue() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( ListenerInfo listener : listeners )
|
||||
{
|
||||
Preconditions.checkArgument( servers.containsKey( listener.getDefaultServer() ), "Default server %s is not defined", listener.getDefaultServer() );
|
||||
|
Loading…
Reference in New Issue
Block a user