Examples of DaemonThreadFactory


Examples of org.apache.hadoop.hbase.client.HTable.DaemonThreadFactory

    TEST_UTIL.createTable(TABLE_NAME1, FAM_NAM);
    HConnection conn = HConnectionManager.createConnection(TEST_UTIL.getConfiguration());
    ThreadPoolExecutor pool = new ThreadPoolExecutor(1, 10,
        60, TimeUnit.SECONDS,
        new SynchronousQueue<Runnable>(),
        new DaemonThreadFactory());

    HTable table = new HTable(TABLE_NAME1, conn, pool);
    table.close();
    assertFalse(conn.isClosed());
    assertFalse(pool.isShutdown());
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTable.DaemonThreadFactory

    HConnection conn = HConnectionManager.createConnection(TEST_UTIL
        .getConfiguration());
    ExecutorService pool = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
        60, TimeUnit.SECONDS,
        new SynchronousQueue<Runnable>(),
        new DaemonThreadFactory());
    ((ThreadPoolExecutor)pool).allowCoreThreadTimeOut(true);
    HTable t = new HTable(tableName, conn, pool);
    HBaseAdmin ha = new HBaseAdmin(conn);
    assertTrue(ha.tableExists(tableName));
    assertTrue(t.get(new Get(ROW)).isEmpty());
View Full Code Here

Examples of org.apache.hadoop.hdfs.util.DaemonThreadFactory

  public void setNumParallelThreadsForReads(int num) {
    if (this.parallelReadsThreadPool == null) {
      this.parallelReadsThreadPool = new ThreadPoolExecutor(1,
          num, 60, TimeUnit.SECONDS,
        new SynchronousQueue<Runnable>(),
        new DaemonThreadFactory("dfsclient-reader-thread-"),
        new ThreadPoolExecutor.CallerRunsPolicy() {
       
          public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
            // increment metrics
            LOG.debug("Execution rejected, Executing in current thread");
View Full Code Here

Examples of org.apache.openejb.util.DaemonThreadFactory

                "org.apache.xbean.recipe.ReflectionUtil",
                "org.slf4j.LoggerFactory",
                "org.slf4j.impl.StaticLoggerBinder",
        };

        final ExecutorService executor = Executors.newFixedThreadPool(4, new DaemonThreadFactory("warmup"));

        executor.execute(new JaxbJavaeeLoad(WebApp.class));
        executor.execute(new Runnable() {
            @Override
            public void run() {
View Full Code Here

Examples of org.apache.openejb.util.DaemonThreadFactory

            this.executor = new ThreadPoolExecutor(2
                    , size
                    , 60L
                    , TimeUnit.SECONDS
                    , new LinkedBlockingQueue<Runnable>(size)
                    , new DaemonThreadFactory(DefaultTimerThreadPoolAdapter.class)
                    , new RejectedExecutionHandler() {
                @Override
                public void rejectedExecution(final Runnable r, final ThreadPoolExecutor tpe) {

                    if (null == r || null == tpe || tpe.isShutdown() || tpe.isTerminated() || tpe.isTerminating()) {
View Full Code Here

Examples of org.apache.openejb.util.DaemonThreadFactory

            // Create a thead pool for work manager
            final int threadPoolSize = getIntProperty(serviceInfo.properties, "threadPoolSize", 30);
            final Executor threadPool;
            if (threadPoolSize <= 0) {
                logger.warning("Thread pool for '" + serviceInfo.id + "' is (unbounded), consider setting a size using: " + serviceInfo.id + ".QueueSize=[size]");
                threadPool = Executors.newCachedThreadPool(new DaemonThreadFactory(serviceInfo.id + "-worker-"));
            } else {
                threadPool = new ExecutorBuilder()
                    .size(threadPoolSize)
                    .prefix(serviceInfo.id)
                    .threadFactory(new DaemonThreadFactory(serviceInfo.id + "-worker-"))
                    .build(new Options(serviceInfo.properties, SystemInstance.get().getOptions()));
                logger.info("Thread pool size for '" + serviceInfo.id + "' is (" + threadPoolSize + ")");
            }

            // WorkManager: the resource adapter can use this to dispatch messages or perform tasks
View Full Code Here

Examples of org.apache.openejb.util.DaemonThreadFactory

        this.systemInstance = systemInstance;
        this.globalJndiContext = globalJndiContext;
        this.appJndiContext = appJndiContext;
        this.standaloneModule = standaloneModule;
        this.blockingQueue = new LinkedBlockingQueue<Runnable>();
        this.asynchPool = new ThreadPoolExecutor(10, 20, 60, TimeUnit.SECONDS, blockingQueue, new DaemonThreadFactory("@Asynch", id));
    }
View Full Code Here

Examples of org.apache.openejb.util.DaemonThreadFactory

    private boolean threadPoolExecutorUsed;

    public DefaultTimerThreadPoolAdapter() {
        executor = SystemInstance.get().getComponent(Executor.class);
        if (executor == null) {
            executor = Executors.newFixedThreadPool(10, new DaemonThreadFactory(DefaultTimerThreadPoolAdapter.class));
            SystemInstance.get().setComponent(Executor.class, executor);
        }
        threadPoolExecutorUsed = executor instanceof ThreadPoolExecutor;
        if (!threadPoolExecutorUsed) {
            logger.warning("Unrecognized ThreadPool implementation [" + executor.getClass().getName() + "] is used, EJB Timer service may not work correctly");
View Full Code Here

Examples of org.apache.openejb.util.DaemonThreadFactory

        }

        tldUrls.addAll(scan(classLoader.getParent()));

        if (urls.size() > 0) {
            final ExecutorService es = Executors.newFixedThreadPool(2 * Runtime.getRuntime().availableProcessors() + 1, new DaemonThreadFactory("OpenEJB-tld-server-scanning"));

            final Collection<Future<Set<URL>>> futures = new ArrayList<Future<Set<URL>>>(urls.size());
            for (URL url : urls) {
                if (url.getProtocol().equals("jar")) {
                    try {
View Full Code Here

Examples of org.apache.openejb.util.DaemonThreadFactory

            int length = getNetworkInterfaces().length;
            if (length < 1) {
                length = 1;
            }

            executor = Executors.newFixedThreadPool(length * 3, new DaemonThreadFactory("multicast-pulse-agent-"));
        }

        return executor;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.