Examples of Executor


Examples of java.util.concurrent.Executor

            // result of calling AsyncContext.dispatch() from a non-container
            // thread
            synchronized (socket) {
                if (waitingRequests.remove(socket)) {
                    SocketProcessor proc = new SocketProcessor(socket,status);
                    Executor executor = getExecutor();
                    if (dispatch && executor != null) {
                        // During shutdown, executor may be null - avoid NPE
                        if (!running) {
                            return;
                        }
View Full Code Here

Examples of java.util.concurrent.Executor

            }
            attachment.setCometNotify(false); //will get reset upon next reg
            SocketProcessor sc = processorCache.pop();
            if ( sc == null ) sc = new SocketProcessor(socket,status);
            else sc.reset(socket,status);
            Executor executor = getExecutor();
            if (dispatch && executor != null) {
                executor.execute(sc);
            } else {
                sc.run();
            }
        } catch (RejectedExecutionException ree) {
            log.warn(sm.getString("endpoint.executor.fail", socket), ree);
View Full Code Here

Examples of java.util.concurrent.Executor

     * Process given socket. Called in non-comet mode, typically keep alive
     * or upgraded protocol.
     */
    public boolean processSocket(long socket, SocketStatus status) {
        try {
            Executor executor = getExecutor();
            if (executor == null) {
                log.warn(sm.getString("endpoint.warn.noExector",
                        Long.valueOf(socket), null));
            } else {
                SocketWrapper<Long> wrapper =
                        connections.get(Long.valueOf(socket));
                // Make sure connection hasn't been closed
                if (wrapper != null) {
                    executor.execute(new SocketProcessor(wrapper, status));
                }
            }
        } catch (RejectedExecutionException x) {
            log.warn("Socket processing request was rejected for:"+socket,x);
            return false;
View Full Code Here

Examples of java.util.concurrent.Executor

            // result of calling AsyncContext.dispatch() from a non-container
            // thread
            synchronized (socket) {
                if (waitingRequests.remove(socket)) {
                    SocketProcessor proc = new SocketProcessor(socket, status);
                    Executor executor = getExecutor();
                    if (dispatch && executor != null) {
                        executor.execute(proc);
                    } else {
                        proc.run();
                    }
                }
            }
View Full Code Here

Examples of java.util.concurrent.Executor

        final Whiteboard whiteboard = new OsgiWhiteboard(this.getComponentContext().getBundleContext());
        this.indexProvider.start(whiteboard);
        this.indexEditorProvider.start(whiteboard);
        this.oakExecutorServiceReference = this.componentContext.getBundleContext().registerService(
                Executor.class.getName(), new Executor() {
            @Override
            public void execute(Runnable command) {
                threadPool.execute(command);
            }
        }, new Hashtable<String, Object>());
View Full Code Here

Examples of java.util.concurrent.Executor

    overrides.put(FileChannelConfiguration.TRANSACTION_CAPACITY,
        String.valueOf(100));
    channel = createFileChannel(overrides);
    channel.start();
    Assert.assertTrue(channel.isOpen());
    Executor executor = Executors.newFixedThreadPool(numThreads);
    Set<String> in = fillChannel(channel, "threaded-consume");
    final AtomicBoolean error = new AtomicBoolean(false);
    final CountDownLatch startLatch = new CountDownLatch(numThreads);
    final CountDownLatch stopLatch = new CountDownLatch(numThreads);
    final Set<String> out = Collections.synchronizedSet(new HashSet<String>());
    for (int i = 0; i < numThreads; i++) {
      executor.execute(new Runnable() {
        @Override
        public void run() {
          try {
            startLatch.countDown();
            startLatch.await();
View Full Code Here

Examples of java.util.concurrent.Executor

    overrides.put(FileChannelConfiguration.TRANSACTION_CAPACITY,
        String.valueOf(100));
    channel = createFileChannel(overrides);
    channel.start();
    Assert.assertTrue(channel.isOpen());
    Executor executor = Executors.newFixedThreadPool(numThreads);
    final AtomicBoolean error = new AtomicBoolean(false);
    final CountDownLatch startLatch = new CountDownLatch(numThreads);
    final CountDownLatch stopLatch = new CountDownLatch(numThreads);
    final Set<String> in = Collections.synchronizedSet(new HashSet<String>());
    for (int i = 0; i < numThreads; i++) {
      executor.execute(new Runnable() {
        @Override
        public void run() {
          try {
            startLatch.countDown();
            startLatch.await();
View Full Code Here

Examples of liquibase.executor.Executor

  public boolean acquireLock() throws LockException {
    if (hasChangeLogLock) {
      return true;
    }

    Executor executor = ExecutorService.getInstance().getExecutor(database);

    try {
      database.rollback();
      database.checkDatabaseChangeLogLockTable();
      Object lockObject = (Object) ExecutorService.getInstance().getExecutor(database)
          .queryForObject(new SelectFromDatabaseChangeLogLockStatement("LOCKED"), Object.class);
      if (checkReturnValue(lockObject)) {
        // To here
        return false;
      } else {
        executor.comment("Lock Database");
        int rowsUpdated = executor.update(new LockExDatabaseChangeLogStatement());
        if (rowsUpdated > 1) {
          throw new LockException("Did not update change log lock correctly");
        }

        if (rowsUpdated == 0) {
View Full Code Here

Examples of org.apache.catalina.Executor

        if (wrappedConnector && this.connector.getState().equals(LifecycleState.STARTED)) {
            return;
        }

        String executorName=null;
        Executor executor=null;

        if (this.connector.getAttribute("executor") != null) {

            Object value = connector.getAttribute("executor");
            if (value == null)
                executorName=null;

            if (value instanceof String)
                executorName= (String)value;

            if(value instanceof Executor){
                executorName= ((Executor) value).getName();
            }

            executor = TomcatServerGBean.executors.get(executorName);

            if (executor == null) {

                log.warn("No executor found with name:" + executorName+", trying to get default executor with name 'DefaultThreadPool'");
                executor = TomcatServerGBean.executors.get("DefaultThreadPool");
            }


        } else {

            executor = TomcatServerGBean.executors.get("DefaultThreadPool");

            if (executor == null) {

                log.warn("No executor found in service with name: DefaultThreadPool");

            }
        }


        if (executor != null)

        {
            log.info("executor:"+executor.getName()+" found, set it to connector:"+this.getName() );

            try {

                IntrospectionUtils.callMethod1(this.connector.getProtocolHandler(),
                                                "setExecutor",
View Full Code Here

Examples of org.apache.commons.exec.Executor

       
        if (clojureArgs != null) {
            cl.addArguments(clojureArgs, false);
        }
       
        Executor exec = new DefaultExecutor();
        Map<String,String> env = new HashMap<String,String>(System.getenv());
        env.put("path", ";");
        env.put("path", System.getProperty("java.home"));
       
        ExecuteStreamHandler handler = new CustomPumpStreamHandler(System.out, System.err, System.in);
        exec.setStreamHandler(handler);
       
        int status;
        try {
            status = exec.execute(cl, env);
        } catch (ExecuteException e) {
            status = e.getExitValue();
        } catch(IOException e) {
            status = 1;
        }
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.