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. package com.sun.corba.se.impl.encoding;
  8. import com.sun.corba.se.impl.orbutil.ORBConstants;
  9. import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
  10. import com.sun.corba.se.impl.encoding.BufferManagerWrite;
  11. import com.sun.corba.se.pept.encoding.OutputObject;
  12. import com.sun.corba.se.pept.transport.Connection;
  13. import com.sun.corba.se.spi.orb.ORB;
  14. public class BufferManagerWriteGrow extends BufferManagerWrite
  15. {
  16. BufferManagerWriteGrow( ORB orb )
  17. {
  18. super(orb) ;
  19. }
  20. public boolean sentFragment() {
  21. return false;
  22. }
  23. /**
  24. * Returns the correct buffer size for this type of
  25. * buffer manager as set in the ORB.
  26. */
  27. public int getBufferSize() {
  28. return orb.getORBData().getGIOPBufferSize();
  29. }
  30. public void overflow (ByteBufferWithInfo bbwi)
  31. {
  32. // The code that once lived directly in CDROutputStream.grow()
  33. // has been moved ByteBufferWithInfo.growBuffer().
  34. // Grow ByteBufferWithInfo to a larger size.
  35. bbwi.growBuffer(orb);
  36. // Must be false for the grow case
  37. bbwi.fragmented = false;
  38. }
  39. public void sendMessage ()
  40. {
  41. Connection conn =
  42. ((OutputObject)outputObject).getMessageMediator().getConnection();
  43. conn.writeLock();
  44. try {
  45. conn.sendWithoutLock((OutputObject)outputObject);
  46. sentFullMessage = true;
  47. } finally {
  48. conn.writeUnlock();
  49. }
  50. }
  51. /**
  52. * Close the BufferManagerWrite and do any outstanding cleanup.
  53. *
  54. * No work to do for a BufferManagerWriteGrow.
  55. */
  56. public void close() {}
  57. }