mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
changes
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
fa50740514
commit
adae7c88b8
@ -16,28 +16,6 @@
|
||||
// under the License.
|
||||
package com.cloud.agent;
|
||||
|
||||
import com.cloud.agent.Agent.ExitStatus;
|
||||
import com.cloud.agent.dao.StorageComponent;
|
||||
import com.cloud.agent.dao.impl.PropertiesStorage;
|
||||
import com.cloud.agent.properties.AgentProperties;
|
||||
import com.cloud.agent.properties.AgentPropertiesFileHandler;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.utils.LogUtils;
|
||||
import com.cloud.utils.ProcessUtil;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.backoff.BackoffAlgorithm;
|
||||
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.commons.daemon.Daemon;
|
||||
import org.apache.commons.daemon.DaemonContext;
|
||||
import org.apache.commons.daemon.DaemonInitException;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@ -52,6 +30,30 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.commons.daemon.Daemon;
|
||||
import org.apache.commons.daemon.DaemonContext;
|
||||
import org.apache.commons.daemon.DaemonInitException;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
|
||||
import com.cloud.agent.Agent.ExitStatus;
|
||||
import com.cloud.agent.dao.StorageComponent;
|
||||
import com.cloud.agent.dao.impl.PropertiesStorage;
|
||||
import com.cloud.agent.properties.AgentProperties;
|
||||
import com.cloud.agent.properties.AgentPropertiesFileHandler;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.utils.LogUtils;
|
||||
import com.cloud.utils.ProcessUtil;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.backoff.BackoffAlgorithm;
|
||||
import com.cloud.utils.backoff.impl.RangeTimeBackoff;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class AgentShell implements IAgentShell, Daemon {
|
||||
private static final Logger s_logger = Logger.getLogger(AgentShell.class.getName());
|
||||
|
||||
@ -404,7 +406,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
||||
}
|
||||
|
||||
s_logger.info("Defaulting to the range time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff = new RangeTimeBackoff();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("minSeconds", _properties.getProperty("backoff.min.seconds"));
|
||||
map.put("maxSeconds", _properties.getProperty("backoff.max.seconds"));
|
||||
|
||||
@ -204,7 +204,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
Integer.class, "agent.ssl.handshake.min.workers", "5",
|
||||
"Number of minimum worker threads handling SSL handshake with remote agents.", false);
|
||||
protected final ConfigKey<Integer> RemoteAgentSslHandshakeMaxWorkers = new ConfigKey<>("Advanced",
|
||||
Integer.class, "agent.ssl.handshake.min.workers", "100",
|
||||
Integer.class, "agent.ssl.handshake.max.workers", "50",
|
||||
"Number of maximum worker threads handling SSL handshake with remote agents.", false);
|
||||
protected final ConfigKey<Integer> AlertWait = new ConfigKey<Integer>("Advanced", Integer.class, "alert.wait", "1800",
|
||||
"Seconds to wait before alerting on a disconnected agent", true);
|
||||
@ -1850,7 +1850,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize,
|
||||
DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait,
|
||||
RemoteAgentSslHandshakeTimeout
|
||||
RemoteAgentSslHandshakeTimeout, RemoteAgentSslHandshakeMinWorkers, RemoteAgentSslHandshakeMaxWorkers
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -19,15 +19,15 @@
|
||||
|
||||
package com.cloud.utils.backoff.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.backoff.BackoffAlgorithm;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* An implementation of BackoffAlgorithm that waits for some random seconds
|
||||
@ -48,6 +48,7 @@ public class RangeTimeBackoff extends AdapterBase implements BackoffAlgorithm {
|
||||
try {
|
||||
asleep.put(current.getName(), current);
|
||||
long time = ThreadLocalRandom.current().nextInt(minTime, maxTime) * 1000L;
|
||||
LOG.info("Waiting " + current.getName() + " for " + time);
|
||||
Thread.sleep(time);
|
||||
} catch (InterruptedException e) {
|
||||
// JMX or other threads may interrupt this thread, but let's log it
|
||||
|
||||
@ -51,7 +51,7 @@ public class NioClient extends NioConnection {
|
||||
try {
|
||||
_clientConnection = SocketChannel.open();
|
||||
|
||||
s_logger.info(getConnectionName() + "Connecting to " + _host + ":" + _port);
|
||||
s_logger.info("Connecting to " + _host + ":" + _port);
|
||||
final InetSocketAddress peerAddr = new InetSocketAddress(_host, _port);
|
||||
_clientConnection.connect(peerAddr);
|
||||
_clientConnection.configureBlocking(false);
|
||||
@ -62,12 +62,12 @@ public class NioClient extends NioConnection {
|
||||
sslEngine.setEnabledProtocols(SSLUtils.getSupportedProtocols(sslEngine.getEnabledProtocols()));
|
||||
sslEngine.beginHandshake();
|
||||
if (!Link.doHandshake(_clientConnection, sslEngine, getSslHandshakeTimeout())) {
|
||||
s_logger.error(getConnectionName() + "SSL Handshake failed while connecting to host: " + _host + " port: " + _port);
|
||||
s_logger.error("SSL Handshake failed while connecting to host: " + _host + " port: " + _port);
|
||||
_selector.close();
|
||||
throw new IOException("SSL Handshake failed while connecting to host: " + _host + " port: " + _port);
|
||||
}
|
||||
s_logger.info(getConnectionName() + "SSL: Handshake done");
|
||||
s_logger.info(getConnectionName() + "Connected to " + _host + ":" + _port);
|
||||
s_logger.info("SSL: Handshake done");
|
||||
s_logger.info("Connected to " + _host + ":" + _port);
|
||||
|
||||
final Link link = new Link(peerAddr, this);
|
||||
link.setSSLEngine(sslEngine);
|
||||
@ -81,7 +81,7 @@ public class NioClient extends NioConnection {
|
||||
_selector.close();
|
||||
throw new IOException("Failed to initialise security", e);
|
||||
} catch (final IOException e) {
|
||||
s_logger.error(getConnectionName() + "IOException", e);
|
||||
s_logger.error("IOException", e);
|
||||
_selector.close();
|
||||
throw e;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user