提交 44a3cafc 编写于 作者: oldratlee's avatar oldratlee 🔥

remove args of main method for kotlin

上级 2ef8af25
......@@ -226,7 +226,7 @@ Demo参见[`AgentDemo.kt`](src/test/java/com/alibaba/demo/agent/AgentDemo.kt)。
- **_注意_**:从`2.11.2`版本开始缺省开启`TimerTask`的修饰(因为保证正确性是第一位,而不是最佳实践『不推荐使用`TimerTask`』:);`2.11.1`版本及其之前的版本没有缺省开启`TimerTask`的修饰。
- 使用`Agent`参数`ttl.agent.enable.timer.task`开启/关闭`TimerTask`的修饰:
- `-javaagent:path/to/transmittable-thread-local-2.x.x.jar=ttl.agent.enable.timer.task:true`
- `-javaagent:path/to/transmittable-thread-local-2.x.x.jar=ttl.agent.enable.timer.task:false`
- `-javaagent:path/to/transmittable-thread-local-2.x.x.jar=ttl.agent.enable.timer.task:false`
- 更多关于`TTL Agent`参数的配置说明详见[`TtlAgent.java`的JavaDoc](src/main/java/com/alibaba/ttl/threadpool/agent/TtlAgent.java)
> **关于`java.util.TimerTask`/`java.util.Timer`**
......
......@@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit
/**
* @author Jerry Lee (oldratlee at gmail dot com)
*/
fun main(args: Array<String>) {
fun main() {
val executorService = Executors.newFixedThreadPool(3)
expandThreadPool(executorService)
......
......@@ -15,7 +15,7 @@ import kotlin.coroutines.CoroutineContext
* - [How to use code that relies on ThreadLocal with Kotlin coroutines - Stack Overflow](https://stackoverflow.com/questions/46227462/how-to-use-code-that-relies-on-threadlocal-with-kotlin-coroutines/46227463)
* - [README.md of Module kotlinx-coroutines-slf4j - Kotlin/kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines/blob/master/integration/kotlinx-coroutines-slf4j/README.md)
*/
fun main(args: Array<String>): Unit = runBlocking {
fun main(): Unit = runBlocking {
myThreadLocal.set(MyData("main value"))
async(Dispatchers.IO) {
......
......@@ -17,7 +17,7 @@ import kotlinx.coroutines.runBlocking
* - [Kotlin coroutines in Spring - Code for glory](http://blog.alexnesterov.com/post/kotlin-coroutines-in-spring/)
* - [Kotlin coroutines and Spring 5 - Code for glory](http://blog.alexnesterov.com/post/kotlin-coroutines-and-spring-5/)
*/
fun main(args: Array<String>): Unit = runBlocking {
fun main(): Unit = runBlocking {
println("[${Thread.currentThread().name}] main")
val deferred = async(Dispatchers.IO) {
......
......@@ -6,7 +6,7 @@ import com.alibaba.ttl.threadpool.TtlExecutors
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
fun main(args: Array<String>) {
fun main() {
val threadPool = Executors.newCachedThreadPool().let {
expandThreadPool(it)
TtlExecutors.getTtlExecutorService(it)
......
......@@ -13,7 +13,7 @@ import kotlin.concurrent.thread
*
* @author Jerry Lee (oldratlee at gmail dot com)
*/
fun main(args: Array<String>) {
fun main() {
rpcInvokeIn()
sleep(100)
......
......@@ -24,7 +24,7 @@ private val executorService: ExecutorService = Executors.newFixedThreadPool(1) {
*
* @author Jerry Lee (oldratlee at gmail dot com)
*/
fun main(args: Array<String>) {
fun main() {
for (i in 0..42) {
rpcInvokeIn()
}
......
......@@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit
*
* @author Jerry Lee (oldratlee at gmail dot com)
*/
fun main(args: Array<String>) {
fun main() {
val pool = ForkJoinPool()
val result = pool.invoke(SumTask(1L..100000L))
......
......@@ -2,7 +2,7 @@ package com.alibaba.demo.forkjoinpool
import java.util.concurrent.ConcurrentSkipListSet
fun main(args: Array<String>) {
fun main() {
println("availableProcessors: ${Runtime.getRuntime().availableProcessors()}")
val threadNames: MutableSet<String> = ConcurrentSkipListSet()
......
......@@ -6,7 +6,7 @@ import java.util.*
/**
* @see [Java Timer TimerTask Example](https://www.journaldev.com/1050/java-timer-timertask-example)
*/
fun main(args: Array<String>) {
fun main() {
val timerTask = MyTimerTask()
// running timer task as daemon thread
......
......@@ -7,7 +7,7 @@ import com.alibaba.perf.getRandomString
/**
* @author Jerry Lee (oldratlee at gmail dot com)
*/
fun main(args: Array<String>) {
fun main() {
var counter: Long = 0
while (true) {
val threadLocal = ThreadLocal<String>()
......
......@@ -8,7 +8,7 @@ import com.alibaba.perf.getRandomString
/**
* @author Jerry Lee (oldratlee at gmail dot com)
*/
fun main(args: Array<String>) {
fun main() {
var counter: Long = 0
while (true) {
val threadLocal = TransmittableThreadLocal<String>()
......
......@@ -7,7 +7,7 @@ import com.alibaba.perf.getRandomString
/**
* @author Jerry Lee (oldratlee at gmail dot com)
*/
fun main(args: Array<String>) {
fun main() {
val tpsCounter = TpsCounter(2)
tpsCounter.setAction(Runnable {
......
......@@ -8,7 +8,7 @@ import com.alibaba.perf.getRandomString
/**
* @author Jerry Lee (oldratlee at gmail dot com)
*/
fun main(args: Array<String>) {
fun main() {
val tpsCounter = TpsCounter(2)
tpsCounter.setAction(Runnable {
......
......@@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit
* @author Jerry Lee (oldratlee at gmail dot com)
* @see com.alibaba.ttl.threadpool.agent.internal.transformlet.impl.TtlTimerTaskTransformlet
*/
fun main(args: Array<String>) {
fun main() {
val timer = Timer(true)
printHead("TimerAgentCheck")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册