public OChannelBinary(final Socket iSocket, final OContextConfiguration iConfig) throws IOException { super(iSocket, iConfig); maxChunkSize = iConfig.getValueAsInteger(OGlobalConfiguration.NETWORK_BINARY_MAX_CONTENT_LENGTH) * 1024; debug = iConfig.getValueAsBoolean(OGlobalConfiguration.NETWORK_BINARY_DEBUG); responseTimeout = iConfig.getValueAsInteger(OGlobalConfiguration.NETWORK_REQUEST_TIMEOUT); if (debug) OLogManager.instance().info(this, "%s - Connected", socket.getRemoteSocketAddress()); }
public String getValueAsString(final String iName, final String iDefaultValue) { return getValue(iName, iDefaultValue); }
@Override public long getDistributedTimeout() { return getDatabase().getConfiguration().getValueAsLong(OGlobalConfiguration.DISTRIBUTED_COMMAND_QUICK_TASK_SYNCH_TIMEOUT); }
private OSocketFactory(final OContextConfiguration iConfig) { config = iConfig; useSSL = iConfig.getValueAsBoolean(OGlobalConfiguration.CLIENT_USE_SSL); keyStorePath = (String) iConfig.getValue(OGlobalConfiguration.CLIENT_SSL_KEYSTORE); keyStorePassword = (String) iConfig.getValue(OGlobalConfiguration.CLIENT_SSL_KEYSTORE_PASSWORD); trustStorePath = (String) iConfig.getValue(OGlobalConfiguration.CLIENT_SSL_TRUSTSTORE); trustStorePassword = (String) iConfig.getValue(OGlobalConfiguration.CLIENT_SSL_TRUSTSTORE_PASSWORD); }
private void autoInitClusters() { if (getContextConfiguration().getValueAsInteger(OGlobalConfiguration.CLASS_MINIMUM_CLUSTERS) == 0) { final int cpus = Runtime.getRuntime().availableProcessors(); getContextConfiguration().setValue(OGlobalConfiguration.CLASS_MINIMUM_CLUSTERS, cpus > 64 ? 64 : cpus); } }
public OChannel(final Socket iSocket, final OContextConfiguration iConfig) throws IOException { super(true); socket = iSocket; socketBufferSize = iConfig.getValueAsInteger(OGlobalConfiguration.NETWORK_SOCKET_BUFFER_SIZE); socket.setTcpNoDelay(true); }
@Override protected void initWalAndDiskCache(OContextConfiguration contextConfiguration) throws IOException { if (configuration.getContextConfiguration().getValueAsBoolean(OGlobalConfiguration.USE_WAL)) { if (writeAheadLog == null) writeAheadLog = new OMemoryWriteAheadLog(); } else writeAheadLog = null; final ODirectMemoryOnlyDiskCache diskCache = new ODirectMemoryOnlyDiskCache( OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * ONE_KB, 1, getPerformanceStatisticManager()); if (readCache == null) { readCache = diskCache; } if (writeCache == null) { writeCache = diskCache; } }
walPath = config.getValueAsString(OGlobalConfiguration.WAL_LOCATION); } else { walPath = OGlobalConfiguration.WAL_LOCATION.getValueAsString(); final OContextConfiguration config = configurations.getConfigurations(); if (config != null) { maxSegSize = config.getValueAsLong(OGlobalConfiguration.WAL_MAX_SEGMENT_SIZE) * 1024 * 1024; } else { maxSegSize = OGlobalConfiguration.WAL_MAX_SEGMENT_SIZE.getValueAsLong() * 1024 * 1024; sizePercent = config.getValueAsInteger(OGlobalConfiguration.WAL_MAX_SEGMENT_SIZE_PERCENT); } else { sizePercent = OGlobalConfiguration.WAL_MAX_SEGMENT_SIZE_PERCENT.getValueAsInteger(); OContextConfiguration config = configurations.getConfigurations(); if (config != null) { minSegSize = config.getValueAsLong(OGlobalConfiguration.WAL_MIN_SEG_SIZE) * 1024 * 1024;
private void clear() { fileTemplate = new OStorageSegmentConfiguration(); charset = DEFAULT_CHARSET; synchronized (properties) { properties.clear(); } version = -1; name = null; schemaRecordId = null; dictionaryRecordId = null; indexMgrRecordId = null; dateFormat = DEFAULT_DATE_FORMAT; dateTimeFormat = DEFAULT_DATETIME_FORMAT; binaryFormatVersion = 0; clusters = Collections.synchronizedList(new ArrayList<>()); localeLanguage = Locale.getDefault().getLanguage(); localeCountry = Locale.getDefault().getCountry(); timeZone = TimeZone.getDefault(); localeInstance = null; clusterSelection = null; conflictStrategy = null; getContextConfiguration().setValue(OGlobalConfiguration.CLASS_MINIMUM_CLUSTERS, OGlobalConfiguration.CLASS_MINIMUM_CLUSTERS.getValueAsInteger()); // 0 = AUTOMATIC autoInitClusters(); recordSerializer = null; recordSerializerVersion = 0; indexEngines = new ConcurrentHashMap<>(); validation = getContextConfiguration().getValueAsBoolean(OGlobalConfiguration.DB_VALIDATION); binaryFormatVersion = CURRENT_BINARY_FORMAT_VERSION; }
public int getMinimumClusters() { lock.acquireReadLock(); try { final int mc = getContextConfiguration().getValueAsInteger(OGlobalConfiguration.CLASS_MINIMUM_CLUSTERS); if (mc == 0) { autoInitClusters(); return (Integer) getContextConfiguration().getValue(OGlobalConfiguration.CLASS_MINIMUM_CLUSTERS); } return mc; } finally { lock.releaseReadLock(); } }
public OrientDBConfigBuilder addConfig(OGlobalConfiguration configuration, Object value) { configurations.setValue(configuration, value); return this; }
clusterCompression, clusterEncryption, configuration.getValueAsString(OGlobalConfiguration.STORAGE_ENCRYPTION_KEY), clusterConflictStrategy, status, clusterBinaryVersion); if (cfg != null) { if (value != null) configuration.setValue(key, OType.convert(value, cfg.getType())); } else OLogManager.instance().warn(this, "Ignored storage configuration because not supported: %s=%s", key, value);
write(buffer, configuration.getContextSize()); for (String k : configuration.getContextKeys()) { final OGlobalConfiguration cfg = OGlobalConfiguration.findByKey(k); write(buffer, k); if (cfg != null) { write(buffer, cfg.isHidden() ? null : configuration.getValueAsString(cfg)); } else { write(buffer, null);
OContextConfiguration confis = new OContextConfiguration(); confis.merge(parent.configurations); if (this.configurations != null) { confis.merge(this.configurations);
@Override public void configure(final OStorage storage, final int id, final String clusterName, final Object... parameters) throws IOException { acquireExclusiveLock(); try { final OContextConfiguration ctxCfg = storage.getConfiguration().getContextConfiguration(); final String cfgCompression = ctxCfg.getValueAsString(OGlobalConfiguration.STORAGE_COMPRESSION_METHOD); final String cfgEncryption = ctxCfg.getValueAsString(OGlobalConfiguration.STORAGE_ENCRYPTION_METHOD); final String cfgEncryptionKey = ctxCfg.getValueAsString(OGlobalConfiguration.STORAGE_ENCRYPTION_KEY); config = new OStoragePaginatedClusterConfiguration(storage.getConfiguration(), id, clusterName, null, true, OStoragePaginatedClusterConfiguration.DEFAULT_GROW_FACTOR, OStoragePaginatedClusterConfiguration.DEFAULT_GROW_FACTOR, cfgCompression, cfgEncryption, cfgEncryptionKey, null, OStorageClusterConfiguration.STATUS.ONLINE, BINARY_VERSION); config.name = clusterName; init((OAbstractPaginatedStorage) storage, config); } finally { releaseExclusiveLock(); } }
protected OrientDBConfig() { configurations = new OContextConfiguration(); attributes = new HashMap<>(); parent = null; listeners = new HashSet<>(); classLoader = this.getClass().getClassLoader(); }
public OChannel(final Socket iSocket, final OContextConfiguration iConfig) throws IOException { super(true); socketBufferSize = iConfig.getValueAsInteger(OGlobalConfiguration.NETWORK_SOCKET_BUFFER_SIZE); socket = iSocket; socket.setTcpNoDelay(true); if (socketBufferSize > 0) { socket.setSendBufferSize(socketBufferSize); socket.setReceiveBufferSize(socketBufferSize); } // THIS TIMEOUT IS CORRECT BUT CREATE SOME PROBLEM ON REMOTE, NEED CHECK BEFORE BE ENABLED // timeout = iConfig.getValueAsLong(OGlobalConfiguration.NETWORK_REQUEST_TIMEOUT); }
@Override public void recreateIndexes(ODatabaseDocumentInternal database) { acquireExclusiveLock(); try { if (recreateIndexesThread != null && recreateIndexesThread.isAlive()) // BUILDING ALREADY IN PROGRESS return; document = database.load(new ORecordId(database.getStorage().getConfiguration().getIndexMgrRecordId())); Runnable recreateIndexesTask = new RecreateIndexesTask(database.getStorage()); recreateIndexesThread = new Thread(recreateIndexesTask, "OrientDB rebuild indexes"); recreateIndexesThread.setUncaughtExceptionHandler(new OUncaughtExceptionHandler()); recreateIndexesThread.start(); } finally { releaseExclusiveLock(); } if (database.getConfiguration().getValueAsBoolean(OGlobalConfiguration.INDEX_SYNCHRONOUS_AUTO_REBUILD)) { waitTillIndexRestore(); database.getMetadata().reload(); } }
private OSocketFactory(OContextConfiguration iConfig) { config = iConfig; useSSL = iConfig.getValueAsBoolean(OGlobalConfiguration.CLIENT_USE_SSL); keyStorePath = (String) iConfig .getValue(OGlobalConfiguration.CLIENT_SSL_KEYSTORE); keyStorePassword = (String) iConfig .getValue(OGlobalConfiguration.CLIENT_SSL_KEYSTORE_PASSWORD); trustStorePath = (String) iConfig .getValue(OGlobalConfiguration.CLIENT_SSL_TRUSTSTORE); trustStorePassword = (String) iConfig .getValue(OGlobalConfiguration.CLIENT_SSL_TRUSTSTORE_PASSWORD); }
public OrientDBConfigBuilder fromMap(Map<String, Object> values) { for (Map.Entry<String, Object> entry : values.entrySet()) { configurations.setValue(entry.getKey(), entry.getValue()); } return this; }