/** * Lets caller to know if the caller is in an instance */ public boolean isThisInstance() { return serverEnv.isInstance(); }
/** * Lets caller to know if the caller is in an instance */ public boolean isThisInstance() { return serverEnv.isInstance(); }
private boolean isCurrentInstanceMatchingTarget(PropertyChangeEvent event) { // DAS receive all the events, so we need to figure out // whether we should take action on DAS depending on the event. if(serverEnv.isInstance()) { return true; } ConfigBeanProxy proxy = (ConfigBeanProxy)(event.getSource()); while(proxy != null && !(proxy instanceof Config)) { proxy = proxy.getParent(); } if (proxy != null) { Config config = (Config)proxy; return config.isDas(); } return false; }
public Collection<SupplementalCommand> listSuplementalCommands(String commandName) { List<ServiceHandle<?>> supplementalList = getSupplementalCommandsList().get(commandName); if (supplementalList == null) { return Collections.emptyList(); } Collection<SupplementalCommand> result = new ArrayList<SupplementalCommand>(supplementalList.size()); for (ServiceHandle<?> handle : supplementalList) { AdminCommand cmdObject = (AdminCommand) handle.getService(); SupplementalCommand aCmd = new SupplementalCommandImpl(cmdObject); if( (serverEnv.isDas() && aCmd.whereToRun().contains(RuntimeType.DAS)) || (serverEnv.isInstance() && aCmd.whereToRun().contains(RuntimeType.INSTANCE)) ) { result.add(aCmd); } } return result; }
public void execute(AdminCommandContext context) { if (!env.isInstance()) { String msg = Strings.get("stop.instance.notInstance", env.getRuntimeType().toString()); context.getLogger().warning(msg); return; } doExecute(habitat, env, force); } }
public void execute(AdminCommandContext context) { if (!env.isInstance()) { String msg = Strings.get("stop.instance.notInstance", env.getRuntimeType().toString()); context.getLogger().warning(msg); return; } doExecute(habitat, env, context.getLogger(), force); } }
/** * Process the instance file if this is DAS and there are instances configured already in this domain */ @Override public void postConstruct() { // If this is not the DAS, no need for this pool if(serverEnv.isInstance()) { return; } int poolSize = 5; Config svrConfig = domain.getConfigNamed("server-config"); // I am doing this code instead of a simple svrConfig.getAdminListener() here because embedded tests are failing // during build; got to check the reason why later. if(svrConfig != null) { NetworkConfig nwc = svrConfig.getNetworkConfig(); if (nwc != null) { List<NetworkListener> lss = nwc.getNetworkListeners().getNetworkListener(); if ( (lss != null) && (!lss.isEmpty()) ) { for (NetworkListener ls : lss) { if (ServerTags.ADMIN_LISTENER_ID.equals(ls.getName())) { if(ls.findThreadPool() != null) { poolSize = Integer.parseInt(ls.findThreadPool().getMaxThreadPoolSize()); } } } } } } svc = Executors.newFixedThreadPool(poolSize, new InstanceStateThreadFactory()); }
/** * Process the instance file if this is DAS and there are instances configured already in this domain */ @Override public void postConstruct() { // If this is not the DAS, no need for this pool if(serverEnv.isInstance()) { return; } int poolSize = 5; Config svrConfig = domain.getConfigNamed("server-config"); // I am doing this code instead of a simple svrConfig.getAdminListener() here because embedded tests are failing // during build; got to check the reason why later. if(svrConfig != null) { NetworkConfig nwc = svrConfig.getNetworkConfig(); if (nwc != null) { List<NetworkListener> lss = nwc.getNetworkListeners().getNetworkListener(); if ( (lss != null) && (!lss.isEmpty()) ) { for (NetworkListener ls : lss) { if (ServerTags.ADMIN_LISTENER_ID.equals(ls.getName())) { if(ls.findThreadPool() != null) { poolSize = Integer.valueOf(ls.findThreadPool().getMaxThreadPoolSize()); } } } } } } svc = Executors.newFixedThreadPool(poolSize, new InstanceStateThreadFactory()); }
@Override public void execute(AdminCommandContext context) { if (!env.isInstance()) { String msg = Strings.get("restart.instance.notInstance", env.getRuntimeType().toString()); context.getLogger().warning(msg); return; } setRegistry(registry); setServerName(env.getInstanceName()); if (debug != null) setDebug(debug); doExecute(context); } }
@Override public void execute(AdminCommandContext context) { if (!env.isInstance()) { String msg = Strings.get("restart.instance.notInstance", env.getRuntimeType().toString()); context.getLogger().warning(msg); return; } setRegistry(registry); setServerName(env.getInstanceName()); if (debug != null) setDebug(debug); doExecute(context); } }
public void postConstruct() { mBootAMX = BootAMX.create(mHabitat, mMBeanServer); final List<JmxConnector> configuredConnectors = mAdminService.getJmxConnector(); final boolean autoStart = false; mConnectorsStarterThread = new JMXConnectorsStarterThread( AdminAuthorizedMBeanServer.newInstance(mMBeanServer, serverEnv.isInstance(), mBootAMX), configuredConnectors, mBootAMX, !autoStart, this); mConnectorsStarterThread.start(); // start AMX *first* (if auto start) so that it's ready if (autoStart) { new BootAMXThread(mBootAMX).start(); } mEvents.register(new ShutdownListener()); }
SupplementalCommand aCmd = new SupplementalCommand(cmdObject, ann.on(), ann.ifFailure()); if( (serverEnv.isDas() && aCmd.whereToRun().contains(RuntimeType.DAS)) || (serverEnv.isInstance() && aCmd.whereToRun().contains(RuntimeType.INSTANCE)) ) { if( (time.equals(Supplemental.Timing.Before) && aCmd.toBeExecutedBefore()) || (time.equals(Supplemental.Timing.After) && aCmd.toBeExecutedAfter()) ) {
public IAASImpl(@Inject(optional = true) Virtualizations virtualizations, @Inject Transactions transactions, @Inject ServerEnvironment env, @Inject final Services services) { this.services = services; // first executeAndWait the fping command to populate our arp table. transactions.addListenerForType(Virtualization.class, this); if (virtualizations==null) { transactions.addListenerForType(Virtualizations.class, new ConfigListener() { @Override public UnprocessedChangeEvents changed(PropertyChangeEvent[] propertyChangeEvents) { Virtualizations virts = services.forContract(Virtualizations.class).get(); for (Virtualization virt : virts.getVirtualizations()) { processVirtualization(virt); } Dom.unwrap(virts).addListener(IAASImpl.this); return null; } }); } else { Dom.unwrap(virtualizations).addListener(this); } if (virtualizations==null || env.isInstance() ) return; for (Virtualization virt : virtualizations.getVirtualizations()) { processVirtualization(virt); } }
(CommandTarget.DOMAIN.isValid(habitat, targetName) || runtimeTypes.contains(RuntimeType.DAS))) || runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE) || (serverEnv.isInstance() && runtimeTypes.contains(RuntimeType.INSTANCE))) { logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.maincommand", "Command execution stage 3 : Calling main command implementation for {0}", inv.name()));
(CommandTarget.DOMAIN.isValid(habitat, targetName) || runtimeTypes.contains(RuntimeType.DAS))) || runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE) || (serverEnv.isInstance() && runtimeTypes.contains(RuntimeType.INSTANCE))) { logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.maincommand", "Command execution stage 3 : Calling main command implementation for {0}", inv.name()));