本文整理汇总了Java中com.sforce.ws.ConnectorConfig.setConnectionTimeout方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectorConfig.setConnectionTimeout方法的具体用法?Java ConnectorConfig.setConnectionTimeout怎么用?Java ConnectorConfig.setConnectionTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sforce.ws.ConnectorConfig
的用法示例。
在下文中一共展示了ConnectorConfig.setConnectionTimeout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeConnectorConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void initializeConnectorConfig(ConnectorConfig connectorConfig) {
if (forceProject == null) {
throw new IllegalArgumentException("Object containing connection details cannot be null");
}
connectorConfig.setCompression(true);
if (Utils.isEmpty(forceProject.getSessionId())) {
connectorConfig.setManualLogin(true);
connectorConfig.setUsername(forceProject.getUserName());
connectorConfig.setPassword(forceProject.getPassword() + forceProject.getToken());
} else {
connectorConfig.setManualLogin(false);
connectorConfig.setSessionId(forceProject.getSessionId());
}
connectorConfig.setReadTimeout(forceProject.getReadTimeoutMillis());
connectorConfig.setConnectionTimeout(forceProject.getReadTimeoutMillis());
if (Utils.isNotEmpty(forceProject.getEndpointServer())) {
final String endpointUrl =
salesforceEndpoints.getFullEndpointUrl(forceProject.getEndpointServer(),
forceProject.isHttpsProtocol());
connectorConfig.setAuthEndpoint(endpointUrl);
connectorConfig.setServiceEndpoint(connectorConfig.getAuthEndpoint());
}
}
示例2: createConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public ConnectorConfig createConfig() {
CommonConnectorConfig commonConnConfig = new CommonConnectorConfig();
ConnectorConfig config = commonConnConfig.createConfig();
config.setAuthEndpoint(
CommandLineArguments.getOrgUrl() + "/services/Soap/u/" + ConnectionHandler.SUPPORTED_VERSION);
config.setSessionRenewer(new SFDCSessionRenewer());
LOG.info("Default connection time out value is: " + config.getConnectionTimeout());
config.setConnectionTimeout(ConnectionHandler.MAX_TIME_OUT_IN_MS_INT);
LOG.info("Updated connection time out value(from config.properties file): " + config.getConnectionTimeout());
return config;
}
示例3: login
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void login(String endpoint) throws ConnectionException {
ConnectorConfig config = new ConnectorConfig();
config.setAuthEndpoint(endpoint);
config.setUsername(username);
config.setPassword(password + securityKey);
config.setConnectionTimeout(60000);
config.setUseChunkedPost(true);
partnerConnection = new PartnerConnection(config);
}
示例4: connect
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
ConnectionHolder connect(RuntimeContainer container) throws IOException {
SalesforceRuntimeCommon.enableTLSv11AndTLSv12ForJava7();
final ConnectionHolder ch = new ConnectionHolder();
ConnectorConfig config = new ConnectorConfig();
config.setUsername(datastore.userId.getValue());
String password = datastore.password.getValue();
String securityKey = datastore.securityKey.getValue();
if (!StringUtils.isEmpty(securityKey)) {
password = password + securityKey;
}
config.setPassword(password);
// Notes on how to test this
// http://thysmichels.com/2014/02/15/salesforce-wsc-partner-connection-session-renew-when-session-timeout/
config.setSessionRenewer(new SessionRenewer() {
@Override
public SessionRenewalHeader renewSession(ConnectorConfig connectorConfig) throws ConnectionException {
LOG.debug("renewing session...");
SessionRenewalHeader header = new SessionRenewalHeader();
connectorConfig.setSessionId(null);
PartnerConnection connection = doConnection(connectorConfig);
// update the connection session header
ch.connection.setSessionHeader(connection.getSessionHeader().getSessionId());
header.name = new QName("urn:partner.soap.sforce.com", "SessionHeader");
header.headerElement = connection.getSessionHeader();
LOG.debug("session renewed!");
return header;
}
});
config.setConnectionTimeout(timeout);
config.setCompression(true);// This should only be false when doing debugging.
config.setUseChunkedPost(true);
config.setValidateSchema(false);
try {
ch.connection = doConnection(config);
ch.bulkConnection = connectBulk(ch.connection.getConfig());
return ch;
} catch (ConnectionException e) {
throw new IOException(e);
}
}