Package java.util.concurrent

Examples of java.util.concurrent.FutureTask$Sync


                 logger.debug("took object");
                
                 if (model != null) {
                    
                    try {
                        FutureTask task = null;
                        if (model instanceof PatientVisitModel) {
                            task = new FutureTask(getPvtTask((PatientVisitModel) model));
                            logger.debug("created pvt FutureTask");
                        }
                        else if (model instanceof DocumentModel) {
                            task = new FutureTask(getDocumentTask((DocumentModel) model));
                            logger.debug("created document FutureTask");
                        }
                        logger.debug("start FutureTask");
                        new Thread(task).start();
                        task.get(120, TimeUnit.SECONDS);
                        logger.debug("got result within timeout");
                       
                    } catch (InterruptedException ex) {
                        logger.warn(ex);
                    } catch (ExecutionException ex) {
View Full Code Here


                public Message createMessage(Session session) throws JMSException {
                    Message message = endpoint.getBinding().makeJmsMessage(exchange, in, session, null);
                    message.setJMSReplyTo(replyTo);
                    requestor.setReplyToSelectorHeader(in, message);

                    FutureTask future;
                    future = (!msgIdAsCorrId)
                            ? requestor.getReceiveFuture(message.getJMSCorrelationID(), endpoint.getConfiguration().getRequestTimeout())
                            : requestor.getReceiveFuture(callback);

                    futureHolder.set(future);
View Full Code Here

                public Message createMessage(Session session) throws JMSException {
                    Message message = endpoint.getBinding().makeJmsMessage(exchange, in, session);
                    message.setJMSReplyTo(replyTo);
                    requestor.setReplyToSelectorHeader(in, message);

                    FutureTask future = null;
                    future = (!msgIdAsCorrId)
                            ? requestor.getReceiveFuture(message.getJMSCorrelationID(), endpoint.getConfiguration().getRequestTimeout())
                            : requestor.getReceiveFuture(callback);

                    futureHolder.set(future);
View Full Code Here

                public Message createMessage(Session session) throws JMSException {
                    Message message = endpoint.getBinding().makeJmsMessage(exchange, in, session);
                    message.setJMSReplyTo(replyTo);
                    requestor.setReplyToSelectorHeader(in, message);

                    FutureTask future = null;
                    future = (!msgIdAsCorrId)
                        ? requestor.getReceiveFuture(message.getJMSCorrelationID(), endpoint
                            .getRequestTimeout()) : requestor.getReceiveFuture(callback);

                    futureHolder.set(future);
View Full Code Here

                overflowNotificationTime -= OVERFLOW_RENOTIFICATION_DELAY;
               
            } else {
               
                try {
                    final FutureTask result = new FutureTask(new Callable() {
                        public Object call() throws Exception {
                            return queuedActivateNextLogFile();
                        }});
                    executor.execute(result);
                    Location location = (Location) result.get();
                    appendLogFileId = location.getLogFileId();
                    appendLogFileOffset = location.getLogFileOffset();
   
                } catch (InterruptedException e) {
                    throw (IOException) new IOException("Interrupted.").initCause(e);
View Full Code Here

            }
        }

        // Run this in the queued executor thread.
        try {
            final FutureTask result = new FutureTask(new Callable() {
                public Object call() throws Exception {
                    return queuedGetNextRecordLocation((Location) lastLocation);
                }});
            executor.execute(result);
            return (Location) result.get();
        } catch (InterruptedException e) {
            throw (IOException) new IOException("Interrupted.").initCause(e);
        }
        catch (ExecutionException e) {
            throw handleExecutionException(e);
View Full Code Here

     */
    public Packet read(final RecordLocation l) throws IOException, InvalidRecordLocationException {
        final Location location = (Location) l;
        // Run this in the queued executor thread.
        try {
            final FutureTask result = new FutureTask(new Callable() {
                public Object call() throws Exception {
                    return file.readPacket(location);
                }});
            executor.execute(result);
            return (Packet) result.get();
        } catch (InterruptedException e) {
            throw (IOException) new IOException("Interrupted.").initCause(e);
        }
        catch (ExecutionException e) {
            throw handleExecutionException(e);
View Full Code Here

public class ExecuteLearn {

    public void testFuture() {
        CompletionService cs ;
        Future future;
        FutureTask ft;

    }
View Full Code Here

    }


    private Future getReduceTestEntry( Object value ) {
        // Create a task and run it, assuring that the tests won't block on a get.
        FutureTask task = new FutureTask( new ReduceTestEntry( value ) );
        task.run();
        return task;
    }
View Full Code Here

    @Override
    public RepairAlgo constructRepairAlgo(final Supplier<List<Long>> survivors, final String whoami) {
        RepairAlgo ra = null;
        if (Thread.currentThread().getId() != m_taskThreadId) {
            FutureTask<RepairAlgo> ft = new FutureTask(new Callable<RepairAlgo>() {
                @Override
                public RepairAlgo call() throws Exception {
                    RepairAlgo ra = new MpPromoteAlgo( survivors.get(), MpInitiatorMailbox.this, whoami);
                    setRepairAlgoInternal(ra);
                    return ra;
                }
            });
            m_taskQueue.offer(ft);
            try {
                ra = ft.get();
            } catch (Exception e) {
                Throwables.propagate(e);
            }
        } else {
            ra = new MpPromoteAlgo( survivors.get(), this, whoami);
View Full Code Here

TOP

Related Classes of java.util.concurrent.FutureTask$Sync

Copyright © 2018 www.massapicom. 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.