You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2014/05/04 16:57:14 UTC
[jira] [Created] (CAY-1930) ByteArryaType use of
ByteArrayOutputStream
Andrus Adamchik created CAY-1930:
------------------------------------
Summary: ByteArryaType use of ByteArrayOutputStream
Key: CAY-1930
URL: https://issues.apache.org/jira/browse/CAY-1930
Project: Cayenne
Issue Type: Task
Reporter: Andrus Adamchik
Assignee: Andrus Adamchik
ByteArrayOutputStream is somewhat inefficient way to collect bytes from InputStream to a byte[]. Its every method is synchronized. We also allocate an intermediate buffer to read the blob chunks to and then write to BAOS. Finally we copy the internal byte[] of BAOS when we are done reading blob. I guess we can't do much about the last issue, but we can make a non-synchronized version, as BAOS is always in a method local scope, and also collect bytes directly into the stream, resizing it smartly.
Also review suspect subclasses of BAOS in Cayenne, e.g. in Util.cloneViaSerialization, SerializableTypeFactory and Oracle8LOBBatchQueryWrapper.. they are not trimming the internal buffer boundaries properly.
--
This message was sent by Atlassian JIRA
(v6.2#6252)