org.jetbrains.kotlinx.jupyter.messaging.MessageHandlerImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-jupyter-kernel Show documentation
Show all versions of kotlin-jupyter-kernel Show documentation
Kotlin Jupyter kernel published as artifact
package org.jetbrains.kotlinx.jupyter.messaging
import org.jetbrains.kotlinx.jupyter.api.KernelLoggerFactory
import org.jetbrains.kotlinx.jupyter.api.libraries.RawMessage
import org.jetbrains.kotlinx.jupyter.closeIfPossible
import org.jetbrains.kotlinx.jupyter.execution.JupyterExecutor
import org.jetbrains.kotlinx.jupyter.messaging.comms.CommManagerInternal
import org.jetbrains.kotlinx.jupyter.repl.ReplForJupyter
import java.io.Closeable
class MessageHandlerImpl(
private val loggerFactory: KernelLoggerFactory,
private val repl: ReplForJupyter,
private val commManager: CommManagerInternal,
private val messageFactoryProvider: MessageFactoryProvider,
private val socketManager: JupyterBaseSockets,
private val executor: JupyterExecutor,
) : AbstractMessageHandler(), Closeable {
private val executionCounter = ExecutionCounter(1)
override fun createProcessor(message: RawMessage): MessageRequestProcessor {
return MessageRequestProcessorImpl(
message,
messageFactoryProvider,
socketManager,
commManager,
executor,
executionCounter,
loggerFactory,
repl,
)
}
override fun close() {
repl.closeIfPossible()
}
}