org.springframework.shell.core.ExecutionStrategy Java Examples
The following examples show how to use
org.springframework.shell.core.ExecutionStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestableGfsh.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
@Override protected ExecutionStrategy getExecutionStrategy() { final ExecutionStrategy oldStrategy = super.getExecutionStrategy(); return new ExecutionStrategy() { public Object execute(ParseResult parseResult) throws RuntimeException { Object obj = null; String command = null; try { String method = parseResult.getMethod().getName(); String className = parseResult.getInstance().getClass().getCanonicalName(); command = className + "." + method; Util.log("Executing command " + command + " with Gfsh instance " + gfshThreadLocal.get()); long l1 = System.currentTimeMillis(); obj = oldStrategy.execute(parseResult); long l2 = System.currentTimeMillis(); Util.log("Completed execution of command " + command + " in " + (l2-l1) + " ms."); if(obj!=null){ Util.log("Command output class is " + obj.getClass()); }else{ obj = "VOID"; } } catch (Exception e) { addError("Error running command " , e); throw new RuntimeException(e); } Util.debug("Adding outuut and notifying threads .."); addOutput(command, obj); if(command.equals(EXIT_SHELL_COMMAND)) resultLatch.countDown(); return obj; } public boolean isReadyForCommands() { return oldStrategy.isReadyForCommands(); } public void terminate() { oldStrategy.terminate(); Util.log("GFSH is exiting now, thankyou for using"); } }; }
Example #2
Source File: CustomShellComponent.java From spring-data-dev-tools with Apache License 2.0 | 4 votes |
@Override protected ExecutionStrategy getExecutionStrategy() { return executionStrategy; }
Example #3
Source File: TestableGfsh.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
@Override protected ExecutionStrategy getExecutionStrategy() { final ExecutionStrategy oldStrategy = super.getExecutionStrategy(); return new ExecutionStrategy() { public Object execute(ParseResult parseResult) throws RuntimeException { Object obj = null; String command = null; try { String method = parseResult.getMethod().getName(); String className = parseResult.getInstance().getClass().getCanonicalName(); command = className + "." + method; Util.log("Executing command " + command + " with Gfsh instance " + gfshThreadLocal.get()); long l1 = System.currentTimeMillis(); obj = oldStrategy.execute(parseResult); long l2 = System.currentTimeMillis(); Util.log("Completed execution of command " + command + " in " + (l2-l1) + " ms."); if(obj!=null){ Util.log("Command output class is " + obj.getClass()); }else{ obj = "VOID"; } } catch (Exception e) { addError("Error running command " , e); throw new RuntimeException(e); } Util.debug("Adding outuut and notifying threads .."); addOutput(command, obj); if(command.equals(EXIT_SHELL_COMMAND)) resultLatch.countDown(); return obj; } public boolean isReadyForCommands() { return oldStrategy.isReadyForCommands(); } public void terminate() { oldStrategy.terminate(); Util.log("GFSH is exiting now, thankyou for using"); } }; }
Example #4
Source File: LensJLineShellComponent.java From zeppelin with Apache License 2.0 | 4 votes |
@Override protected ExecutionStrategy getExecutionStrategy() { return executionStrategy; }
Example #5
Source File: Gfsh.java From gemfirexd-oss with Apache License 2.0 | 2 votes |
/** * Returns the {@link ExecutionStrategy} implementation used by this * implementation of {@link AbstractShell}. {@link Gfsh} uses * {@link GfshExecutionStrategy}. * * @return ExecutionStrategy used by Gfsh */ @Override protected ExecutionStrategy getExecutionStrategy() { return executionStrategy; }
Example #6
Source File: Gfsh.java From gemfirexd-oss with Apache License 2.0 | 2 votes |
/** * Returns the {@link ExecutionStrategy} implementation used by this * implementation of {@link AbstractShell}. {@link Gfsh} uses * {@link GfshExecutionStrategy}. * * @return ExecutionStrategy used by Gfsh */ @Override protected ExecutionStrategy getExecutionStrategy() { return executionStrategy; }