Skip to content

Commit 00b6d00

Browse files
author
Marcelo Vanzin
committed
Feedback.
1 parent 6bda670 commit 00b6d00

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

core/src/main/scala/org/apache/spark/security/CryptoStreamUtils.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,9 @@ private[spark] object CryptoStreamUtils extends Logging {
6767
key: Array[Byte]): WritableByteChannel = {
6868
val params = new CryptoParams(key, sparkConf)
6969
val iv = createInitializationVector(params.conf)
70-
val buf = ByteBuffer.wrap(iv)
71-
while (buf.hasRemaining()) {
72-
channel.write(buf)
73-
}
74-
7570
val helper = new CryptoHelperChannel(channel)
71+
72+
helper.write(ByteBuffer.wrap(iv))
7673
new CryptoOutputStream(params.transformation, params.conf, helper, params.keySpec,
7774
new IvParameterSpec(iv))
7875
}

core/src/main/scala/org/apache/spark/storage/BlockManager.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ private[spark] trait BlockData {
6464

6565
def toInputStream(): InputStream
6666

67+
/**
68+
* Returns a Netty-friendly wrapper for the block's data.
69+
*
70+
* @see [[ManagedBuffer#convertToNetty()]]
71+
*/
6772
def toNetty(): Object
6873

6974
def toChunkedByteBuffer(allocator: Int => ByteBuffer): ChunkedByteBuffer

core/src/main/scala/org/apache/spark/storage/BlockManagerManagedBuffer.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ import org.apache.spark.network.buffer.ManagedBuffer
2525
import org.apache.spark.util.io.ChunkedByteBuffer
2626

2727
/**
28-
* This [[ManagedBuffer]] wraps a ManagedBuffer retrieved from the [[BlockManager]]
28+
* This [[ManagedBuffer]] wraps a [[BlockData]] instance retrieved from the [[BlockManager]]
2929
* so that the corresponding block's read lock can be released once this buffer's references
3030
* are released.
3131
*
32+
* If `dispose` is set to try, the [[BlockData]]will be disposed when the buffer's reference
33+
* count drops to zero.
34+
*
3235
* This is effectively a wrapper / bridge to connect the BlockManager's notion of read locks
3336
* to the network layer's notion of retain / release counts.
3437
*/

0 commit comments

Comments
 (0)