[jira] [Commented] (GROOVY-7811) Block frequently occurs Groovy multithreading capabilities of mixin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jira] [Commented] (GROOVY-7811) Block frequently occurs Groovy multithreading capabilities of mixin

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/GROOVY-7811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16017061#comment-16017061 ]

Jochen Kemnade commented on GROOVY-7811:
----------------------------------------

The test case above will spend a lot of time doing the {{println}}. I've slightly modified it to be able to compare the results better:
{code}
import java.util.concurrent.*

    ExecutorService service = Executors.newFixedThreadPool(100)
    long start = System.currentTimeMillis()

    (1..100000).each {
        service.submit(new Runnable() {
            @Override
            void run() {
                invoke()
            }
        })

    }
    service.shutdown()
    service.awaitTermination(1, TimeUnit.MINUTES)
    long end = System.currentTimeMillis()
    println "Execution took ${end-start} ms"
   
static void invoke() {
    User user = new User()
    long start = System.nanoTime()
    user.metaClass.mixin(Man)
}

class User {}
class Man {}
{code}

> Block frequently occurs Groovy multithreading capabilities of mixin
> -------------------------------------------------------------------
>
>                 Key: GROOVY-7811
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7811
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.6
>            Reporter: 刘新宇
>         Attachments: 0001-GROOVY-7811-move-constructor-out-of-the-synchronized.patch
>
>
> Groovy:2.4.6
> please see : http://stackoverflow.com/questions/36419161/block-frequently-occurs-groovy-multithreading-capabilities-of-mixin#comment60481097_36419161



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
Loading...