Transaction
. If there are initially no matches in the space that are visible to the passed Transaction
, an invocation of this method will block for up to a specified timeout for one or more matches to appear. The effect on the space of an invocation of this method successfully taking an Entry
will be the same as if the Entry
had been taken using the singleton version of this method and passing txn
as the Transaction
.
The tmpls
parameter must be a Collection
of Entry
instances to be used as templates. All of the entries taken must match one or more of these templates. The tmpls
parameter may contain null
values and may contain duplicates. An Entry
is said to be available to an invocation of this method if the Entry
could have been returned by an invocation of the singleton take
method using txn
.
If the method succeeds, a non-null
Collection
will be returned. The Collection
will contain a copy of each Entry
that was taken. If no entries were taken, the Collection
will be empty. Each Entry
taken will be represented by a distinct Entry
instance in the returned Collection
, even if some of the entries are equivalent to others taken by the operation. There will be no null
elements in the returned Collection
.
If one or more of the entries taken cannot be unmarshalled in the client, an {@link UnusableEntriesException} isthrown. The exception's {@link UnusableEntriesException#getEntries UnusableEntriesException.getEntries} method will return aCollection
with a copy of each Entry
that could be unmarshalled. The {@link UnusableEntriesException#getUnusableEntryExceptions UnusableEntriesException.getUnusableEntryExceptions} methodwill return a Collection
with an {@link UnusableEntryException} for each Entry
thatcould not be unmarshalled. Every Entry
taken by the invocation will either be represented in the Collection
returned by getEntries
or in the Collection
returned by getUnusableEntryExceptions
.
If there is at least one matching Entry
available in the space, an invocation of this method must take at least one Entry
. If more than one matching Entry
is available, the invocation may take additional entries. It must not take more than maxEntries
, but an implementation may chose to take fewer entries from the space than the maximum available or the maximum allowed by maxEntries
. If for whatever reason, an invocation of this method takes fewer entries than the maximum number of available matching entries, how an implementation selects which entries should be taken by the invocation and which are left in the space is unspecified. How consumption of entries is arbitrated between conflicting queries is also unspecified.
If there are initially no matching entries in the space, an invocation of this method should block for up to timeout
milliseconds for a match to appear. If one or more matches become available before timeout
expires, one or more of the newly available entries should be taken and the method should return without further blocking. If for some reason the invocation can't block for the full timeout and no entries have been taken, the invocation must fail with a {@link RemoteException} or {@link TransactionException} asappropriate.
If an invocation of this method removes (or locks) more than one Entry
, the order in which the removal (or locking) occurs is undefined, and different observers may see the removal or locking of the entries in different orders.
If a TransactionException
, {@link SecurityException}, {@link IllegalArgumentException}, or {@link NullPointerException} is thrown, no entries willhave been taken. If a RemoteException
is thrown, up to maxEntries
may have been taken by this operation.
@param tmpls a {@link Collection} of {@link Entry}instances, each representing a template. All of the entries taken by an invocation of this method will match one or more elements of tmpls
@param txn the {@link Transaction} this operation should beperformed under, may be null
@param timeout if there are initially no availablematches in the space, the maximum number of milliseconds to block waiting for a match to become available
@param maxEntries the maximum number of entries that may betaken by this method
@return a Collection
that contains a copy of eachEntry
taken from the space by this method. The space will not keep a reference to this Collection
. May be immutable
@throws UnusableEntriesException if one or more of theentries taken can't be unmarshalled in the client
@throws TransactionException if txn
isnon-null
and is not usable by the space.
@throws RemoteException if a communication error occurs
@throws IllegalArgumentException if any non-null
element of tmpls
is not an instance of Entry
, if tmpls
is empty, if timeout
is negative, or if maxEntries
is non-positive
@throws NullPointerException if tmpls
is null
Returns the next event from the channel if available. If the channel does not have any events available, this method must return {@code null}.
Note: This method must be invoked within an active {@link Transaction} boundary. Failure to do so can lead to unpredictableresults.
@return the next available event or {@code null} if no events areavailable. @throws ChannelException in case this operation fails. @see org.apache.flume.Transaction#begin()This future may safely be used as a NotifyingFuture if desired. This is because if it tries to set a listener it will be called immediately since the task has already been completed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|