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

io.vertx.up.uca.rs.hunt.adaptor.ZERO Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.up.uca.rs.hunt.adaptor;

import io.vertx.up.fn.Fn;

import javax.ws.rs.core.MediaType;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Supplier;

/**
 * @author Lang
 */
interface Pool {
    ConcurrentMap POOL_THREAD = new ConcurrentHashMap<>();

    ConcurrentMap>> SELECT_POOL = new ConcurrentHashMap>>() {
        {
            /* Type `*` */
            this.put(MediaType.WILDCARD_TYPE.getType(), new ConcurrentHashMap>() {
                {
                    /* SubType `*` */
                    this.put(MediaType.WILDCARD_TYPE.getSubtype(),
                        () -> Fn.poolThread(POOL_THREAD, JsonWings::new, MediaType.WILDCARD_TYPE.toString()));
                }
            });

            /* Type `application` */

            this.put(MediaType.APPLICATION_JSON_TYPE.getType(), new ConcurrentHashMap>() {
                {
                    /* SubType: json */
                    this.put(MediaType.APPLICATION_JSON_TYPE.getSubtype(),
                        () -> Fn.poolThread(POOL_THREAD, JsonWings::new, MediaType.APPLICATION_JSON_TYPE.toString()));

                    /* SubType: octet-stream */
                    this.put(MediaType.APPLICATION_OCTET_STREAM_TYPE.getSubtype(),
                        () -> Fn.poolThread(POOL_THREAD, BufferWings::new, MediaType.APPLICATION_OCTET_STREAM_TYPE.toString()));
                }
            });
        }
    };
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy