src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java
changeset 48554 592e22777742
parent 47216 71c04702a3d5
equal deleted inserted replaced
48498:c94c352dc400 48554:592e22777742
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    24  */
    24  */
    25 
    25 
    26 package com.sun.corba.se.impl.encoding;
    26 package com.sun.corba.se.impl.encoding;
    27 
    27 
    28 import com.sun.corba.se.impl.orbutil.ORBConstants;
    28 import com.sun.corba.se.impl.orbutil.ORBConstants;
       
    29 import com.sun.corba.se.impl.orbutil.ORBUtility;
    29 import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
    30 import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
    30 import com.sun.corba.se.impl.encoding.BufferManagerWrite;
    31 import com.sun.corba.se.impl.encoding.BufferManagerWrite;
    31 import com.sun.corba.se.pept.encoding.OutputObject;
    32 import com.sun.corba.se.pept.encoding.OutputObject;
    32 import com.sun.corba.se.pept.transport.Connection;
    33 import com.sun.corba.se.pept.transport.Connection;
    33 import com.sun.corba.se.spi.orb.ORB;
    34 import com.sun.corba.se.spi.orb.ORB;
       
    35 import com.sun.corba.se.spi.orb.ORBData;
    34 
    36 
    35 public class BufferManagerWriteGrow extends BufferManagerWrite
    37 public class BufferManagerWriteGrow extends BufferManagerWrite
    36 {
    38 {
    37     BufferManagerWriteGrow( ORB orb )
    39     BufferManagerWriteGrow( ORB orb )
    38     {
    40     {
    46     /**
    48     /**
    47      * Returns the correct buffer size for this type of
    49      * Returns the correct buffer size for this type of
    48      * buffer manager as set in the ORB.
    50      * buffer manager as set in the ORB.
    49      */
    51      */
    50     public int getBufferSize() {
    52     public int getBufferSize() {
    51         return orb.getORBData().getGIOPBufferSize();
    53         ORBData orbData = null;
       
    54         int bufferSize = ORBConstants.GIOP_DEFAULT_BUFFER_SIZE;
       
    55         if (orb != null) {
       
    56             orbData = orb.getORBData();
       
    57             if (orbData != null) {
       
    58                 bufferSize = orbData.getGIOPBufferSize();
       
    59                 dprint("BufferManagerWriteGrow.getBufferSize: bufferSize == " + bufferSize);
       
    60             } else {
       
    61                 dprint("BufferManagerWriteGrow.getBufferSize: orbData reference is NULL");
       
    62             }
       
    63         } else {
       
    64             dprint("BufferManagerWriteGrow.getBufferSize: orb reference is NULL");
       
    65         }
       
    66         return bufferSize;
    52     }
    67     }
    53 
    68 
    54     public void overflow (ByteBufferWithInfo bbwi)
    69     public void overflow (ByteBufferWithInfo bbwi)
    55     {
    70     {
    56         // The code that once lived directly in CDROutputStream.grow()
    71         // The code that once lived directly in CDROutputStream.grow()
    87      *
   102      *
    88      * No work to do for a BufferManagerWriteGrow.
   103      * No work to do for a BufferManagerWriteGrow.
    89      */
   104      */
    90     public void close() {}
   105     public void close() {}
    91 
   106 
       
   107     private void dprint(String msg) {
       
   108         if (orb.transportDebugFlag) {
       
   109             ORBUtility.dprint(this, msg);
    92 }
   110 }
       
   111     }
       
   112 }