core / pragma.utils /

Package pragma.utils #

Types #

NameSummary

AlertingMutex

open class AlertingMutex(name: String, locked: Boolean = false) : Mutex

AlertingMutex is an implementation of the Mutex interface that will log a warning if it cannot obtain a lock after 5000 ms.

InstancedConcurrentMap

class InstancedConcurrentMap<K : Any, V : Any>(val instanceId: UUID, val routingUtils: RoutingUtils = RoutingUtils.defaultInstance, val serviceInstanceCount: Int, val concurrentHashMap: ConcurrentMap<K, V> = ConcurrentHashMap()) : Iterable<Map.Entry<K, V>>

Map class that validates keys on "put" into the map. This is for the deterministic routing that drives the whole Pragma architecture.

JumpHash

class JumpHash

Algorithm from: https://arxiv.org/ftp/arxiv/papers/1406/1406.2294.pdf.

MetrickingMutex

class MetrickingMutex(name: String, metricsManager: MetricsManager, locked: Boolean = false) : AlertingMutex

MetrickingMutex is an implementation of the Mutex interface that will log a warning and increment the "pragma.engine.mutex.waitingForLock" metric every 60s if it cannot obtain a lock.

ProcessBuilderFactory

class ProcessBuilderFactory

Simple wrapper around ProcessBuilder to allow for dependency injection for testing.

Functions #

NameSummary

receiveEncodedTextUsingIOContext

suspend fun ApplicationCall.receiveEncodedTextUsingIOContext(): String

Receive the request as a string.

removePrefixIgnoreCase

fun String.removePrefixIgnoreCase(prefix: CharSequence): String

If this string starts with the given prefix (ignoring case), returns a copy of this string with the prefix removed. Otherwise, returns this string.

removeSuffixIgnoreCase

fun String.removeSuffixIgnoreCase(suffix: CharSequence): String

If this string ends with the given suffix (ignoring case), returns a copy of this string with the suffix removed. Otherwise, returns this string.