Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.Callable


      closeAllSuckers();     
     
      //Note we use a timed callable since remoting has a habit of hanging on attempting to close
      //We do not want this to hang the system - especially failover
     
      Callable callable = new Callable() { public Object call()
      {
        try
        {
          connection.close();
        }
        catch (JMSException ignore)
        {         
        }
        return null;
        } };
     
      Callable timedCallable = new TimedCallable(callable, CLOSE_TIMEOUT);
     
      try
      {
        timedCallable.call();
      }
      catch (Throwable t)
      {
        //Ignore - the server might have already closed - so this is ok
      }
View Full Code Here


            MessageSucker sucker = (MessageSucker)iter.next();
           
            sucker.suspend();
         }

         Callable callable = new Callable() { public Object call()
         {
            try
            {
               connection.close();
            }
            catch (JMSException ignore)
            {             
            }
            return null;
          } };
        
         Callable timedCallable = new TimedCallable(callable, CLOSE_TIMEOUT);
        
         try
         {
            timedCallable.call();
         }
         catch (Throwable t)
         {
            //Ignore - the server might have already closed - so this is ok
         }
View Full Code Here

      closeAllSuckers();     
     
      //Note we use a timed callable since remoting has a habit of hanging on attempting to close
      //We do not want this to hang the system - especially failover
     
      Callable callable = new Callable() { public Object call()
      {
        try
        {
          connection.close();
        }
        catch (JMSException ignore)
        {         
        }
        return null;
        } };
     
      Callable timedCallable = new TimedCallable(callable, CLOSE_TIMEOUT);
     
      try
      {
        timedCallable.call();
      }
      catch (Throwable t)
      {
        //Ignore - the server might have already closed - so this is ok
      }
View Full Code Here

    */
   public TextExtractorJob(final DocumentReader extractor, final InputStream stream, final String type,
      final String encoding)
   {
      this.type = type;
      this.cmd = setter(new Callable()
      {
         public Object call() throws Exception
         {
            Reader r = new StringReader(extractor.getContentAsText(stream, encoding));
            if (r != null)
View Full Code Here

    */
   public TextExtractorJob(final DocumentReader extractor, final InputStream stream, final String type,
      final String encoding)
   {
      this.type = type;
      this.cmd = setter(new Callable()
      {
         public Object call() throws Exception
         {
            Reader r = new StringReader(extractor.getContentAsText(stream, encoding));
            if (r != null)
View Full Code Here

      closeAllSuckers();     
     
      //Note we use a timed callable since remoting has a habit of hanging on attempting to close
      //We do not want this to hang the system - especially failover
     
      Callable callable = new Callable() { public Object call()
      {
        try
        {
          connection.close();
        }
        catch (JMSException ignore)
        {         
        }
        return null;
        } };
     
      Callable timedCallable = new TimedCallable(callable, CLOSE_TIMEOUT);
     
      try
      {
        timedCallable.call();
      }
      catch (Throwable t)
      {
        //Ignore - the server might have already closed - so this is ok
      }
View Full Code Here

    /**
     * Calls the <code>construct</code> method to compute the result, and then
     * invokes the <code>finished</code> method on the event dispatch thread.
     */
    public void run() {
        Callable function = new Callable() {
            public Object call() throws Exception {
                return construct();
            }
        };
        Runnable doFinished = new Runnable() {
View Full Code Here

        } else {
            FutureResult[] futures = new FutureResult[commands.length];
            for (int i = 0; i < commands.length; i++) {
                final Command c = commands[i];
                futures[i] = new FutureResult();
                Runnable r = futures[i].setter(new Callable() {
                    public Object call() throws Exception {
                        return c.call();
                    }
                });
                try {
View Full Code Here

        int timeout = irca.getGetTimeoutMillis();

        try
        {
            FutureResult future = new FutureResult();
            Runnable command = future.setter( new Callable()
            {
                public Object call()
                    throws IOException
                {
                    return remote.get( cacheName, key, getListenerId() );
View Full Code Here

    public TextExtractorJob(final TextExtractor extractor,
                            final InputStream stream,
                            final String type,
                            final String encoding) {
        this.type = type;
        this.cmd = setter(new Callable() {
            public Object call() throws Exception {
                Reader r = extractor.extractText(stream, type, encoding);
                if (r != null) {
                    if (discarded) {
                        r.close();
View Full Code Here

TOP

Related Classes of EDU.oswego.cs.dl.util.concurrent.Callable

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.