Deprecated, use `execute(parameters, body, output)` or inherit from Task instead.

@param parameters the query string parameters
@param output     a {@link PrintWriter} wrapping the output stream of the task
@throws Exception
429851
@Override
    @Deprecated
    public void execute(Map<String, List<String>> parameters, PrintWriter output) throws Exception {
        throw new UnsupportedOperationException("Use `execute(parameters, body, output)`");
    }
903785
private void executeBatch(Results results, final List<String> queries)
      throws SQLException {

    if (!options.useBatchMultiSend) {

      String sql = null;
      SQLException exception = null;

      for (int i = 0; i < queries.size() && !isInterrupted(); i++) {

        try {

          sql = queries.get(i);
          writer.startPacket(0);
          writer.write(COM_QUERY);
          writer.write(sql);
          writer.flush();
          getResult(results);

        } catch (SQLException sqlException) {
          if (exception == null) {
            exception = logQuery.exceptionWithQuery(sql, sqlException, explicitClosed);
            if (!options.continueBatchOnError) {
              throw exception;
            }
          }
        } catch (IOException e) {
          if (exception == null) {
            exception = handleIoException(e);
            if (!options.continueBatchOnError) {
              throw exception;
            }
          }
        }
      }
      stopIfInterrupted();

      if (exception != null) {
        throw exception;
      }
      return;
    }
    initializeBatchReader();
    new AbstractMultiSend(this, writer, results, queries) {

      @Override
      public void sendCmd(PacketOutputStream pos, Results results,
          List<ParameterHolder[]> parametersList, List<String> queries, int paramCount,
          BulkStatus status,
          PrepareResult prepareResult)
          throws IOException {

        String sql = queries.get(status.sendCmdCounter);
        pos.startPacket(0);
        pos.write(COM_QUERY);
        pos.write(sql);
        pos.flush();
      }

      @Override
      public SQLException handleResultException(SQLException qex, Results results,
          List<ParameterHolder[]> parametersList, List<String> queries, int currentCounter,
          int sendCmdCounter, int paramCount, PrepareResult prepareResult) {

        String sql = queries.get(currentCounter + sendCmdCounter);
        return logQuery.exceptionWithQuery(sql, qex, explicitClosed);

      }

      @Override
      public int getParamCount() {
        return -1;
      }

      @Override
      public int getTotalExecutionNumber() {
        return queries.size();
      }

    }.executeBatch();

  }
361468
@Override
    public QueryResult<P> execute(StatementOptions options, Object... params) {
        return multi(options).add(params).execute();
    }
479548
public static void writeResults(final String name, final Object output) {
		Writer writer = null;

		try {
			writer = new BufferedWriter(
					new OutputStreamWriter(
					new FileOutputStream(name + ".json"), "utf-8"));

			writer.write(output.toString());
		} catch (IOException ignored) {
		} finally {
			try {writer.close();}
            catch (Exception ignored) {}
		}
	}
849510
public Object execute(Object[] arguments) throws Exception
	{
		try
		{
			if (this.method == null)
			{
				if (this.parameterTypes == null)
					this.parameterTypes = PROXY.toParameterTypes(arguments);

				this.method = PROXY.findMethod(this.targetClass,
						this.methodName, this.parameterTypes);
			}

			return this.method.invoke(target, arguments);
		}
		catch (IllegalArgumentException e)
		{
			throw new IllegalArgumentException(target.getClass().getName()+"."+this.method+"("+Debugger.toString(e)+")");
		}
		catch (NoSuchMethodException e)
		{
			throw e;
		}
		catch (IllegalAccessException e)
		{
			throw e;
		}
		catch (InvocationTargetException e)
		{
			if (e.getCause() instanceof Exception)
				throw (Exception) e.getCause();
			else
				throw e;
		}

	}
647277
public static void executeHelp(String[] args, PrintStream stream) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        if(subCmd.equals("orphaned-data")) {
            SubCommandCleanupOrphanedData.printHelp(stream);
        } else if(subCmd.equals("vector-clocks")) {
            SubCommandCleanupVectorClocks.printHelp(stream);
        } else if(subCmd.equals("slops")) {
            SubCommandCleanupSlops.printHelp(stream);
        } else {
            printHelp(stream);
        }
    }
1132732
public static void tputs(Writer out, String str, Object... params) throws IOException {
        int index = 0;
        int length = str.length();
        int ifte = IFTE_NONE;
        boolean exec = true;
        Stack<Object> stack = new Stack<Object>();
        while (index < length) {
            char ch = str.charAt(index++);
            switch (ch) {
                case '\\':
                    ch = str.charAt(index++);
                    if (ch >= '0' && ch <= '9') {
                        throw new UnsupportedOperationException(); // todo
                    } else {
                        switch (ch) {
                            case 'e':
                            case 'E':
                                if (exec) {
                                    out.write(27); // escape
                                }
                                break;
                            case 'n':
                                out.write('\n');
                                break;
//                        case 'l':
//                            rawPrint('\l');
//                            break;
                            case 'r':
                                if (exec) {
                                    out.write('\r');
                                }
                                break;
                            case 't':
                                if (exec) {
                                    out.write('\t');
                                }
                                break;
                            case 'b':
                                if (exec) {
                                    out.write('\b');
                                }
                                break;
                            case 'f':
                                if (exec) {
                                    out.write('\f');
                                }
                                break;
                            case 's':
                                if (exec) {
                                    out.write(' ');
                                }
                                break;
                            case ':':
                            case '^':
                            case '\\':
                                if (exec) {
                                    out.write(ch);
                                }
                                break;
                            default:
                                throw new IllegalArgumentException();
                        }
                    }
                    break;
                case '^':
                    ch = str.charAt(index++);
                    if (exec) {
                        out.write(ch - '@');
                    }
                    break;
                case '%':
                    ch = str.charAt(index++);
                    switch (ch) {
                        case '%':
                            if (exec) {
                                out.write('%');
                            }
                            break;
                        case 'p':
                            ch = str.charAt(index++);
                            if (exec) {
                                stack.push(params[ch - '1']);
                            }
                            break;
                        case 'P':
                            ch = str.charAt(index++);
                            if (ch >= 'a' && ch <= 'z') {
                                if (exec) {
                                    dv[ch - 'a'] = stack.pop();
                                }
                            } else if (ch >= 'A' && ch <= 'Z') {
                                if (exec) {
                                    sv[ch - 'A'] = stack.pop();
                                }
                            } else {
                                throw new IllegalArgumentException();
                            }
                            break;
                        case 'g':
                            ch = str.charAt(index++);
                            if (ch >= 'a' && ch <= 'z') {
                                if (exec) {
                                    stack.push(dv[ch - 'a']);
                                }
                            } else if (ch >= 'A' && ch <= 'Z') {
                                if (exec) {
                                    stack.push(sv[ch - 'A']);
                                }
                            } else {
                                throw new IllegalArgumentException();
                            }
                            break;
                        case '\'':
                            ch = str.charAt(index++);
                            if (exec) {
                                stack.push((int) ch);
                            }
                            ch = str.charAt(index++);
                            if (ch != '\'') {
                                throw new IllegalArgumentException();
                            }
                            break;
                        case '{':
                            int start = index;
                            while (str.charAt(index++) != '}');
                            if (exec) {
                                int v = Integer.valueOf(str.substring(start, index - 1));
                                stack.push(v);
                            }
                            break;
                        case 'l':
                            if (exec) {
                                stack.push(stack.pop().toString().length());
                            }
                            break;
                        case '+':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 + v2);
                            }
                            break;
                        case '-':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 - v2);
                            }
                            break;
                        case '*':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 * v2);
                            }
                            break;
                        case '/':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 / v2);
                            }
                            break;
                        case 'm':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 % v2);
                            }
                            break;
                        case '&':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 & v2);
                            }
                            break;
                        case '|':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 | v2);
                            }
                            break;
                        case '^':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 ^ v2);
                            }
                            break;
                        case '=':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 == v2);
                            }
                            break;
                        case '>':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 > v2);
                            }
                            break;
                        case '<':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 < v2);
                            }
                            break;
                        case 'A':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 != 0 && v2 != 0);
                            }
                            break;
                        case '!':
                            if (exec) {
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 == 0);
                            }
                            break;
                        case '~':
                            if (exec) {
                                int v1 = toInteger(stack.pop());
                                stack.push(~v1);
                            }
                            break;
                        case 'O':
                            if (exec) {
                                int v2 = toInteger(stack.pop());
                                int v1 = toInteger(stack.pop());
                                stack.push(v1 != 0 || v2 != 0);
                            }
                            break;
                        case '?':
                            if (ifte != IFTE_NONE) {
                                throw new IllegalArgumentException();
                            } else {
                                ifte = IFTE_IF;
                            }
                            break;
                        case 't':
                            if (ifte != IFTE_IF && ifte != IFTE_ELSE) {
                                throw new IllegalArgumentException();
                            } else {
                                ifte = IFTE_THEN;
                            }
                            exec = toInteger(stack.pop()) != 0;
                            break;
                        case 'e':
                            if (ifte != IFTE_THEN) {
                                throw new IllegalArgumentException();
                            } else {
                                ifte = IFTE_ELSE;
                            }
                            exec = !exec;
                            break;
                        case ';':
                            if (ifte == IFTE_NONE || ifte == IFTE_IF) {
                                throw new IllegalArgumentException();
                            } else {
                                ifte = IFTE_NONE;
                            }
                            exec = true;
                            break;
                        case 'i':
                            if (params.length >= 1) {
                                params[0] = toInteger(params[0]) + 1;
                            }
                            if (params.length >= 2) {
                                params[1] = toInteger(params[1]) + 1;
                            }
                            break;
                        case 'd':
                            out.write(Integer.toString(toInteger(stack.pop())));
                            break;
                        default:
                            throw new UnsupportedOperationException();
                    }
                    break;
                case '$':
                    if (str.charAt(index) == '<') {
                        // We don't honour delays, just skip
                        while (str.charAt(index++) != '>');
                    } else {
                        if (exec) {
                            out.write(ch);
                        }
                    }
                    break;
                default:
                    if (exec) {
                        out.write(ch);
                    }
                    break;
            }
        }
    }
1087774
private void execute() throws Exception {
		if (result == null) {
			env.execute(executionName);
		} else {
			output.write(executionName.toString(), System.out, result);
		}

		System.out.println();
		algorithm.printAnalytics(System.out);

		if (jobDetailsPath.getValue() != null) {
			writeJobDetails(env, jobDetailsPath.getValue());
		}
	}
1042882
public static String doPut(String host, String path,
                               Map<String, String> headers,
                               Map<String, String> queries) throws Exception {
        return doPut(host, path, headers, queries, "");
    }
48232
public static void main(String[] args) throws Exception {

		// Checking input parameters
		final ParameterTool params = ParameterTool.fromArgs(args);
		System.out.println("Usage: TwitterExample [--output <path>] " +
				"[--twitter-source.consumerKey <key> --twitter-source.consumerSecret <secret> --twitter-source.token <token> --twitter-source.tokenSecret <tokenSecret>]");

		// set up the execution environment
		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

		// make parameters available in the web interface
		env.getConfig().setGlobalJobParameters(params);

		env.setParallelism(params.getInt("parallelism", 1));

		// get input data
		DataStream<String> streamSource;
		if (params.has(TwitterSource.CONSUMER_KEY) &&
				params.has(TwitterSource.CONSUMER_SECRET) &&
				params.has(TwitterSource.TOKEN) &&
				params.has(TwitterSource.TOKEN_SECRET)
				) {
			streamSource = env.addSource(new TwitterSource(params.getProperties()));
		} else {
			System.out.println("Executing TwitterStream example with default props.");
			System.out.println("Use --twitter-source.consumerKey <key> --twitter-source.consumerSecret <secret> " +
					"--twitter-source.token <token> --twitter-source.tokenSecret <tokenSecret> specify the authentication info.");
			// get default test text data
			streamSource = env.fromElements(TwitterExampleData.TEXTS);
		}

		DataStream<Tuple2<String, Integer>> tweets = streamSource
				// selecting English tweets and splitting to (word, 1)
				.flatMap(new SelectEnglishAndTokenizeFlatMap())
				// group by words and sum their occurrences
				.keyBy(0).sum(1);

		// emit result
		if (params.has("output")) {
			tweets.writeAsText(params.get("output"));
		} else {
			System.out.println("Printing result to stdout. Use --output to specify output path.");
			tweets.print();
		}

		// execute program
		env.execute("Twitter Streaming Example");
	}
1170925
public void output(String output)
        throws XMLStreamException
    {
        if (mIsFlattening > 0) {
            try {
                mWriter.write(output);
            } catch (IOException ioe) {
                throw new WstxIOException(ioe);
            }
        }
    }
10040
@Override
    public final void execute() throws TaskExecutionFailedException {
        long startTime = System.currentTimeMillis();

        try {
            executeImpl();
            log.info(createMessage("success", System.currentTimeMillis() - startTime));
        } catch (TaskExecutionFailedException ex) {
            log.error(createMessage("failure", System.currentTimeMillis() - startTime));
            throw ex;
        }
    }
1234305
@SuppressWarnings("PMD.UnusedFormalParameter")
	private void executeProgram(String name, String source) throws Exception
	{
		List<Statement> _directives = executeProgram__compile(source);
		boolean _canProceed = !isAllowedOverrideRequired() || isAllowingOverride();
		if (_canProceed && !_directives.isEmpty())
		{
			executeProgram__parseDirectives(_directives);
			setAllowedOverrideRequired(true);
		}
	}
349554
@Override
    public void write(String output) throws MapReduceException {
        try {
            writer.write(output + DataUtilDefaults.lineTerminator);
        } catch (IOException e) {
            throw new MapReduceException("Failed to write to the output collector", e);
        }
    }
354228
public final Processor.ExecutionContext print(
            final String jobId, final PJsonObject specJson, final OutputStream out)
            throws Exception {
        final OutputFormat format = getOutputFormat(specJson);
        final File taskDirectory = this.workingDirectories.getTaskDirectory();

        try {
            return format.print(jobId, specJson, getConfiguration(), this.configFile.getParentFile(),
                                taskDirectory, out);
        } finally {
            this.workingDirectories.removeDirectory(taskDirectory);
        }
    }
219966
public void processInputData(PrintWriter out)
        throws DBException
    {
        String strMoveValue = this.getProperty(DBParams.COMMAND);      // Display record
        if (strMoveValue == null)
            strMoveValue = Constants.BLANK;

        String strError = this.getTask().getLastError(0);
        if ((strError != null) && (strError.length() > 0))
            strError = strError + " on " + strMoveValue;
        if ((strError != null) && (strError.length() > 0))
        {
            out.println(Utility.startTag(XMLTags.STATUS_TEXT));
            out.println(Utility.startTag(XMLTags.TEXT) + "Error: " + strError + Utility.endTag(XMLTags.TEXT));
            out.println(Utility.startTag(XMLTags.ERROR) + "error" + Utility.endTag(XMLTags.ERROR));
            Record record = ((BasePanel)this.getScreenField()).getMainRecord();
            if (record != null)
                record.setEditMode(Constants.EDIT_NONE);    // Make sure this isn't updated on screen free
            out.println(Utility.endTag(XMLTags.STATUS_TEXT));
        }
        else
        {
            String strMessage = this.getTask().getStatusText(DBConstants.INFORMATION_MESSAGE);
            if (strMessage != null)
                if (strMoveValue.length() > 0)
                    if ((strMessage.length() > 0) && (!(this.getScreenField() instanceof BaseGridScreen))) // TODO localize
                    {
                        out.println(Utility.startTag(XMLTags.STATUS_TEXT));
                        out.println(Utility.startTag(XMLTags.TEXT) + strMessage + Utility.endTag(XMLTags.TEXT));
                        out.println(Utility.startTag(XMLTags.ERROR) + "information" + Utility.endTag(XMLTags.ERROR));
                        out.println(Utility.endTag(XMLTags.STATUS_TEXT));
                    }
        }
    }
1047928
public int execute(String sql, Object... params) {
        Connection conn = getConn();
        try {
            return conn.createQuery(sql)
                    .withParams(params)
                    .executeUpdate()
                    .getResult();
        } finally {
            this.closeConn(conn);
            this.clean(conn);
        }
    }