Share via


ITransferQueue Interface

Definition

A BlockingQueue in which producers may wait for consumers to receive elements.

[Android.Runtime.Register("java/util/concurrent/TransferQueue", "", "Java.Util.Concurrent.ITransferQueueInvoker")]
[Java.Interop.JavaTypeParameters(new System.String[] { "E" })]
public interface ITransferQueue : IDisposable, Java.Interop.IJavaPeerable, Java.Util.Concurrent.IBlockingQueue
[<Android.Runtime.Register("java/util/concurrent/TransferQueue", "", "Java.Util.Concurrent.ITransferQueueInvoker")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "E" })>]
type ITransferQueue = interface
    interface IBlockingQueue
    interface IQueue
    interface ICollection
    interface IIterable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Derived
Attributes
Implements

Remarks

A BlockingQueue in which producers may wait for consumers to receive elements. A TransferQueue may be useful for example in message passing applications in which producers sometimes (using method #transfer) await receipt of elements by consumers invoking take or poll, while at other times enqueue elements (via method put) without waiting for receipt. #tryTransfer(Object) Non-blocking and #tryTransfer(Object,long,TimeUnit) time-out versions of tryTransfer are also available. A TransferQueue may also be queried, via #hasWaitingConsumer, whether there are any threads waiting for items, which is a converse analogy to a peek operation.

Like other blocking queues, a TransferQueue may be capacity bounded. If so, an attempted transfer operation may initially block waiting for available space, and/or subsequently block waiting for reception by a consumer. Note that in a queue with zero capacity, such as SynchronousQueue, put and transfer are effectively synonymous.

This interface is a member of the Java Collections Framework.

Added in 1.7.

Java documentation for java.util.concurrent.TransferQueue.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Properties

Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
HasWaitingConsumer

Returns true if there is at least one consumer waiting to receive an element via Take() or timed Poll(Int64, TimeUnit).

IsEmpty

Returns if this Collection contains no elements.

(Inherited from ICollection)
JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)
WaitingConsumerCount

Returns an estimate of the number of consumers waiting to receive elements via Take() or timed Poll(Int64, TimeUnit).

Methods

Add(Object)

Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available.

(Inherited from IQueue)
AddAll(ICollection)

Adds all of the elements in the specified collection to this collection (optional operation).

(Inherited from ICollection)
Clear()

Removes all of the elements from this collection (optional operation).

(Inherited from ICollection)
Contains(Object)

Returns true if this collection contains the specified element.

(Inherited from ICollection)
ContainsAll(ICollection)

Returns true if this collection contains all of the elements in the specified collection.

(Inherited from ICollection)
Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
DrainTo(ICollection, Int32)

Removes at most the given number of available elements from this queue and adds them to the given collection.

(Inherited from IBlockingQueue)
DrainTo(ICollection)

Removes all available elements from this queue and adds them to the given collection.

(Inherited from IBlockingQueue)
Element()

Retrieves, but does not remove, the head of this queue.

(Inherited from IQueue)
Equals(Object)

Compares the specified object with this collection for equality.

(Inherited from ICollection)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
ForEach(IConsumer)

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

(Inherited from IIterable)
GetHashCode()

Returns the hash code value for this collection.

(Inherited from ICollection)
Iterator()

Returns an iterator over the elements in this collection.

(Inherited from ICollection)
Offer(Object, Int64, TimeUnit)

Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available.

(Inherited from IBlockingQueue)
Offer(Object)

Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.

(Inherited from IQueue)
Peek()

Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.

(Inherited from IQueue)
Poll()

Retrieves and removes the head of this queue, or returns null if this queue is empty.

(Inherited from IQueue)
Poll(Int64, TimeUnit)

Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.

(Inherited from IBlockingQueue)
Put(Object)

Inserts the specified element into this queue, waiting if necessary for space to become available.

(Inherited from IBlockingQueue)
RemainingCapacity()

Returns the number of additional elements that this queue can ideally (in the absence of memory or resource constraints) accept without blocking, or Integer.MAX_VALUE if there is no intrinsic limit.

(Inherited from IBlockingQueue)
Remove()

Retrieves and removes the head of this queue.

(Inherited from IQueue)
Remove(Object)

Removes a single instance of the specified element from this collection, if it is present (optional operation).

(Inherited from ICollection)
RemoveAll(ICollection)

Removes all of this collection's elements that are also contained in the specified collection (optional operation).

(Inherited from ICollection)
RemoveIf(IPredicate)

Removes all of the elements of this collection that satisfy the given predicate.

(Inherited from ICollection)
RetainAll(ICollection)

Retains only the elements in this collection that are contained in the specified collection (optional operation).

(Inherited from ICollection)
SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
Size()

Returns the number of elements in this collection.

(Inherited from ICollection)
Spliterator()

Creates a Spliterator over the elements described by this Iterable.

(Inherited from IIterable)
Take()

Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.

(Inherited from IBlockingQueue)
ToArray()

Returns an array containing all of the elements in this collection.

(Inherited from ICollection)
ToArray(IIntFunction)

Returns an array containing all of the elements in this collection, using the provided generator function to allocate the returned array.

(Inherited from ICollection)
ToArray(Object[])

Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.

(Inherited from ICollection)
Transfer(Object)

Transfers the element to a consumer, waiting if necessary to do so.

TryTransfer(Object, Int64, TimeUnit)

Transfers the element to a consumer if it is possible to do so before the timeout elapses.

TryTransfer(Object)

Transfers the element to a waiting consumer immediately, if possible.

UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)

Explicit Interface Implementations

IIterable.Spliterator()

Creates a Spliterator over the elements in this collection.

(Inherited from ICollection)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)
OfferAsync(IBlockingQueue, Object, Int64, TimeUnit)
OfferAsync(IBlockingQueue, Object)
PollAsync(IBlockingQueue, Int64, TimeUnit)
PutAsync(IBlockingQueue, Object)
TakeAsync(IBlockingQueue)
ToEnumerable(IIterable)
ToEnumerable<T>(IIterable)

Applies to