BufferManagerRead.java revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package com.sun.corba.se.impl.encoding;
27
28import java.nio.ByteBuffer;
29import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
30import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
31import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
32
33public interface BufferManagerRead
34{
35    /**
36     * Case: Called from ReaderThread on complete message or fragments.
37     *       The given buf may be entire message or a fragment.
38     *
39     *  The ReaderThread finds the ReadBufferManager instance either in
40     *  in a fragment map (when collecting - GIOP 1.2 phase 1) or
41     *  in an active server requests map (when streaming - GIOP 1.2 phase 2).
42     *
43     *  As a model for implementation see IIOPInputStream's
44     *  constructor of the same name. There are going to be some variations.
45     *
46     */
47
48    public void processFragment ( ByteBuffer byteBuffer,
49        FragmentMessage header);
50
51
52    /**
53     * Case: called from CDRInputStream constructor before unmarshaling.
54     *
55     * Does:
56     *
57     *  this.bufQ.get()
58     *
59     *  If streaming then sync on bufQ and wait if empty.
60     */
61
62
63    /**
64     * Case: called from CDRInputStream.grow.
65     *
66     * Does:
67     *
68     *  this.bufQ.get()
69     *
70     *  If streaming then sync on bufQ and wait if empty.
71     */
72
73    public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi);
74
75    /**
76     * Called once after creating this buffer manager and before
77     * it begins processing.
78     */
79    public void init(Message header);
80
81    /**
82     * Returns the mark/reset handler for this stream.
83     */
84    public MarkAndResetHandler getMarkAndResetHandler();
85
86    /*
87     * Signals that the processing be cancelled.
88     */
89    public void cancelProcessing(int requestId);
90
91    /*
92     * Close BufferManagerRead and perform any oustanding cleanup.
93     */
94    public void close(ByteBufferWithInfo bbwi);
95}
96