Skip to content

Instantly share code, notes, and snippets.

@samueleresca
Created September 25, 2019 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueleresca/fbaa26cb5f7aa8d68361e8bacf86dde7 to your computer and use it in GitHub Desktop.
Save samueleresca/fbaa26cb5f7aa8d68361e8bacf86dde7 to your computer and use it in GitHub Desktop.
/*
* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*/
package org.apache.spark.api.dotnet
import java.io.DataOutputStream
import java.net.{InetSocketAddress, Socket}
import java.util.concurrent.{BlockingQueue, LinkedBlockingQueue, TimeUnit}
import io.netty.bootstrap.ServerBootstrap
import io.netty.channel.nio.NioEventLoopGroup
import io.netty.channel.socket.SocketChannel
import io.netty.channel.socket.nio.NioServerSocketChannel
import io.netty.channel.{ChannelFuture, ChannelInitializer, EventLoopGroup}
import io.netty.handler.codec.LengthFieldBasedFrameDecoder
import io.netty.handler.codec.bytes.{ByteArrayDecoder, ByteArrayEncoder}
import org.apache.spark.internal.Logging
/**
* Netty server that invokes JVM calls based upon receiving messages from .NET.
* The implementation mirrors the RBackend.
*
*/
class DotnetBackend extends Logging {
self => // for accessing the this reference in inner class(ChannelInitializer)
private[this] var channelFuture: ChannelFuture = _
private[this] var bootstrap: ServerBootstrap = _
private[this] var bossGroup: EventLoopGroup = _
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment