@Override
public void unregister(Object service) {
synchronized (services) {
super.unregister(service);
if (service instanceof Command) {
Command command = (Command) service;
String scope = command.getScope();
String name = command.getName();
commandProcessor.removeCommand(scope, name);
if (!Session.SCOPE_GLOBAL.equals(scope)) {
if (subshells.get(scope).decrement() == 0) {
SubShellCommand subShell = subshells.remove(scope);
unregister(subShell);