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); }
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); }
public OCommandExecutorSQLSelect() { OContextConfiguration conf = getDatabase().getConfiguration(); resultQueue = new ArrayBlockingQueue<AsyncResult>( conf.getValueAsInteger(OGlobalConfiguration.QUERY_PARALLEL_RESULT_QUEUE_SIZE)); tipLimitThreshold = conf.getValueAsInteger(OGlobalConfiguration.QUERY_LIMIT_THRESHOLD_TIP); }
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()); }
private boolean serialIterator(Iterator<? extends OIdentifiable> iTarget) { int queryScanThresholdWarning = getDatabase().getConfiguration() .getValueAsInteger(OGlobalConfiguration.QUERY_SCAN_THRESHOLD_TIP); boolean tipActivated = queryScanThresholdWarning > 0 && iTarget instanceof OIdentifiableIterator && compiledFilter != null; // BROWSE, UNMARSHALL AND FILTER ALL THE RECORDS ON CURRENT THREAD for (int browsed = 0; iTarget.hasNext(); browsed++) { final OIdentifiable next = iTarget.next(); if (!executeSearchRecord(next, context, false)) return false; } return true; }
/** * @return Singleton instance */ public static OByteBufferPool instance(OContextConfiguration contextConfiguration) { final OByteBufferPool instance = INSTANCE_HOLDER.get(); if (instance != null) { return instance; } int bufferSize; if (contextConfiguration != null) { bufferSize = contextConfiguration.getValueAsInteger(OGlobalConfiguration.DISK_CACHE_PAGE_SIZE); } else { bufferSize = OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger(); } final OByteBufferPool newInstance = new OByteBufferPool(bufferSize * 1024); if (INSTANCE_HOLDER.compareAndSet(null, newInstance)) { return newInstance; } return INSTANCE_HOLDER.get(); }
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 OCommandCacheSoftRefs(final OStorage storage) { databaseName = storage.getName(); if (storage instanceof OLocalPaginatedStorage) { fileConfigPath = ((OLocalPaginatedStorage) storage).getStoragePath().resolve(CONFIG_FILE).toString(); } else fileConfigPath = null; OContextConfiguration configuration = storage.getConfiguration().getContextConfiguration(); enable = configuration.getValueAsBoolean(OGlobalConfiguration.COMMAND_CACHE_ENABLED); minExecutionTime = configuration.getValueAsInteger(OGlobalConfiguration.COMMAND_CACHE_MIN_EXECUTION_TIME); maxResultsetSize = configuration.getValueAsInteger(OGlobalConfiguration.COMMAND_CACHE_MAX_RESULSET_SIZE); initCache(); }
public OChannelBinary(final Socket iSocket, final OContextConfiguration iConfig) throws IOException { super(iSocket, iConfig); maxChunkSize = iConfig.getValueAsInteger(OGlobalConfiguration.NETWORK_BINARY_MAX_CONTENT_LENGTH); debug = iConfig.getValueAsBoolean(OGlobalConfiguration.NETWORK_BINARY_DEBUG); buffer = new byte[maxChunkSize]; if (debug) OLogManager.instance().info(this, "%s - Connected", socket.getRemoteSocketAddress()); }
public ODatabasePoolImpl(OrientDBInternal factory, String database, String user, String password, OrientDBConfig config) { int max = config.getConfigurations().getValueAsInteger(DB_POOL_MAX); // TODO use configured max pool = new OResourcePool(max, new OResourcePoolListener<Void, ODatabaseDocumentInternal>() { @Override public ODatabaseDocumentInternal createNewResource(Void iKey, Object... iAdditionalArgs) { return factory.poolOpen(database, user, password, ODatabasePoolImpl.this); } @Override public boolean reuseResource(Void iKey, Object[] iAdditionalArgs, ODatabaseDocumentInternal iValue) { if (iValue.getStorage().isClosed()) { return false; } iValue.reuse(); return true; } }); this.factory = factory; this.config = config; }
public OLocalPaginatedStorage(final String name, final String filePath, final String mode, final int id, OReadCache readCache, OClosableLinkedContainer<Long, OFileClassic> files, final long walMaxSegSize) throws IOException { super(name, filePath, mode, id); this.walMaxSegSize = walMaxSegSize; this.files = files; this.readCache = readCache; String sp = OSystemVariableResolver.resolveSystemVariables(OFileUtils.getPath(new File(url).getPath())); storagePath = Paths.get(OIOUtils.getPathFromDatabaseName(sp)); variableParser = new OStorageVariableParser(storagePath); configuration = new OStorageConfigurationSegment(this); DELETE_MAX_RETRIES = getConfiguration().getContextConfiguration().getValueAsInteger(OGlobalConfiguration.FILE_DELETE_RETRY); DELETE_WAIT_TIME = getConfiguration().getContextConfiguration().getValueAsInteger(OGlobalConfiguration.FILE_DELETE_DELAY); dirtyFlag = new OPaginatedStorageDirtyFlag(storagePath.resolve("dirty.fl")); }
@Override public void config(final OServer server, OServerParameterConfiguration[] iParams) { graphPoolMax = server.getContextConfiguration().getValueAsInteger(OGlobalConfiguration.DB_POOL_MAX); for (OServerParameterConfiguration param : iParams) { if (param.name.equalsIgnoreCase("enabled")) { if (!Boolean.parseBoolean(param.value)) // DISABLE IT return; } else if (param.name.equalsIgnoreCase("graph.pool.max")) graphPoolMax = Integer.parseInt(param.value); } if (OGremlinHelper.isGremlinAvailable()) { enabled = true; OLogManager.instance() .info(this, "Installed GREMLIN language v.%s - graph.pool.max=%d", OGremlinHelper.getEngineVersion(), graphPoolMax); Orient.instance().getScriptManager().registerInjection(this); } else enabled = false; this.server = server; }
if (iDatabaseName != null) serverURL += "/" + iDatabaseName; socketTimeout = iConfig.getValueAsInteger(OGlobalConfiguration.NETWORK_SOCKET_TIMEOUT);
try { Thread.sleep(1 + new Random() .nextInt(getDatabase().getConfiguration().getValueAsInteger(OGlobalConfiguration.SEQUENCE_RETRY_DELAY))); } catch (InterruptedException ignored) { Thread.currentThread().interrupt();
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(); } }
sizePercent = config.getValueAsInteger(OGlobalConfiguration.WAL_MAX_SEGMENT_SIZE_PERCENT); } else { sizePercent = OGlobalConfiguration.WAL_MAX_SEGMENT_SIZE_PERCENT.getValueAsInteger();
+ "The minimal required space is " + (lowDiskSpace.requiredSpace / (1024 * 1024)) + " MB. " + "Required space is now set to " + configuration.getContextConfiguration() .getValueAsInteger(OGlobalConfiguration.DISK_CACHE_FREE_SPACE_LIMIT) + "MB (you can change it by setting parameter " + OGlobalConfiguration.DISK_CACHE_FREE_SPACE_LIMIT.getKey() + ") .");
getDatabase().getConfiguration().getValueAsInteger(OGlobalConfiguration.QUERY_PARALLEL_RESULT_QUEUE_SIZE) - 1;
public OSharedContextEmbedded(OStorage storage) { schema = new OSchemaEmbedded(this); security = OSecurityManager.instance().newSecurity(); indexManager = new OIndexManagerShared(storage); functionLibrary = new OFunctionLibraryImpl(); scheduler = new OSchedulerImpl(); sequenceLibrary = new OSequenceLibraryImpl(); liveQueryOps = new OLiveQueryHook.OLiveQueryOps(); liveQueryOpsV2 = new OLiveQueryHookV2.OLiveQueryOps(); commandCache = new OCommandCacheSoftRefs(storage.getUnderlying()); statementCache = new OStatementCache( storage.getConfiguration().getContextConfiguration().getValueAsInteger(OGlobalConfiguration.STATEMENT_CACHE_SIZE)); executionPlanCache = new OExecutionPlanCache( storage.getConfiguration().getContextConfiguration().getValueAsInteger(OGlobalConfiguration.STATEMENT_CACHE_SIZE)); this.registerListener(executionPlanCache); queryStats = new OQueryStats(); activeDistributedQueries = new HashMap<>(); ((OAbstractPaginatedStorage) storage).setStorageConfigurationUpdateListener(update -> { for (OMetadataUpdateListener listener : browseListeners()) { listener.onStorageConfigurationUpdate(storage.getName(), update); } }); }