[wildfly-dev] CLI batches in control flow blocks

Brian Stansberry brian.stansberry at redhat.com
Fri Sep 4 12:02:35 EDT 2015


On 9/4/15 10:44 AM, Alexey Loubyansky wrote:
> On 09/04/2015 04:27 PM, Brian Stansberry wrote:
>> On 9/4/15 12:55 AM, Alexey Loubyansky wrote:
>>> On 09/04/2015 12:10 AM, Brian Stansberry wrote:
>
> -- skip --
>
>>>> Below are bad ideas that I wrote down and then thought better of, but
>>>> I'll send them in case it sparks a thought.
>>>>
>>>> I. Since there is already logic for dropping out of the batch for things
>>>> like cd, ls, could it be modified as follows?
>>>>
>>>> a) Close any current batch and execute that batch.
>>>> b) Execute the cd, ls, etc
>>>> c) Proceed, and if the next statement isn't a cd, ls etc, start a new batch.
>>>>
>>>> That seems like a better semantic for cd and ls anyway.
>>>
>>> I don't think so. The batch mode is also a composition/editing mode. cd
>>> and ls are useful when writing commands/operations that should be added
>>> to the batch. Imagine editing a batch and wishing to cd before entering
>>> next lines. That won't be possible without explicit holback-batch, cd
>>> and then batch again. That would be inconvenient.
>>>
>>
>> Thanks; that's a very good point. Yesterday, I was having a hard time
>> seeing the point of ls inside an if/else; now I get it. :)
>>
>>>> With that, reload and shutdown can be treated the same as cd, ls.
>>>
>>> For reload and shutdown that does seem to make sense. So, a possible
>>> alternative is making them exceptions.
>>>
>>
>> I said yesterday (below) that this was a bad idea because it can still
>> break scripts or prevent rollback, same as your proposal. But I think in
>> practice this wouldn't be a real drawback, since AIUI the bugs mean any
>> existing script with reload/shutdown in the middle of a bunch of other
>> ops would be broken anyway. Right?
>
> :reload or :shutdown don't make any sense in the middle of a composite
> operation.

Agreed.

> If they make sense in a batch, they should be last. Even
> then, does it make sense to include them into a composite operation?
>

In a CLI batch, the benefit of including them last is the exclusive 
write lock acquired by the previous steps is held until the reload is 
initiated. If it's a separate step another change from a different 
client can sneak in between.

In a non-CLI composite there's also a minor advantage in that the params 
to :reload/:shutdown will be validated inside the composite and if they 
are invalid this will roll back the composite. But in a CLI batch the 
CLI isn't going to send invalid params from its high level commands.

-- 
Brian Stansberry
Senior Principal Software Engineer
JBoss by Red Hat


More information about the wildfly-dev mailing list