Revert "fix: Only allow setting the keep-alive strategy before the Agent is started."

This reverts commit abec6b79e564961575b3372a2ead52053dd3a67e.
This commit is contained in:
Boris Grozev 2016-12-15 11:07:26 -06:00
parent a1796c9bfb
commit 19e86e3bc9
2 changed files with 3 additions and 12 deletions

View File

@ -452,7 +452,7 @@ public class Agent
IOException, IOException,
BindException BindException
{ {
if (transport != Transport.UDP) if(transport != Transport.UDP)
{ {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"This implementation does not currently support transport: " "This implementation does not currently support transport: "

View File

@ -1087,20 +1087,11 @@ public class Component
/** /**
* Sets the {@link KeepAliveStrategy} for this {@link Component}. * Sets the {@link KeepAliveStrategy} for this {@link Component}.
* @param strategy the strategy to set. The keep-alive strategy can only * @param strategy the strategy to set.
* be modified before the parent {@link Agent} is started.
* @throws IllegalStateException if the agent has been started.
*/ */
public void setKeepAliveStrategy(KeepAliveStrategy strategy) public void setKeepAliveStrategy(KeepAliveStrategy strategy)
{ {
IceProcessingState agentState
= getParentStream().getParentAgent().getState();
if (!IceProcessingState.WAITING.equals(agentState))
{
throw new IllegalStateException(
"Not changing the keep-alive strategy, the agent is is state "
+ agentState);
}
keepAliveStrategy = Objects.requireNonNull(strategy, "strategy"); keepAliveStrategy = Objects.requireNonNull(strategy, "strategy");
} }
} }