All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.femo.http.drivers.server.HttpThreadFactory Maven / Gradle / Ivy

Go to download

An easy to use HTTP API, that supports synchronous and asynchronous execution of HTTP request. On android only asynchronous driver is supported. This library has been backported to jdk 7 to retain compatibility with android!

The newest version!
package io.femo.http.drivers.server;

import java.util.concurrent.ThreadFactory;

/**
 * Created by Felix Resch on 29-Apr-16.
 */
public class HttpThreadFactory implements ThreadFactory {

    private int port;
    private int counter = 0;

    public HttpThreadFactory(int port) {
        this.port = port;
    }

    @Override
    public Thread newThread(Runnable r) {
        HttpThread httpThread = new HttpThread(r);
        httpThread.setName(String.format("pool-%04d-thread-%03d", port, counter++));
        httpThread.setDaemon(true);
        httpThread.setPriority(Thread.MAX_PRIORITY);
        return httpThread;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy