當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.getBoolean方法代碼示例

本文整理匯總了Java中org.apache.flink.configuration.Configuration.getBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getBoolean方法的具體用法?Java Configuration.getBoolean怎麽用?Java Configuration.getBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.flink.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.getBoolean方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRpcUrl

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 *
 * @param hostname The hostname or address where the target RPC service is listening.
 * @param port The port where the target RPC service is listening.
 * @param endpointName The name of the RPC endpoint.
 * @param addressResolution Whether to try address resolution of the given hostname or not.
 *                          This allows to fail fast in case that the hostname cannot be resolved.
 * @param config The configuration from which to deduce further settings.
 *
 * @return The RPC URL of the specified RPC endpoint.
 */
public static String getRpcUrl(
	String hostname,
	int port,
	String endpointName,
	HighAvailabilityServicesUtils.AddressResolution addressResolution,
	Configuration config) throws UnknownHostException {

	checkNotNull(config, "config is null");

	final boolean sslEnabled = config.getBoolean(AkkaOptions.SSL_ENABLED) &&
			SSLUtils.getSSLEnabled(config);

	return getRpcUrl(
		hostname,
		port,
		endpointName,
		addressResolution,
		sslEnabled ? AkkaProtocol.SSL_TCP : AkkaProtocol.TCP);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:31,代碼來源:AkkaRpcServiceUtils.java

示例2: fromConfiguration

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Creates and returns a new {@link RestServerEndpointConfiguration} from the given {@link Configuration}.
 *
 * @param config configuration from which the REST server endpoint configuration should be created from
 * @return REST server endpoint configuration
 * @throws ConfigurationException if SSL was configured incorrectly
 */
public static RestServerEndpointConfiguration fromConfiguration(Configuration config) throws ConfigurationException {
	Preconditions.checkNotNull(config);
	String address = config.getString(RestOptions.REST_ADDRESS);

	int port = config.getInteger(RestOptions.REST_PORT);

	SSLEngine sslEngine = null;
	boolean enableSSL = config.getBoolean(SecurityOptions.SSL_ENABLED);
	if (enableSSL) {
		try {
			SSLContext sslContext = SSLUtils.createSSLServerContext(config);
			if (sslContext != null) {
				sslEngine = sslContext.createSSLEngine();
				SSLUtils.setSSLVerAndCipherSuites(sslEngine, config);
				sslEngine.setUseClientMode(false);
			}
		} catch (Exception e) {
			throw new ConfigurationException("Failed to initialize SSLContext for REST server endpoint.", e);
		}
	}

	return new RestServerEndpointConfiguration(address, port, sslEngine);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:31,代碼來源:RestServerEndpointConfiguration.java

示例3: fromConfiguration

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Creates and returns a new {@link RestClientConfiguration} from the given {@link Configuration}.
 *
 * @param config configuration from which the REST client endpoint configuration should be created from
 * @return REST client endpoint configuration
 * @throws ConfigurationException if SSL was configured incorrectly
 */

public static RestClientConfiguration fromConfiguration(Configuration config) throws ConfigurationException {
	Preconditions.checkNotNull(config);

	SSLEngine sslEngine = null;
	boolean enableSSL = config.getBoolean(SecurityOptions.SSL_ENABLED);
	if (enableSSL) {
		try {
			SSLContext sslContext = SSLUtils.createSSLServerContext(config);
			if (sslContext != null) {
				sslEngine = sslContext.createSSLEngine();
				SSLUtils.setSSLVerAndCipherSuites(sslEngine, config);
				sslEngine.setUseClientMode(false);
			}
		} catch (Exception e) {
			throw new ConfigurationException("Failed to initialize SSLContext for the web frontend", e);
		}
	}

	return new RestClientConfiguration(sslEngine);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:29,代碼來源:RestClientConfiguration.java

示例4: SummarizationJobParameters

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
public SummarizationJobParameters(Configuration conf) {
    System.out.println("Creating job parameters from configuration: " + conf);
    timelyHostname = conf.getString("timelyHostname", null);
    timelyTcpPort = conf.getInteger("timelyTcpPort", 4241);
    timelyHttpsPort = conf.getInteger("timelyHttpsPort", 4242);
    timelyWssPort = conf.getInteger("timelyWssPort", 4243);
    doLogin = conf.getBoolean("doLogin", false);
    timelyUsername = conf.getString("timelyUsername", null);
    timelyPassword = conf.getString("timelyPassword", null);
    keyStoreFile = conf.getString("keyStoreFile", null);
    keyStoreType = conf.getString("keyStoreType", "JKS");
    keyStorePass = conf.getString("keyStorePass", null);
    trustStoreFile = conf.getString("trustStoreFile", null);
    trustStoreType = conf.getString("trustStoreType", "JKS");
    trustStorePass = conf.getString("trustStorePass", null);
    hostVerificationEnabled = conf.getBoolean("hostVerificationEnabled", true);
    bufferSize = conf.getInteger("bufferSize", 10485760);
    String metricNames = conf.getString("metrics", null);
    if (null != metricNames) {
        metrics = metricNames.split(",");
    } else {
        metrics = null;
    }
    startTime = conf.getLong("startTime", 0L);
    endTime = conf.getLong("endTime", 0L);
    interval = conf.getString("interval", null);
    intervalUnits = conf.getString("intervalUnits", null);
}
 
開發者ID:NationalSecurityAgency,項目名稱:timely,代碼行數:29,代碼來源:SummarizationJobParameters.java

示例5: RocksDBStateBackend

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Private constructor that creates a re-configured copy of the state backend.
 *
 * @param original The state backend to re-configure.
 * @param config The configuration.
 */
private RocksDBStateBackend(RocksDBStateBackend original, Configuration config) {
	// reconfigure the state backend backing the streams
	final StateBackend originalStreamBackend = original.checkpointStreamBackend;
	this.checkpointStreamBackend = originalStreamBackend instanceof ConfigurableStateBackend ?
			((ConfigurableStateBackend) originalStreamBackend).configure(config) :
			originalStreamBackend;

	// configure incremental checkpoints
	if (original.enableIncrementalCheckpointing != null) {
		this.enableIncrementalCheckpointing = original.enableIncrementalCheckpointing;
	}
	else {
		this.enableIncrementalCheckpointing =
				config.getBoolean(CheckpointingOptions.INCREMENTAL_CHECKPOINTS);
	}

	// configure local directories
	if (original.localRocksDbDirectories != null) {
		this.localRocksDbDirectories = original.localRocksDbDirectories;
	}
	else {
		final String rocksdbLocalPaths = config.getString(CheckpointingOptions.ROCKSDB_LOCAL_DIRECTORIES);
		if (rocksdbLocalPaths != null) {
			String[] directories = rocksdbLocalPaths.split(",|" + File.pathSeparator);

			try {
				setDbStoragePaths(directories);
			}
			catch (IllegalArgumentException e) {
				throw new IllegalConfigurationException("Invalid configuration for RocksDB state " +
						"backend's local storage directories: " + e.getMessage(), e);
			}
		}
	}

	// copy remaining settings
	this.predefinedOptions = original.predefinedOptions;
	this.optionsFactory = original.optionsFactory;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:46,代碼來源:RocksDBStateBackend.java

示例6: readFileInfoFromConfig

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
public static Set<Entry<String, DistributedCacheEntry>> readFileInfoFromConfig(Configuration conf) {
	int num = conf.getInteger(CACHE_FILE_NUM, 0);
	if (num == 0) {
		return Collections.emptySet();
	}

	Map<String, DistributedCacheEntry> cacheFiles = new HashMap<String, DistributedCacheEntry>();
	for (int i = 1; i <= num; i++) {
		String name = conf.getString(CACHE_FILE_NAME + i, null);
		String filePath = conf.getString(CACHE_FILE_PATH + i, null);
		Boolean isExecutable = conf.getBoolean(CACHE_FILE_EXE + i, false);
		cacheFiles.put(name, new DistributedCacheEntry(filePath, isExecutable));
	}
	return cacheFiles.entrySet();
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:16,代碼來源:DistributedCache.java

示例7: initDefaultsFromConfiguration

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Initialize defaults for output format. Needs to be a static method because it is configured for local
 * cluster execution, see LocalFlinkMiniCluster.
 * @param configuration The configuration to load defaults from
 */
private static void initDefaultsFromConfiguration(Configuration configuration) {
	final boolean overwrite = configuration.getBoolean(
			ConfigConstants.FILESYSTEM_DEFAULT_OVERWRITE_KEY,
			ConfigConstants.DEFAULT_FILESYSTEM_OVERWRITE);

	DEFAULT_WRITE_MODE = overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE;
	
	final boolean alwaysCreateDirectory = configuration.getBoolean(
		ConfigConstants.FILESYSTEM_OUTPUT_ALWAYS_CREATE_DIRECTORY_KEY,
		ConfigConstants.DEFAULT_FILESYSTEM_ALWAYS_CREATE_DIRECTORY);

	DEFAULT_OUTPUT_DIRECTORY_MODE = alwaysCreateDirectory ? OutputDirectoryMode.ALWAYS : OutputDirectoryMode.PARONLY;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:FileOutputFormat.java

示例8: SecurityConfiguration

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Create a security configuration from the global configuration.
 * @param flinkConf the Flink global configuration.
 * @param securityModuleFactories the security modules to apply.
 */
public SecurityConfiguration(Configuration flinkConf,
		List<SecurityModuleFactory> securityModuleFactories) {
	this.isZkSaslDisable = flinkConf.getBoolean(SecurityOptions.ZOOKEEPER_SASL_DISABLE);
	this.keytab = flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_KEYTAB);
	this.principal = flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL);
	this.useTicketCache = flinkConf.getBoolean(SecurityOptions.KERBEROS_LOGIN_USETICKETCACHE);
	this.loginContextNames = parseList(flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_CONTEXTS));
	this.zkServiceName = flinkConf.getString(SecurityOptions.ZOOKEEPER_SASL_SERVICE_NAME);
	this.zkLoginContextName = flinkConf.getString(SecurityOptions.ZOOKEEPER_SASL_LOGIN_CONTEXT_NAME);
	this.securityModuleFactories = Collections.unmodifiableList(securityModuleFactories);
	this.flinkConfig = checkNotNull(flinkConf);
	validate();
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:SecurityConfiguration.java

示例9: getRpcUrl

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 *
 * @param hostname     The hostname or address where the target RPC service is listening.
 * @param port         The port where the target RPC service is listening.
 * @param endpointName The name of the RPC endpoint.
 * @param config       The configuration from which to deduce further settings.
 *
 * @return The RPC URL of the specified RPC endpoint.
 */
public static String getRpcUrl(String hostname, int port, String endpointName, Configuration config)
		throws UnknownHostException {

	checkNotNull(config, "config is null");

	final boolean sslEnabled = config.getBoolean(
				ConfigConstants.AKKA_SSL_ENABLED,
				ConfigConstants.DEFAULT_AKKA_SSL_ENABLED) &&
			SSLUtils.getSSLEnabled(config);

	return getRpcUrl(hostname, port, endpointName, sslEnabled);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:22,代碼來源:RpcServiceUtils.java

示例10: calculateHeapSizeMB

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Calculates the amount of heap memory to use (to set via <tt>-Xmx</tt> and <tt>-Xms</tt>)
 * based on the total memory to use and the given configuration parameters.
 *
 * @param totalJavaMemorySizeMB
 * 		overall available memory to use (heap and off-heap)
 * @param config
 * 		configuration object
 *
 * @return heap memory to use (in megabytes)
 */
public static long calculateHeapSizeMB(long totalJavaMemorySizeMB, Configuration config) {
	Preconditions.checkArgument(totalJavaMemorySizeMB > 0);

	// subtract the Java memory used for network buffers (always off-heap)
	final long networkBufMB =
		calculateNetworkBufferMemory(
			totalJavaMemorySizeMB << 20, // megabytes to bytes
			config) >> 20; // bytes to megabytes
	final long remainingJavaMemorySizeMB = totalJavaMemorySizeMB - networkBufMB;

	// split the available Java memory between heap and off-heap

	final boolean useOffHeap = config.getBoolean(TaskManagerOptions.MEMORY_OFF_HEAP);

	final long heapSizeMB;
	if (useOffHeap) {

		long offHeapSize = config.getLong(TaskManagerOptions.MANAGED_MEMORY_SIZE);

		if (offHeapSize <= 0) {
			// calculate off-heap section via fraction
			double fraction = config.getFloat(TaskManagerOptions.MANAGED_MEMORY_FRACTION);
			offHeapSize = (long) (fraction * remainingJavaMemorySizeMB);
		}

		TaskManagerServicesConfiguration
			.checkConfigParameter(offHeapSize < remainingJavaMemorySizeMB, offHeapSize,
				TaskManagerOptions.MANAGED_MEMORY_SIZE.key(),
				"Managed memory size too large for " + networkBufMB +
					" MB network buffer memory and a total of " + totalJavaMemorySizeMB +
					" MB JVM memory");

		heapSizeMB = remainingJavaMemorySizeMB - offHeapSize;
	} else {
		heapSizeMB = remainingJavaMemorySizeMB;
	}

	return heapSizeMB;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:51,代碼來源:TaskManagerServices.java

示例11: BlobClient

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Instantiates a new BLOB client.
 *
 * @param serverAddress
 *        the network address of the BLOB server
 * @param clientConfig
 *        additional configuration like SSL parameters required to connect to the blob server
 *
 * @throws IOException
 *         thrown if the connection to the BLOB server could not be established
 */
public BlobClient(InetSocketAddress serverAddress, Configuration clientConfig) throws IOException {

	try {
		// Check if ssl is enabled
		SSLContext clientSSLContext = null;
		if (clientConfig != null &&
			clientConfig.getBoolean(BlobServerOptions.SSL_ENABLED)) {

			clientSSLContext = SSLUtils.createSSLClientContext(clientConfig);
		}

		if (clientSSLContext != null) {

			LOG.info("Using ssl connection to the blob server");

			SSLSocket sslSocket = (SSLSocket) clientSSLContext.getSocketFactory().createSocket(
				serverAddress.getAddress(),
				serverAddress.getPort());

			// Enable hostname verification for remote SSL connections
			if (!serverAddress.getAddress().isLoopbackAddress()) {
				SSLParameters newSSLParameters = sslSocket.getSSLParameters();
				SSLUtils.setSSLVerifyHostname(clientConfig, newSSLParameters);
				sslSocket.setSSLParameters(newSSLParameters);
			}
			this.socket = sslSocket;
		} else {
			this.socket = new Socket();
			this.socket.connect(serverAddress);
		}

	}
	catch (Exception e) {
		BlobUtils.closeSilently(socket, LOG);
		throw new IOException("Could not connect to BlobServer at address " + serverAddress, e);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:49,代碼來源:BlobClient.java

示例12: setSSLVerifyHostname

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Sets SSL options to verify peer's hostname in the certificate.
 *
 * @param sslConfig
 *        The application configuration
 * @param sslParams
 *        The SSL parameters that need to be updated
 */
public static void setSSLVerifyHostname(Configuration sslConfig, SSLParameters sslParams) {

	Preconditions.checkNotNull(sslConfig);
	Preconditions.checkNotNull(sslParams);

	boolean verifyHostname = sslConfig.getBoolean(SecurityOptions.SSL_VERIFY_HOSTNAME);
	if (verifyHostname) {
		sslParams.setEndpointIdentificationAlgorithm("HTTPS");
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:SSLUtils.java

示例13: readParametersFromConfig

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void readParametersFromConfig(Configuration config, ClassLoader cl) throws ClassNotFoundException {
	// figure out how many key fields there are
	final int numKeyFields = config.getInteger(NUM_KEYS, -1);
	if (numKeyFields < 0) {
		throw new IllegalConfigurationException("The number of keys for the comparator is invalid: " + numKeyFields);
	}
	
	final int[] positions = new int[numKeyFields];
	final Class<? extends Value>[] types = new Class[numKeyFields];
	final boolean[] direction = new boolean[numKeyFields];
	
	// read the individual key positions and types
	for (int i = 0; i < numKeyFields; i++) {
		// next key position
		final int p = config.getInteger(KEY_POS_PREFIX + i, -1);
		if (p >= 0) {
			positions[i] = p;
		} else {
			throw new IllegalConfigurationException("Contained invalid position for key no positions for keys.");
		}
		
		// next key type
		final String name = config.getString(KEY_CLASS_PREFIX + i, null);
		if (name != null) {
			types[i] = (Class<? extends Value>) Class.forName(name, true, cl).asSubclass(Value.class);
		} else {
			throw new IllegalConfigurationException("The key type (" + i +
				") for the comparator is null"); 
		}
		
		// next key sort direction
		direction[i] = config.getBoolean(KEY_SORT_DIRECTION_PREFIX + i, true);
	}
	
	this.positions = positions;
	this.types = types;
	this.sortDirections = direction;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:41,代碼來源:RecordComparatorFactory.java

示例14: JobGraphGenerator

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
public JobGraphGenerator(Configuration config) {
	this.defaultMaxFan = config.getInteger(ConfigConstants.DEFAULT_SPILLING_MAX_FAN_KEY, 
		ConfigConstants.DEFAULT_SPILLING_MAX_FAN);
	this.defaultSortSpillingThreshold = config.getFloat(ConfigConstants.DEFAULT_SORT_SPILLING_THRESHOLD_KEY,
		ConfigConstants.DEFAULT_SORT_SPILLING_THRESHOLD);
	this.useLargeRecordHandler = config.getBoolean(
			ConfigConstants.USE_LARGE_RECORD_HANDLER_KEY,
			ConfigConstants.DEFAULT_USE_LARGE_RECORD_HANDLER);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:10,代碼來源:JobGraphGenerator.java

示例15: fromConfiguration

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Utility method to extract TaskManager config parameters from the configuration and to
 * sanity check them.
 *
 * @param configuration The configuration.
 * @param remoteAddress identifying the IP address under which the TaskManager will be accessible
 * @param localCommunication True, to skip initializing the network stack.
 *                                      Use only in cases where only one task manager runs.
 * @return TaskExecutorConfiguration that wrappers InstanceConnectionInfo, NetworkEnvironmentConfiguration, etc.
 */
public static TaskManagerServicesConfiguration fromConfiguration(
		Configuration configuration,
		InetAddress remoteAddress,
		boolean localCommunication) throws Exception {

	// we need this because many configs have been written with a "-1" entry
	int slots = configuration.getInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 1);
	if (slots == -1) {
		slots = 1;
	}

	final String[] tmpDirs = ConfigurationUtils.parseTempDirectories(configuration);

	final NetworkEnvironmentConfiguration networkConfig = parseNetworkEnvironmentConfiguration(
		configuration,
		localCommunication,
		remoteAddress,
		slots);

	final QueryableStateConfiguration queryableStateConfig =
			parseQueryableStateConfiguration(configuration);

	// extract memory settings
	long configuredMemory = configuration.getLong(TaskManagerOptions.MANAGED_MEMORY_SIZE);
	checkConfigParameter(
		configuredMemory == TaskManagerOptions.MANAGED_MEMORY_SIZE.defaultValue() ||
			configuredMemory > 0, configuredMemory,
		TaskManagerOptions.MANAGED_MEMORY_SIZE.key(),
		"MemoryManager needs at least one MB of memory. " +
			"If you leave this config parameter empty, the system automatically " +
			"pick a fraction of the available memory.");

	// check whether we use heap or off-heap memory
	final MemoryType memType;
	if (configuration.getBoolean(TaskManagerOptions.MEMORY_OFF_HEAP)) {
		memType = MemoryType.OFF_HEAP;
	} else {
		memType = MemoryType.HEAP;
	}

	boolean preAllocateMemory = configuration.getBoolean(TaskManagerOptions.MANAGED_MEMORY_PRE_ALLOCATE);

	float memoryFraction = configuration.getFloat(TaskManagerOptions.MANAGED_MEMORY_FRACTION);
	checkConfigParameter(memoryFraction > 0.0f && memoryFraction < 1.0f, memoryFraction,
		TaskManagerOptions.MANAGED_MEMORY_FRACTION.key(),
		"MemoryManager fraction of the free memory must be between 0.0 and 1.0");

	long timerServiceShutdownTimeout = AkkaUtils.getTimeout(configuration).toMillis();

	return new TaskManagerServicesConfiguration(
		remoteAddress,
		tmpDirs,
		networkConfig,
		queryableStateConfig,
		slots,
		configuredMemory,
		memType,
		preAllocateMemory,
		memoryFraction,
		timerServiceShutdownTimeout);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:72,代碼來源:TaskManagerServicesConfiguration.java


注:本文中的org.apache.flink.configuration.Configuration.getBoolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。