diff --git a/AsyncSocket/src/test/kotlin/cn/tursom/datagram/server/test.kt b/AsyncSocket/src/test/kotlin/cn/tursom/datagram/server/test.kt index 7a1fa83..e82346c 100644 --- a/AsyncSocket/src/test/kotlin/cn/tursom/datagram/server/test.kt +++ b/AsyncSocket/src/test/kotlin/cn/tursom/datagram/server/test.kt @@ -5,7 +5,7 @@ import cn.tursom.core.pool.DirectMemoryPool import cn.tursom.datagram.AsyncDatagramClient import cn.tursom.log.impl.Slf4jImpl import cn.tursom.socket.NioClient -import cn.tursom.socket.server.BuffedNioServer +import cn.tursom.socket.server.BufferedNioServer import kotlinx.coroutines.runBlocking val logger = Slf4jImpl.getLogger() @@ -22,7 +22,7 @@ val echoHandler: suspend BufferedAsyncChannel.() -> Unit = { fun main() { val port = 12345 val pool = DirectMemoryPool(1024, 16) - val server = BuffedNioServer(port, pool, handler = echoHandler) + val server = BufferedNioServer(port, pool, handler = echoHandler) //val server = LoopDatagramServer(port, protocol = object : NioProtocol { // override fun handleRead(key: SelectionKey, nioThread: NioThread) { // val datagramChannel = key.channel() as DatagramChannel diff --git a/src/main/kotlin/cn/tursom/core/datastruct/AtomicBitSet.kt b/src/main/kotlin/cn/tursom/core/datastruct/AtomicBitSet.kt index b3a2307..3f9e997 100644 --- a/src/main/kotlin/cn/tursom/core/datastruct/AtomicBitSet.kt +++ b/src/main/kotlin/cn/tursom/core/datastruct/AtomicBitSet.kt @@ -1,10 +1,7 @@ package cn.tursom.core.datastruct -import cn.tursom.core.randomInt -import cn.tursom.core.usingTime import java.io.Serializable import java.lang.reflect.Field -import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicLongArray import kotlin.random.Random @@ -229,26 +226,3 @@ class AtomicBitSet(beginSize: Long = 256, val defaultState: Boolean = false) : S } } } - -//val scand = AtomicInteger(0) - -fun main() { - val size = 1000000 - val bitSet = AtomicBitSet(size.toLong()) - println(usingTime { - repeat(1000) { - bitSet.downAll() - repeat(size) { - val index = bitSet.getDownIndex() - bitSet.up(index) - repeat(randomInt(0, 3) / 2) { - val randomUpIndex = bitSet.randomUpIndex() - if (randomUpIndex >= 0) { - bitSet.down(randomUpIndex) - } - } - } - } - }) - //println(scand.get() / 100) -} \ No newline at end of file