Package java.util.concurrent

Examples of java.util.concurrent.Future


                     expected2, domRespMsg2.getNode().getFirstChild().getTextContent());
       
       
        //invokeAsync with AsyncHandler
        TestDOMSourceHandler tdsh = new TestDOMSourceHandler();
        Future fd = disp.invokeAsync(domReqMsg3, tdsh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        assertEquals("Response should be : Hello TestSOAPInputMessage3",
                     expected3, tdsh.getReplyBuffer());
View Full Code Here


        String expected2 = "Hello TestSOAPInputMessage2";
        checkSAXSource(expected2, saxSourceResp2);
       
       
        TestSAXSourceHandler tssh = new TestSAXSourceHandler();
        Future fd = disp.invokeAsync(saxSourceReq3, tssh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        SAXSource saxSourceResp3 = tssh.getSAXSource();
        assertNotNull(saxSourceResp3);
View Full Code Here

        String expected2 = "Hello TestSOAPInputMessage2";
        checkSAXSource(expected2, saxSourceResp2);
       
       
        TestSAXSourceHandler tssh = new TestSAXSourceHandler();
        Future fd = disp.invokeAsync(saxSourceReq3, tssh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        SAXSource saxSourceResp3 = tssh.getSAXSource();
        assertNotNull(saxSourceResp3);
View Full Code Here

        String expected2 = "Hello TestSOAPInputMessage2";
        checkStreamSource(expected2, streamSourceResp2);
       
       
        TestStreamSourceHandler tssh = new TestStreamSourceHandler();
        Future fd = disp.invokeAsync(streamSourceReq3, tssh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        StreamSource streamSourceResp3 = tssh.getStreamSource();
        assertNotNull(streamSourceResp3);
View Full Code Here

        String expected2 = "Hello TestSOAPInputMessage2";
        checkStreamSource(expected2, streamSourceResp2);
       
       
        TestStreamSourceHandler tssh = new TestStreamSourceHandler();
        Future fd = disp.invokeAsync(streamSourceReq3, tssh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String expected3 = "Hello TestSOAPInputMessage3";
        StreamSource streamSourceResp3 = tssh.getStreamSource();
        assertNotNull(streamSourceResp3);
View Full Code Here

        assertTrue("Expected string, " + expected , expected.equals(responseValue2));

       
       
        TestJAXBHandler tjbh = new TestJAXBHandler();
        Future fd = disp.invokeAsync(greetMe, tjbh);
        assertNotNull(fd);
        while (!fd.isDone()) {
            //wait
        }
        String responseValue3 = ((GreetMeResponse)tjbh.getResponse()).getResponseType();
        assertTrue("Expected string, " + expected , expected.equals(responseValue3));
View Full Code Here

    // start the application
    // in a separate thread and then check that the wrapper is up after a
    // max timeout
    // but return as soon as possible to the windows service controller
    final long maxStartTime = w.getMaxStartTime();
    final Future future = pool.submit(new Runnable()
    {
      public void run()
      {
        try
        {
          Thread.yield();
          wList.startAll();
        }
        catch (Throwable ex)
        {
          ex.printStackTrace();
          w.getWrapperLogger().info("Win Service: error starting wrapper " + ex.getMessage());
          Runtime.getRuntime().halt(999);
        }
      }
    });
    pool.execute(new Runnable()
    {
      public void run()
      {
        try
        {
          future.get(maxStartTime, TimeUnit.MILLISECONDS);
        }
        catch (Exception ex)
        {
          ex.printStackTrace();
          w.getWrapperLogger().info("Win Service: wrapper did not start within " + maxStartTime + " ms " + ex.getMessage());
View Full Code Here

   */
  public abstract Object execute(String line);

  public Object executeWithTimeout(final String line)
  {
    final Future future = pool.submit(new Callable<Object>()
    {
      public Object call()
      {
        return execute(line);
      }
    });

    try
    {
      return future.get(_timeout, TimeUnit.MILLISECONDS);
    }
    catch (Exception e)
    {
      System.out.println("script did not terminate within " + _timeout + " ms");
      future.cancel(true);
      return null;
    }
  }
View Full Code Here

    _isShutdown = true;
    _loader = null;
    _threadPool = null;

    while (true) {
      Future future = null;

      synchronized (_futureSet) {
        Iterator<Future> iter = _futureSet.iterator();

        if (iter.hasNext()) {
          future = iter.next();

          _futureSet.remove(future);
        }
        else
          break;
      }

      if (future != null)
        future.cancel(true);
    }
   
    _futureSet.clear();
  }
View Full Code Here

        public long initTransaction() throws RemoteException {
            return initTransaction(JodbNetConstants.DEFAULT_TRANSACTION_LOCK_WAIT_TIMEOUT);
        }

        public long initTransaction(int transactioLockTimeout) throws RemoteException {
            Future future = _localTransactionExecutor.submit(_lockTransuctionRunnable);
            try {
                future.get(transactioLockTimeout, TimeUnit.MILLISECONDS);
            } catch (Exception e) {
                throw new RemoteException("",e);
            }
            if(!_lockTransuctionRunnable._gotLock){
                throw new RemoteException("Unable to obtain transaction lock");
View Full Code Here

TOP

Related Classes of java.util.concurrent.Future

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.