Skip to content

Commit f922c6f

Browse files
author
Alex Huang
committed
Keep removing
1 parent 56e5fbd commit f922c6f

12 files changed

Lines changed: 470 additions & 595 deletions

File tree

agent/src/com/cloud/agent/AgentShell.java

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@
5353
import com.cloud.utils.PropertiesUtil;
5454
import com.cloud.utils.backoff.BackoffAlgorithm;
5555
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
56-
import com.cloud.utils.component.Adapters;
57-
import com.cloud.utils.component.LegacyComponentLocator;
5856
import com.cloud.utils.exception.CloudRuntimeException;
59-
import com.cloud.utils.net.MacAddress;
6057
import com.cloud.utils.script.Script;
6158

6259
public class AgentShell implements IAgentShell {
@@ -146,6 +143,7 @@ public String getGuid() {
146143
return _guid;
147144
}
148145

146+
@Override
149147
public Map<String, Object> getCmdLineProperties() {
150148
return _cmdLineProperties;
151149
}
@@ -378,8 +376,6 @@ protected boolean parseCommand(final String[] args)
378376

379377
public void init(String[] args) throws ConfigurationException {
380378

381-
final LegacyComponentLocator locator = LegacyComponentLocator.getLocator("agent");
382-
383379
final Class<?> c = this.getClass();
384380
_version = c.getPackage().getImplementationVersion();
385381
if (_version == null) {
@@ -396,12 +392,9 @@ public void init(String[] args) throws ConfigurationException {
396392
s_logger.debug("Found property: " + property);
397393
}
398394

399-
_storage = locator.getManager(StorageComponent.class);
400-
if (_storage == null) {
401-
s_logger.info("Defaulting to using properties file for storage");
402-
_storage = new PropertiesStorage();
403-
_storage.configure("Storage", new HashMap<String, Object>());
404-
}
395+
s_logger.info("Defaulting to using properties file for storage");
396+
_storage = new PropertiesStorage();
397+
_storage.configure("Storage", new HashMap<String, Object>());
405398

406399
// merge with properties from command line to let resource access
407400
// command line parameters
@@ -410,22 +403,9 @@ public void init(String[] args) throws ConfigurationException {
410403
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
411404
}
412405

413-
final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class);
414-
final Enumeration en = adapters.enumeration();
415-
while (en.hasMoreElements()) {
416-
_backoff = (BackoffAlgorithm) en.nextElement();
417-
break;
418-
}
419-
if (en.hasMoreElements()) {
420-
s_logger.info("More than one backoff algorithm specified. Using the first one ");
421-
}
422-
423-
if (_backoff == null) {
424-
s_logger.info("Defaulting to the constant time backoff algorithm");
425-
_backoff = new ConstantTimeBackoff();
426-
_backoff.configure("ConstantTimeBackoff",
427-
new HashMap<String, Object>());
428-
}
406+
s_logger.info("Defaulting to the constant time backoff algorithm");
407+
_backoff = new ConstantTimeBackoff();
408+
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
429409
}
430410

431411
private void launchAgent() throws ConfigurationException {
@@ -469,6 +449,7 @@ private void launchConsoleProxy() throws ConfigurationException {
469449
openPortWithIptables(port);
470450

471451
_consoleProxyMain = new Thread(new Runnable() {
452+
@Override
472453
public void run() {
473454
try {
474455
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
@@ -522,7 +503,7 @@ private void launchAgentFromClassInfo(String resourceClassNames)
522503
} catch (final SecurityException e) {
523504
throw new ConfigurationException(
524505
"Security excetion when loading resource: " + name
525-
+ " due to: " + e.toString());
506+
+ " due to: " + e.toString());
526507
} catch (final NoSuchMethodException e) {
527508
throw new ConfigurationException(
528509
"Method not found excetion when loading resource: "
@@ -534,7 +515,7 @@ private void launchAgentFromClassInfo(String resourceClassNames)
534515
} catch (final InstantiationException e) {
535516
throw new ConfigurationException(
536517
"Instantiation excetion when loading resource: " + name
537-
+ " due to: " + e.toString());
518+
+ " due to: " + e.toString());
538519
} catch (final IllegalAccessException e) {
539520
throw new ConfigurationException(
540521
"Illegal access exception when loading resource: "

0 commit comments

Comments
 (0)