Package com.dragome.commons

Examples of com.dragome.commons.ExecutionHandler


public class RequestExecutorImpl implements RequestExecutor
{
  public String executeSynchronousRequest(String url, Map<String, String> parameters)
  {
    final ExecutionHandler executionHandler= ServiceLocator.getInstance().getConfigurator().getExecutionHandler();
    if (executionHandler.canSuspend())
    {
      final String[] resultArray= new String[] { "" };

      AsyncCallback<String> asyncCallbackToContinue= new AsyncCallback<String>()
      {
        public void onSuccess(String result)
        {
          resultArray[0]= result;
          executionHandler.continueExecution();
        }

        public void onError()
        {
          throw new RuntimeException("Error in async call");
        }
      };
      AsyncCallback<String> wrappedCallback= wrapCallback(Serializable.class, asyncCallbackToContinue);
      executeHttpRequest(true, url, parameters, wrappedCallback, false);

      executionHandler.suspendExecution();
      return resultArray[0];
    }
    else
      return executeHttpRequest(false, url, parameters, null, false);
View Full Code Here


public class RequestExecutorImpl implements RequestExecutor
{
  public String executeSynchronousRequest(String url, Map<String, String> parameters)
  {
    final ExecutionHandler executionHandler= ServiceLocator.getInstance().getConfigurator().getExecutionHandler();
    if (executionHandler.canSuspend())
    {
      final String[] resultArray= new String[] { "" };

      AsyncCallback<String> asyncCallbackToContinue= new AsyncCallback<String>()
      {
        public void onSuccess(String result)
        {
          resultArray[0]= result;
          executionHandler.continueExecution();
        }

        public void onError()
        {
          throw new RuntimeException("Error in async call");
        }
      };
      AsyncCallback<String> wrappedCallback= wrapCallback(Serializable.class, asyncCallbackToContinue);
      executeHttpRequest(true, url, parameters, wrappedCallback, false);

      executionHandler.suspendExecution();
      return resultArray[0];
    }
    else
      return executeHttpRequest(false, url, parameters, null, false);
View Full Code Here

    return new ContinuationBytecodeTransformer(includedPaths, enabled);
  }

  public ExecutionHandler getExecutionHandler()
  {
    return new ExecutionHandler()
    {
      public void suspendExecution()
      {
        Continuation.suspend();
      }
View Full Code Here

TOP

Related Classes of com.dragome.commons.ExecutionHandler

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.