KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > encoding > BufferManagerWriteGrow


1 /*
2  * @(#)BufferManagerWriteGrow.java 1.12 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.encoding;
9
10 import com.sun.corba.se.impl.orbutil.ORBConstants;
11 import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
12 import com.sun.corba.se.impl.encoding.BufferManagerWrite;
13 import com.sun.corba.se.pept.encoding.OutputObject;
14 import com.sun.corba.se.pept.transport.Connection;
15 import com.sun.corba.se.spi.orb.ORB;
16
17 public class BufferManagerWriteGrow extends BufferManagerWrite
18 {
19     BufferManagerWriteGrow( ORB orb )
20     {
21     super(orb) ;
22     }
23
24     public boolean sentFragment() {
25         return false;
26     }
27
28     /**
29      * Returns the correct buffer size for this type of
30      * buffer manager as set in the ORB.
31      */

32     public int getBufferSize() {
33         return orb.getORBData().getGIOPBufferSize();
34     }
35
36     public void overflow (ByteBufferWithInfo bbwi)
37     {
38     // The code that once lived directly in CDROutputStream.grow()
39
// has been moved ByteBufferWithInfo.growBuffer().
40

41         // Grow ByteBufferWithInfo to a larger size.
42
bbwi.growBuffer(orb);
43
44         // Must be false for the grow case
45
bbwi.fragmented = false;
46     }
47
48     public void sendMessage ()
49     {
50         Connection conn =
51               ((OutputObject)outputObject).getMessageMediator().getConnection();
52
53         conn.writeLock();
54
55         try {
56
57             conn.sendWithoutLock((OutputObject)outputObject);
58
59             sentFullMessage = true;
60
61         } finally {
62
63             conn.writeUnlock();
64         }
65     }
66
67     /**
68      * Close the BufferManagerWrite and do any outstanding cleanup.
69      *
70      * No work to do for a BufferManagerWriteGrow.
71      */

72     public void close() {}
73
74 }
75
Popular Tags