Example usage for java.util.concurrent Executors newCachedThreadPool

List of usage examples for java.util.concurrent Executors newCachedThreadPool

Introduction

In this page you can find the example usage for java.util.concurrent Executors newCachedThreadPool.

Prototype

public static ExecutorService newCachedThreadPool() 

Source Link

Document

Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available.

Usage

From source file:com.netcore.hsmart.smsconsumers.SmsConsumer555.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new SmsConsumer555Runnable(Integer.toString(i));
        executor.execute(worker);//from w  w w  .j a va  2 s. c  om
    }
}

From source file:org.graylog.plugins.beats.ConsolePrinter.java

public static void main(String[] args) {
    String hostname = "127.0.0.1";
    int port = 5044;
    if (args.length >= 2) {
        hostname = args[0];/*from  w  ww  .j  a v a2s.c o  m*/
        port = firstNonNull(Ints.tryParse(args[1]), 5044);
    }
    if (args.length >= 1) {
        port = firstNonNull(Ints.tryParse(args[1]), 5044);
    }

    final ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
            Executors.newCachedThreadPool());
    final ServerBootstrap b = new ServerBootstrap(factory);
    b.getPipeline().addLast("beats-frame-decoder", new BeatsFrameDecoder());
    b.getPipeline().addLast("beats-codec", new BeatsCodecHandler());
    b.getPipeline().addLast("logging", new LoggingHandler());
    System.out.println("Starting listener on " + hostname + ":" + port);
    b.bind(new InetSocketAddress(hostname, port));
}

From source file:com.netcore.hsmart.smsconsumers.SmsConsumer558.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new SmsConsumer558Runnable(Integer.toString(i));
        executor.execute(worker);//from   ww w.j av  a 2s.  com
    }
}

From source file:com.netcore.hsmart.smsconsumers.SmsConsumer556.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new SmsConsumer556Runnable(Integer.toString(i));
        executor.execute(worker);//from w ww. ja  v a 2 s. co m
    }
}

From source file:com.netcore.hsmart.dlrconsumers.DlrConsumer558.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new DlrConsumer558Runnable(Integer.toString(i));
        executor.execute(worker);//from  ww w .  j  a v a2s  .c  om
    }
}

From source file:com.netcore.hsmart.dlrconsumers.DlrConsumer555.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new DlrConsumer555Runnable(Integer.toString(i));
        executor.execute(worker);//from   w  ww  . jav a2 s.  c o m
    }
}

From source file:com.netcore.hsmart.smsconsumers.SmsConsumer562.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new SmsConsumer562Runnable(Integer.toString(i));
        executor.execute(worker);/*from w  ww.j av a 2  s .com*/
    }
}

From source file:com.netcore.hsmart.smsconsumers.SmsConsumer563.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new SmsConsumer563Runnable(Integer.toString(i));
        executor.execute(worker);//from  www . ja v a 2 s .c  o  m
    }
}

From source file:com.netcore.hsmart.smsconsumers.SmsConsumer559.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new SmsConsumer559Runnable(Integer.toString(i));
        executor.execute(worker);//ww  w. j a  va  2 s .  c  om
    }
}

From source file:com.netcore.hsmart.smsconsumers.SmsConsumer564.java

public static void main(String args[]) throws Exception {

    ExecutorService executor = Executors.newCachedThreadPool();

    for (int i = 1; i <= COUNTERS; i++) {
        Runnable worker = new SmsConsumer564Runnable(Integer.toString(i));
        executor.execute(worker);//from ww w.  j  a  v a  2s  .c om
    }
}