|
Groovy example source code file (message.java)
The Groovy message.java source code/* The Computer Language Benchmarks Game http://shootout.alioth.debian.org/ contributed by Mattias Bergander */ import java.util.LinkedList; import java.util.List; public class message { public static final int numberOfThreads = 500; public static int numberOfMessagesToSend; public static void main(String args[]) { numberOfMessagesToSend = Integer.parseInt(args[0]); MessageThread chain = null; for (int i = 0; i < numberOfThreads; i++) { chain = new MessageThread(chain); new Thread(chain).start(); } for (int i = 0; i < numberOfMessagesToSend; i++) { chain.enqueue(new MutableInteger(0)); } } } class MutableInteger { int value; public MutableInteger() { this(0); } public MutableInteger(int value) { this.value = value; } public MutableInteger increment() { value++; return this; } public int intValue() { return value; } } class MessageThread implements Runnable { MessageThread nextThread; List<MutableInteger> list = new LinkedList Other Groovy examples (source code examples)Here is a short list of links related to this Groovy message.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.