Class Callback.Combination
java.lang.Object
org.eclipse.jetty.util.Callback.Combination
- All Implemented Interfaces:
 AutoCloseable
- Enclosing interface:
 Callback
A combination of multiple Callbacks, that must all be completed before a specific callback is completed.
For example: 
  void sendToAll(String message, Collection<Channel> channels, Callback callback)
  {
      try (Callback.Combination combination = new Callback.Combination(callback))
      {
          for (Channel channel : channels)
              channel.send(message, combination.newCallback());
      }
  }
- 
Constructor Summary
ConstructorsConstructorDescriptionCombination(Callback andThen) Create a new empty combined callback.Combination(Callback andThen, Throwable failure) Create a new empty combined callback with a forced failure and invocation type. - 
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Called to indicate that no more calls tonewCallback()will happen.Create a newCallbackas part of this combination. 
- 
Constructor Details
- 
Combination
 - 
Combination
Create a new empty combined callback with a forced failure and invocation type.- Parameters:
 andThen- TheCallbackto complete once allCallbacksin the combination are complete and this combination isclosed.failure- If notnull, force a failure, so that theCallback.failed(Throwable)method will always be called on theCallbackpassed to the constructor, once all the combined callbacks are completed and theCombinationisclosed.
 
 - 
 - 
Method Details
- 
newCallback
Create a newCallbackas part of this combination.- Returns:
 - A 
Callbackthat must be completed before the callback passed to the constructor is completed. - Throws:
 IllegalStateException- if the combination has already been completed.
 - 
close
Called to indicate that no more calls tonewCallback()will happen. If the combination is already complete, then it will be completed in the scope of this call.- Specified by:
 closein interfaceAutoCloseable- Throws:
 IllegalStateException- if this method has already been called.
 
 -