mirror of
https://github.com/apple/pkl.git
synced 2026-04-18 14:39:54 +02:00
Polish external reader API/implementation (#759)
- keep implementation classes internal to their packages - make classes final if possible - make namespace classes non-instantiable - throw IllegalStateException instead of ExternalReaderProcessException for use after close - common convention already used by HttpClient etc. - programming errors should be signaled with unchecked exceptions - use private instead of public lock object - polish Javadoc - delete commented out code - don't use star import for a single class
This commit is contained in:
@@ -25,7 +25,6 @@ import kotlin.random.Random
|
||||
import org.pkl.core.*
|
||||
import org.pkl.core.evaluatorSettings.PklEvaluatorSettings.ExternalReader
|
||||
import org.pkl.core.externalreader.ExternalReaderProcess
|
||||
import org.pkl.core.externalreader.ExternalReaderProcessImpl
|
||||
import org.pkl.core.http.HttpClient
|
||||
import org.pkl.core.messaging.MessageTransport
|
||||
import org.pkl.core.messaging.MessageTransports
|
||||
@@ -286,5 +285,5 @@ class Server(private val transport: MessageTransport) : AutoCloseable {
|
||||
private fun getExternalProcess(evaluatorId: Long, spec: ExternalReader): ExternalReaderProcess =
|
||||
externalReaderProcesses
|
||||
.computeIfAbsent(evaluatorId) { ConcurrentHashMap() }
|
||||
.computeIfAbsent(spec) { ExternalReaderProcessImpl(it) }
|
||||
.computeIfAbsent(spec) { ExternalReaderProcess.of(it) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user