|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| AsynchChannelToClientRequestChannel.java | - | 60% | 50% | 55.6% |
|
||||||||||||||
| 1 |
/**
|
|
| 2 |
*
|
|
| 3 |
* Copyright 2004 Hiram Chirino
|
|
| 4 |
*
|
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
| 7 |
* You may obtain a copy of the License at
|
|
| 8 |
*
|
|
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
| 10 |
*
|
|
| 11 |
* Unless required by applicable law or agreed to in writing, software
|
|
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
| 14 |
* See the License for the specific language governing permissions and
|
|
| 15 |
* limitations under the License.
|
|
| 16 |
*/
|
|
| 17 |
package org.activeio.adapter;
|
|
| 18 |
|
|
| 19 |
import java.io.IOException;
|
|
| 20 |
|
|
| 21 |
import org.activeio.Packet;
|
|
| 22 |
import org.activeio.RequestChannel;
|
|
| 23 |
import org.activeio.RequestListener;
|
|
| 24 |
import org.activeio.SynchChannel;
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
/**
|
|
| 28 |
* Creates a {@see org.activeio.RequestChannel} out of a {@see org.activeio.SynchChannel}.
|
|
| 29 |
* Does not support handing requests. It can only be used to send requests.
|
|
| 30 |
*
|
|
| 31 |
* @version $Revision$
|
|
| 32 |
*/
|
|
| 33 |
final public class AsynchChannelToClientRequestChannel implements RequestChannel { |
|
| 34 |
|
|
| 35 |
private final SynchChannel next;
|
|
| 36 |
|
|
| 37 | 2 |
public AsynchChannelToClientRequestChannel(SynchChannel next) {
|
| 38 | 2 |
this.next = next;
|
| 39 |
} |
|
| 40 |
|
|
| 41 | 10 |
public Packet request(Packet request, long timeout) throws IOException { |
| 42 | 10 |
next.write(request); |
| 43 | 10 |
next.flush(); |
| 44 | 10 |
return next.read(timeout);
|
| 45 |
} |
|
| 46 |
|
|
| 47 | 0 |
public void setRequestListener(RequestListener requestListener) throws IOException { |
| 48 | 0 |
throw new IOException("Operation not supported."); |
| 49 |
} |
|
| 50 |
|
|
| 51 | 0 |
public RequestListener getRequestListener() {
|
| 52 | 0 |
return null; |
| 53 |
} |
|
| 54 |
|
|
| 55 | 0 |
public Object narrow(Class target) {
|
| 56 | 0 |
return next.narrow(target);
|
| 57 |
} |
|
| 58 |
|
|
| 59 | 2 |
public void dispose() { |
| 60 | 2 |
next.dispose(); |
| 61 |
} |
|
| 62 |
|
|
| 63 | 2 |
public void start() throws IOException { |
| 64 | 2 |
next.start(); |
| 65 |
} |
|
| 66 |
|
|
| 67 | 0 |
public void stop(long timeout) throws IOException { |
| 68 | 0 |
next.stop(timeout); |
| 69 |
} |
|
| 70 |
} |
|
| 71 |
|
|
||||||||||