|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection
com.gemstone.bp.edu.emory.mathcs.backport.java.util.AbstractCollection
com.gemstone.bp.edu.emory.mathcs.backport.java.util.AbstractQueue
regionQueue.ClientQueue
public class ClientQueue
The client side of a distributed queue. A ClientQueue
implements the BlockingQueue interface and delegates
its work to a RegionQueue that is hosted by a ServerQueue.
| Field Summary | |
|---|---|
protected String |
id
The id of this VM |
(package private) static String |
INSERT_PREFIX
This is the key of the region element used for adding elements to the queue. |
(package private) static Object |
IS_EMPTY
An argument to a Region get() that denotes that it is an "is empty" operation. |
protected static long |
nextRequestId
The next request id to use when getting an element from the server queue. |
(package private) static Object |
PEEK
An argument to a Region get() that denotes that it is a peek operation. |
(package private) static Object |
PUT
An argument to a Region put() that denotes that it is a (queue) put operation. |
(package private) static Object |
REMAINING_CAPACITY
An argument to a Region get() that denotes that it is a "remaining capacity" operation. |
(package private) static Object |
SIZE
An argument to a Region get() that denotes that it is a size operation. |
(package private) static Object |
TAKE
An argument to a Region get() that denotes that it is a take operation. |
(package private) static Object |
TO_ARRAY
An argument to a Region get() that denotes that it is a "to array" operation. |
| Constructor Summary | |
|---|---|
ClientQueue(String name,
String[] hosts,
int[] ports)
Creates a new ClientQueue that will access queues
hosted by the given servers. |
|
| Method Summary | |
|---|---|
void |
close()
Closes this ClientQueue and releases all resources
associated with it including the communication Region |
int |
drainTo(Collection c)
Throws an UnsupportedOperationException |
int |
drainTo(Collection c,
int maxElements)
Throws an UnsupportedOperationException |
String |
getName()
|
boolean |
isEmpty()
|
Iterator |
iterator()
Throws an UnsupportedOperationException |
static void |
main(String[] args)
Main program that creates a ClientQueue and allows
the user to interact with it via the console. |
boolean |
offer(Object o)
|
boolean |
offer(Object o,
long timeout,
com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
|
Object |
peek()
|
Object |
poll()
|
Object |
poll(long timeout,
com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
|
void |
put(Object o)
|
int |
remainingCapacity()
|
int |
size()
|
Object |
take()
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] array)
|
String |
toString()
|
| Methods inherited from class com.gemstone.bp.edu.emory.mathcs.backport.java.util.AbstractQueue |
|---|
add, addAll, clear, element, remove |
| Methods inherited from class java.util.AbstractCollection |
|---|
contains, containsAll, remove, removeAll, retainAll |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue |
|---|
add, contains, remove |
| Methods inherited from interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.Queue |
|---|
element, remove |
| Methods inherited from interface java.util.Collection |
|---|
addAll, clear, containsAll, equals, hashCode, removeAll, retainAll |
| Field Detail |
|---|
static Object PEEK
static Object TAKE
static Object PUT
static Object IS_EMPTY
static Object SIZE
static Object REMAINING_CAPACITY
static Object TO_ARRAY
protected static long nextRequestId
protected String id
static String INSERT_PREFIX
| Constructor Detail |
|---|
public ClientQueue(String name,
String[] hosts,
int[] ports)
throws TimeoutException
ClientQueue that will access queues
hosted by the given servers.
name - The name of the distributed queuehosts - The host(s) on which the server queue(s) resideports - The port(s) through which the server queue(s) are
accessed.
TimeoutException - If a cache access times out which creating the client
queue
IllegalStateException - If the state of the cache prevents the client queue from
being created| Method Detail |
|---|
public void close()
ClientQueue and releases all resources
associated with it including the communication Region
public void put(Object o)
throws InterruptedException
put in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueueInterruptedException
public Object take()
throws InterruptedException
take in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueueInterruptedExceptionpublic Object peek()
peek in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.Queuepublic boolean isEmpty()
isEmpty in interface CollectionisEmpty in class AbstractCollectionpublic Object poll()
poll in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.Queuepublic int size()
size in interface Collectionsize in class AbstractCollectionpublic Object[] toArray(Object[] array)
toArray in interface CollectiontoArray in class com.gemstone.bp.edu.emory.mathcs.backport.java.util.AbstractCollectionpublic Object[] toArray()
toArray in interface CollectiontoArray in class com.gemstone.bp.edu.emory.mathcs.backport.java.util.AbstractCollection
public Object poll(long timeout,
com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
throws InterruptedException
poll in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueueInterruptedExceptionpublic boolean offer(Object o)
offer in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueueoffer in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.Queue
public boolean offer(Object o,
long timeout,
com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
throws InterruptedException
offer in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueueInterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueuepublic Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in class AbstractCollectionpublic int drainTo(Collection c)
drainTo in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue
public int drainTo(Collection c,
int maxElements)
drainTo in interface com.gemstone.bp.edu.emory.mathcs.backport.java.util.concurrent.BlockingQueuepublic String getName()
public String toString()
toString in class AbstractCollection
public static void main(String[] args)
throws Throwable
ClientQueue and allows
the user to interact with it via the console.
Throwable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||