Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.amazonaws.services.simpleworkflow.flow.core;
  
  import java.util.HashMap;
  import java.util.Map;
  
  public final class AsyncTaskInfo {
  
      private final StackTraceElement[] asyncStackTrace;
 
     private final boolean daemon;
 
     private final Promise<?>[] waitingFor;
 
     private final String name;
 
     public AsyncTaskInfo(String nameStackTraceElement[] asyncStackTraceboolean daemon, Promise<?>[] waitFor) {
         this. = name;
         this. = asyncStackTrace;
         this. = daemon;
         this. = waitFor;
     }
 
     public String getName() {
         return ;
     }
 
     public StackTraceElement[] getAsyncStackTrace() {
         return ;
     }
 
     public boolean isDaemon() {
         return ;
     }
 
     public Promise<?>[] getWaitingFor() {
         return ;
     }
 
     @Override
     public String toString() {
         StringBuilder result = new StringBuilder();
         if ( != null) {
             result.append("\"");
             result.append();
             result.append("\"");
         }
         if () {
             if (result.length() > 0) {
                 result.append(" ");
             }
             result.append("daemon");
         }
         if ( != null) {
             Map<IntegerStringwaitingOnArguments = new HashMap<IntegerString>();
             for (int i = 0; i < .i++) {
                 Promise<?> promise = [i];
                 if (promise != null && !promise.isReady()) {
                     if (promise instanceof AndPromise) {
                         AndPromise andPromise = (AndPromisepromise;
                         Promise<?>[] elements = andPromise.getValues();
                         StringBuilder description = new StringBuilder();
                         description.append("PromiseCollection[");
                         boolean first = true;
                         for (int j = 0; j < elements.lengthj++) {
                             Promise<?> e = elements[j];
                             if (e == null) {
                                 continue;
                             }
                             if (first) {
                                 first = false;
                             } else {
                                 description.append(" ");
                             }
                             description.append(j);
                             String d = e.getDescription();
                             if (d != null) {
                                 description.append(":\"");
                                 description.append(d);
                                 description.append("\"");
                             }
                         }
                         description.append("]");
                         waitingOnArguments.put(i + 1, description.toString());
                     }
                     else {
                         String quotedDescription = promise.getDescription() == null ? null : "\"" + promise.getDescription() + "\"";
                         waitingOnArguments.put(i + 1,  quotedDescription);
                     }
                 }
             }
             if (waitingOnArguments.size() > 0) {
                 if (result.length() > 0) {
                     result.append(" ");
                 }
                 result.append("waiting on argument");
                 if (waitingOnArguments.size() > 1) {
                     result.append("s");
                 }
                result.append(" (starting from 1)");
                for (Entry<IntegerStringpair : waitingOnArguments.entrySet()) {
                    result.append(" ");
                    result.append(pair.getKey());
                    String description = pair.getValue();
                    if (description != null) {
                        result.append(":");
                        result.append(description);
                    }
                }
            }
        }
        if (result.length() > 0) {
            result.append("\n");
        }
        if ( != null) {
            for (int i = 0; i < .i++) {
                result.append("\tat ");
                result.append([i]);
                result.append("\n");
            }
        }
        else {
            result.append("Async Trace is Disabled.");
        }
        return result.toString();
    }
New to GrepCode? Check out our FAQ X