@Ignore @Test public void testExecute() throws SubCommandException { CleanExpiredCQSubCommand cmd = new CleanExpiredCQSubCommand(); Options options = ServerUtil.buildCommandlineOptions(new Options()); String[] subargs = new String[] {"-b 127.0.0.1:10911", "-c default-cluster"}; final CommandLine commandLine = ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs, cmd.buildCommandlineOptions(options), new PosixParser()); cmd.execute(commandLine, options, null); }
@Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { boolean result = false; defaultMQAdminExt.start(); if (commandLine.hasOption('b')) { String addr = commandLine.getOptionValue('b').trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueueByAddr(addr); } else { String cluster = commandLine.getOptionValue('c'); if (null != cluster) cluster = cluster.trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueue(cluster); } System.out.printf(result ? "success" : "false"); } catch (Exception e) { throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e); } finally { defaultMQAdminExt.shutdown(); } }
CleanExpiredCQSubCommand implements SubCommand { @Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { boolean result = false; defaultMQAdminExt.start(); if (commandLine.hasOption('b')) { String addr = commandLine.getOptionValue('b').trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueueByAddr(addr); } else { String cluster = commandLine.getOptionValue('c'); if (null != cluster) cluster = cluster.trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueue(cluster); } System.out.printf(result ? "success" : "false"); } catch (Exception e) { throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e); } finally { defaultMQAdminExt.shutdown(); } } }
CleanExpiredCQSubCommand implements SubCommand { @Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { boolean result = false; defaultMQAdminExt.start(); if (commandLine.hasOption('b')) { String addr = commandLine.getOptionValue('b').trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueueByAddr(addr); } else { String cluster = commandLine.getOptionValue('c'); if (null != cluster) cluster = cluster.trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueue(cluster); } System.out.printf(result ? "success" : "false"); } catch (Exception e) { throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e); } finally { defaultMQAdminExt.shutdown(); } }  }
CleanExpiredCQSubCommand implements SubCommand { @Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { boolean result = false; defaultMQAdminExt.start(); if (commandLine.hasOption('b')) { String addr = commandLine.getOptionValue('b').trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueueByAddr(addr); } else { String cluster = commandLine.getOptionValue('c'); if (null != cluster) cluster = cluster.trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueue(cluster); } System.out.printf(result ? "success" : "false"); } catch (Exception e) { throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e); } finally { defaultMQAdminExt.shutdown(); } }  @Override String commandName(); @Override String commandDesc(); @Override Options buildCommandlineOptions(Options options); @Override void execute(CommandLine commandLine, Options options, RPCHook rpcHook); }
CleanExpiredCQSubCommand implements SubCommand { @Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { boolean result = false; defaultMQAdminExt.start(); if (commandLine.hasOption('b')) { String addr = commandLine.getOptionValue('b').trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueueByAddr(addr); } else { String cluster = commandLine.getOptionValue('c'); if (null != cluster) cluster = cluster.trim(); result = defaultMQAdminExt.cleanExpiredConsumerQueue(cluster); } System.out.printf(result ? "success" : "false"); } catch (Exception e) { throw new SubCommandException(this.getClass().getSimpleName() + " command failed", e); } finally { defaultMQAdminExt.shutdown(); } }  @Override String commandName(); @Override String commandDesc(); @Override Options buildCommandlineOptions(Options options); @Override void execute(CommandLine commandLine, Options options, RPCHook rpcHook);  }