KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > thread > ChannelWrapper


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.components.thread;
17
18 import EDU.oswego.cs.dl.util.concurrent.Channel;
19
20
21 /**
22  * Wrapper around a Channel implementation for constructor convenience
23  *
24  * @author <a HREF="mailto:giacomo.at.apache.org">Giacomo Pati</a>
25  * @version $Id: ChannelWrapper.java 56702 2004-11-05 22:52:05Z giacomo $
26  */

27 public class ChannelWrapper
28     implements Channel
29 {
30     //~ Instance fields --------------------------------------------------------
31

32     /** The wrapped Channel */
33     private Channel m_channel;
34
35     //~ Methods ----------------------------------------------------------------
36

37     /**
38      * DOCUMENT ME!
39      *
40      * @param channel DOCUMENT ME!
41      */

42     public void setChannel( final Channel channel )
43     {
44         m_channel = channel;
45     }
46
47     /**
48      * @see EDU.oswego.cs.dl.util.concurrent.Puttable#offer(java.lang.Object,
49      * long)
50      */

51     public boolean offer( final Object JavaDoc obj,
52                           final long timeout )
53         throws InterruptedException JavaDoc
54     {
55         return m_channel.offer( obj, timeout );
56     }
57
58     /**
59      * @see EDU.oswego.cs.dl.util.concurrent.Channel#peek()
60      */

61     public Object JavaDoc peek( )
62     {
63         return m_channel.peek( );
64     }
65
66     /**
67      * @see EDU.oswego.cs.dl.util.concurrent.Takable#poll(long)
68      */

69     public Object JavaDoc poll( final long timeout )
70         throws InterruptedException JavaDoc
71     {
72         return m_channel.poll( timeout );
73     }
74
75     /**
76      * @see EDU.oswego.cs.dl.util.concurrent.Puttable#put(java.lang.Object)
77      */

78     public void put( final Object JavaDoc obj )
79         throws InterruptedException JavaDoc
80     {
81         m_channel.put( obj );
82     }
83
84     /**
85      * @see EDU.oswego.cs.dl.util.concurrent.Takable#take()
86      */

87     public Object JavaDoc take( )
88         throws InterruptedException JavaDoc
89     {
90         return m_channel.take( );
91     }
92 }
93
Popular Tags