01: /**
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */package com.tc.util.concurrent;
05:
06: import EDU.oswego.cs.dl.util.concurrent.Channel;
07: import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
08:
09: public class NoExceptionLinkedQueue implements Channel {
10: public final LinkedQueue queue = new LinkedQueue();
11:
12: public void put(Object o) {
13: while (true) {
14: try {
15: queue.put(o);
16: return;
17: } catch (InterruptedException e) {
18: //
19: }
20: }
21: }
22:
23: public boolean offer(Object o, long l) {
24: try {
25: return queue.offer(o, l);
26: } catch (InterruptedException e) {
27: return false;
28: }
29: }
30:
31: public boolean isEmpty() {
32: return queue.isEmpty();
33: }
34:
35: public Object peek() {
36: return queue.peek();
37: }
38:
39: public Object poll(long arg0) {
40: try {
41: return queue.poll(arg0);
42: } catch (InterruptedException e) {
43: return null;
44: }
45: }
46:
47: public Object take() {
48: while (true) {
49: try {
50: return queue.take();
51: } catch (InterruptedException e) {
52: //
53: }
54: }
55: }
56:
57: public boolean equals(Object obj) {
58: return queue.equals(obj);
59: }
60:
61: public int hashCode() {
62: return queue.hashCode();
63: }
64:
65: public String toString() {
66: return queue.toString();
67: }
68: }
|