@Override public Command getCommand(String scope, String name) { if (parent != null) { Command command = parent.getCommand(scope, name); if (command != null) { return command; } } synchronized (services) { List<Command> cmds = commands.get(scope + ":" + name); if (cmds != null && !cmds.isEmpty()) { return cmds.get(0); } } return null; }
@Override public Command getCommand(String scope, String name) { if (parent != null) { Command command = parent.getCommand(scope, name); if (command != null) { return command; } } synchronized (services) { List<Command> cmds = commands.get(scope + ":" + name); if (cmds != null && !cmds.isEmpty()) { return cmds.get(0); } } return null; }
@Override public Command getCommand(String scope, String name) { if (parent != null) { Command command = parent.getCommand(scope, name); if (command != null) { return command; } } synchronized (services) { List<Command> cmds = commands.get(scope + ":" + name); if (cmds != null && !cmds.isEmpty()) { return cmds.get(0); } } return null; }
@Override public Command getCommand(String scope, String name) { if (parent != null) { Command command = parent.getCommand(scope, name); if (command != null) { return command; } } synchronized (services) { List<Command> cmds = commands.get(scope + ":" + name); if (cmds != null && !cmds.isEmpty()) { return cmds.get(0); } } return null; }
private void waitForCommandService(String command) { // the commands are represented by services. Due to the asynchronous nature of services they may not be // immediately available. This code waits the services to be available, in their secured form. It // means that the code waits for the command service to appear with the roles defined. if (command == null || command.length() == 0) { return; } int spaceIdx = command.indexOf(' '); if (spaceIdx > 0) { command = command.substring(0, spaceIdx); } int colonIndx = command.indexOf(':'); String scope = (colonIndx > 0) ? command.substring(0, colonIndx) : "*"; String name = (colonIndx > 0) ? command.substring(colonIndx + 1) : command; try { long start = System.currentTimeMillis(); long cur = start; while (cur - start < SERVICE_TIMEOUT) { if (sessionFactory.getRegistry().getCommand(scope, name) != null) { return; } Thread.sleep(100); cur = System.currentTimeMillis(); } } catch (Exception e) { throw new RuntimeException(e); } }
String cmdName = session.resolveCommand(statement.tokens().get(0).toString()); String[] parts = cmdName.split(":"); Command cmd = parts.length == 2 ? session.getRegistry().getCommand(parts[0], parts[1]) : null; Parser cmdParser = cmd != null ? cmd.getParser() : null; if (cmdParser != null) {
String cmdName = session.resolveCommand(statement.tokens().get(0).toString()); String[] parts = cmdName.split(":"); Command cmd = parts.length == 2 ? session.getRegistry().getCommand(parts[0], parts[1]) : null; Parser cmdParser = cmd != null ? cmd.getParser() : null; if (cmdParser != null) {