{@link JavascriptExecutor#executeAsyncScript(String, Object...)}
548647
public static Object executeAsyncScript(String script, Object... args) {
        return driver().executeAsyncScript(script, args);
    }
534723
public int execute(String sql, Object... params) throws SQLException {
		Connection conn = null;
		try {
			conn = this.getConnection();
			return SqlExecutor.execute(conn, sql, params);
		} catch (SQLException e) {
			throw e;
		} finally {
			this.closeConnection(conn);
		}
	}
1064100
public void executeAsyncDelayed(final long delay) {
		final Executable nestedExec = this;
		helperExecutable = new Executable() {
			public Object execute() throws Throwable {
				return nestedExec.executeDelayed(delay);
			}
		};
		helperExecutable.executeAsync();
	}
698428
@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
		
		for (Iterator<?> iterator = selection.iterator(); iterator.hasNext(); ) {
			Object object = iterator.next();
			IProject project;
			
			if (object instanceof IProject) {
				project = (IProject) object;
			} else if (object instanceof IJavaProject) {
				project = ((IJavaProject) object).getProject();
			} else {
				continue;
			}
			
			final IProject proj = project;
			WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {

				@Override
				protected void execute(IProgressMonitor monitor)
						throws CoreException, InvocationTargetException,
						InterruptedException {
					// Enabling Gig nature.
					monitor.beginTask("Enabling Gig", 3);
					monitor.subTask("Enabling Gig nature");
					IProjectDescription description = proj.getDescription();
					String[] natures = description.getNatureIds();
					String[] newNatures = new String[natures.length + 1];
					System.arraycopy(natures, 0, newNatures, 0, natures.length);
					newNatures[natures.length] = GigNature.NATURE_ID;
					description.setNatureIds(newNatures);
					proj.setDescription(description, null);
					monitor.worked(1);
					
					// Adding Gig libraries to the classpath.
					monitor.subTask("Adding Gig libraries to the classpath");
					IJavaProject javaProject = JavaCore.create(proj);
					IClasspathEntry[] classpath = javaProject.getRawClasspath();
					IPath path = new Path("org.eiichiro.gig.eclipse.core.GIG_CONTAINER");
					boolean found = false;
					
					for (IClasspathEntry entry : classpath) {
						if (entry.getPath().equals(path)) {
							found = true;
							break;
						}
					}
					
					if (!found) {
						IClasspathEntry container = JavaCore.newContainerEntry(path, false);
						IClasspathEntry[] entries = new IClasspathEntry[classpath.length + 1];
						System.arraycopy(classpath, 0, entries, 0, classpath.length);
						entries[classpath.length] = container;
						javaProject.setRawClasspath(entries, monitor);
					}
					
					// Creating Gig-generated source directory.
					monitor.subTask("Creating Gig-generated source directory");
					IFolder folder = proj.getFolder(".gig_generated");
					
					if (!folder.exists()) {
						folder.create(true, true, monitor);
						IClasspathEntry[] c = javaProject.getRawClasspath();
						IClasspathEntry[] entries = new IClasspathEntry[c.length + 1];
						System.arraycopy(c, 0, entries, 0, c.length);
						IClasspathEntry source = JavaCore.newSourceEntry(folder.getFullPath());
						entries[c.length] = source;
						javaProject.setRawClasspath(entries, monitor);
					}
					
					monitor.worked(1);
					monitor.done();
				}
				
			};
			IProgressService service = PlatformUI.getWorkbench().getProgressService();
			
			try {
				service.run(true, true, operation);
			} catch (InvocationTargetException e) {
				IStatus status = new Status(IStatus.ERROR,
						GigUIPlugin.PLUGIN_ID, e.getTargetException().getMessage(), e.getTargetException());
				GigUIPlugin.getDefault().getLog().log(status);
				ErrorDialog.openError(HandlerUtil.getActiveShell(event),
						"Gig", "Failed to enable Gig in "
								+ project.getName() + " project", status);
			} catch (InterruptedException e) {}
		}
		
		return null;
	}
421692
public static <T> T executeGroovyShellScript(final String script,
                                                 final Map<String, Object> variables,
                                                 final Class<T> clazz) {
        try {
            val binding = new Binding();
            val shell = new GroovyShell(binding);
            if (variables != null && !variables.isEmpty()) {
                variables.forEach(binding::setVariable);
            }
            if (!binding.hasVariable("logger")) {
                binding.setVariable("logger", LOGGER);
            }
            LOGGER.debug("Executing groovy script [{}] with variables [{}]", script, binding.getVariables());

            val result = shell.evaluate(script);
            return getGroovyScriptExecutionResultOrThrow(clazz, result);
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }
54146
@Override
    public CompletableFuture<ExecutionInfo> executeAsyncWithStats() {

        final StatementWrapper statementWrapper = new NativeStatementWrapper(getOperationType(boundStatement), meta, boundStatement, encodedBoundValues);
        final String queryString = statementWrapper.getBoundStatement().preparedStatement().getQueryString();

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace(format("Execute native query async with execution info : %s", queryString));
        }

        CompletableFuture<ResultSet> cfutureRS = rte.execute(statementWrapper);

        return cfutureRS
                .thenApply(options::resultSetAsyncListener)
                .thenApply(x -> statementWrapper.logReturnResults(x, options.computeMaxDisplayedResults(rte.configContext)))
                .thenApply(statementWrapper::logTrace)
                .thenApply(x -> LWTHelper.triggerLWTListeners(lwtResultListeners, x, queryString))
                .thenApply(x -> x.getExecutionInfo());
    }
174148
public ExecutionResult execute(ExecutionInput executionInput) {
        try {
            return executeAsync(executionInput).join();
        } catch (CompletionException e) {
            if (e.getCause() instanceof RuntimeException) {
                throw (RuntimeException) e.getCause();
            } else {
                throw e;
            }
        }
    }
30996
public PythonExecutionResult exec(String script, Map<String, Serializable> callArguments) {
        checkValidInterpreter();
        initInterpreter();
        prepareInterpreterContext(callArguments);

        Exception originException = null;
        for(int i = 0; i < RETRIES_NUMBER_ON_THREADED_ISSUE; i++) {
            try {
                return exec(script);
            } catch (Exception e) {
                if(!isThreadsRelatedModuleIssue(e)) {
                    throw new RuntimeException("Error executing python script: " + e, e);
                }
                if(originException == null) {
                    originException = e;
                }
            }
        }
        throw new RuntimeException("Error executing python script: " + originException, originException);
    }
490884
private Object eval(Bindings bindings, String expression) {
    try {
      return jsScriptEngine.eval(bindings, expression);
    } catch (javax.script.ScriptException t) {
      return new ScriptException(t.getCause().getMessage(), t.getCause());
    } catch (Exception t) {
      return new ScriptException(t);
    }
  }
1011664
@SneakyThrows
    public static <T> T executeGroovyScript(final GroovyObject groovyObject,
                                            final String methodName,
                                            final Object[] args,
                                            final Class<T> clazz,
                                            final boolean failOnError) {
        try {
            LOGGER.trace("Executing groovy script's [{}] method, with parameters [{}]", methodName, args);
            val result = groovyObject.invokeMethod(methodName, args);
            LOGGER.trace("Results returned by the groovy script are [{}]", result);

            if (!clazz.equals(Void.class)) {
                return getGroovyScriptExecutionResultOrThrow(clazz, result);
            }
        } catch (final Exception e) {
            var cause = (Throwable) null;
            if (e instanceof InvokerInvocationException) {
                cause = e.getCause();
            } else {
                cause = e;
            }
            if (failOnError) {
                throw cause;
            }
            LOGGER.error(cause.getMessage(), cause);
        }
        return null;
    }
91185
public static void run(StreamFunctionExecutor functionExecutor, String... args) {
        parseData(args, (data, isDebug) -> {
            try (InputStream input = data != null ? new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)) : System.in) {
                functionExecutor.execute(input, System.out);
            } catch (Exception e) {
                exitWithError(isDebug, e);
            }
        });
    }
21205
protected void executeScript(URL scriptUrl) {
        log.debug("Executing script '{}'", scriptUrl);
        try (Connection conn = dataSource.getConnection()) {
            try (Statement stat = conn.createStatement()) {
                try (BufferedReader reader = new BufferedReader(new InputStreamReader(scriptUrl.openStream(), StandardCharsets.UTF_8))) {
                    reader.lines()
                            .filter(line -> !Strings.isNullOrEmpty(line) && line.charAt(0) != '#' && !line.startsWith("//"))
                            .forEach(line -> {
                                try {
                                    log.trace("execute: {}", line);
                                    stat.execute(line.trim());
                                } catch (SQLException e) {
                                    log.error("Failed to execute '{}'", line, e);
                                }
                            });
                }
            }
        } catch (SQLException | IOException e) {
            log.error("Failed to execute script '{}'", scriptUrl, e);
        }
    }
313187
@Override
	public void eval(String javascript) throws WidgetException {
		WebElement element = findElement(false);
		WebDriver wd = getGUIDriver().getWrappedDriver();
		try {
			((JavascriptExecutor) wd).executeScript(javascript, element);
		} catch (Exception e) {
			long time = System.currentTimeMillis() + 2000;
			boolean success = false;
			while (!success && System.currentTimeMillis() < time) {
				try {
					((JavascriptExecutor) wd).executeScript(javascript, element);
					success = true;
				} catch (Exception e2) {
					try {
						Thread.sleep(500);
					} catch (InterruptedException e1) {
						// Ignore
					}
					e = e2;
				}
			}

			if (!success) {
				throw new RuntimeException(e);
			}
		}
	}
310877
static AsyncResponse executeAsync(final @Nonnull String processName,
									  final @Nonnull Runnable operation) {
		return executeAsync(newSingleThreadExecutor(), processName, operation, true);
	}
469035
@NotNull
    public ResultSetFuture executeAsync(@NotNull String keyspace, @NotNull Statement statement) {
        Timer time = getMetricsFactory().getTimer(MetricsType.CASSANDRA_EXECUTE_ASYNC.name());

        getMetricsFactory().getCounter(MetricsType.CASSANDRA_PROCESSING_QUERIES.name()).inc();

        ResultSetFuture resultSetFuture = getOrCreateSession(keyspace).executeAsync(statement);

        String query = (statement instanceof BoundStatement) ? ((BoundStatement) statement).preparedStatement().getQueryString() : statement.toString();

        Futures.addCallback(resultSetFuture, new StatementExecutionCallback(keyspace, query));
        monitorFuture(time, resultSetFuture);

        return resultSetFuture;
    }
1139340
public static void executeDatabaseScript(String script) throws SQLException, MalformedURLException {
        File file = new File(script);
        DatabaseUtils.executeSqlScript(DatabaseUtils.getDBConnection(null), file.toURI().toURL());
    }
711910
@Beta
  public Future<HttpResponse> executeAsync(Executor executor) {
    FutureTask<HttpResponse> future =
        new FutureTask<HttpResponse>(
            new Callable<HttpResponse>() {

              public HttpResponse call() throws Exception {
                return execute();
              }
            });
    executor.execute(future);
    return future;
  }