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 18 package org.activeio; 19 20 import java.io.IOException; 21 22 23 /*** 24 * RequestChannel are used to model the request/reponse exchange that is used 25 * by higher level protcols such as HTTP and RMI. 26 * 27 * @version $Revision$ 28 */ 29 public interface RequestChannel extends Channel { 30 31 /*** 32 * Used to send a packet of information going 'down' the channel and wait for 33 * it's reponse 'up' packet. 34 * 35 * This method blocks until the response packet is received or the operation 36 * experiences a timeout. 37 * 38 * @param request 39 * @param timeout 40 * @return the respnse packet or null if the timeout occured. 41 * @throws IOException 42 */ 43 Packet request(Packet request, long timeout) throws IOException; 44 45 /*** 46 * Registers the {@see RequestListener} that the protcol will use to deliver request packets 47 * comming 'up' the channel. 48 * 49 * @param packetListener 50 * @throws IOException 51 */ 52 void setRequestListener(RequestListener requestListener) throws IOException; 53 54 /*** 55 * @return the registered RequestListener 56 */ 57 RequestListener getRequestListener(); 58 59 }