public OAbstractProfiler(boolean registerListener) { if (registerListener) { Orient.instance().registerWeakOrientStartupListener(this); } }
public OAbstractProfiler(final OAbstractProfiler profiler) { hooks.putAll(profiler.hooks); dictionary.putAll(profiler.dictionary); types.putAll(profiler.types); Orient.instance().registerWeakOrientStartupListener(this); }
public OReentrantResourcePool(final int maxResources, final OResourcePoolListener<K, V> listener) { super(maxResources, listener); Orient.instance().registerWeakOrientShutdownListener(this); Orient.instance().registerWeakOrientStartupListener(this); }
private OSBTreeCollectionManagerAbstract(ConcurrentLinkedHashMap<CacheKey, SBTreeBonsaiContainer> treeCache, OStorage storage, int evictionThreshold, int cacheMaxSize, Object[] locks) { this.treeCache = treeCache; this.storage = storage; this.evictionThreshold = evictionThreshold; this.cacheMaxSize = cacheMaxSize; if (locks == null) { final int concurrencyLevel = Runtime.getRuntime().availableProcessors() * 8; int size = 1; int shifted = 0; while (size < concurrencyLevel) { size <<= 1; shifted++; } shift = 32 - shifted; mask = size - 1; locks = new Object[size]; for (int i = 0; i < locks.length; i++) { locks[i] = new Object(); } } else { shift = GLOBAL_SHIFT; mask = GLOBAL_MASK; } this.locks = locks; Orient.instance().registerWeakOrientStartupListener(this); Orient.instance().registerWeakOrientShutdownListener(this); }
public OPartitionedDatabasePool(String url, String userName, String password, int maxPartitionSize, int maxPoolSize) { this.url = url; this.userName = userName; this.password = password; if (maxPoolSize > 0) { connectionsCounter = new Semaphore(maxPoolSize); this.maxPartitions = 1; this.maxPartitonSize = maxPoolSize; } else { this.maxPartitonSize = maxPartitionSize; connectionsCounter = null; } final PoolPartition[] pts = new PoolPartition[maxPartitions]; for (int i = 0; i < pts.length; i++) { final PoolPartition partition = new PoolPartition(); pts[i] = partition; initQueue(url, partition); } partitions = pts; Orient.instance().registerWeakOrientStartupListener(this); Orient.instance().registerWeakOrientShutdownListener(this); }
public OPartitionedObjectPool(final ObjectFactory factory, final int maxSize, final int maxPartitions) { this.factory = factory; this.maxSize = maxSize; this.maxPartitions = maxPartitions; final PoolPartition[] pts = new PoolPartition[maxPartitions < 2 ? maxPartitions : 2]; for (int i = 0; i < pts.length; i++) { final PoolPartition partition = new PoolPartition(); pts[i] = partition; initQueue(partition); } partitions = pts; Orient.instance().registerWeakOrientStartupListener(this); Orient.instance().registerWeakOrientShutdownListener(this); }
public OPartitionedObjectPoolFactory(final ObjectFactoryFactory<K, T> objectFactoryFactory, final int capacity) { this.objectFactoryFactory = objectFactoryFactory; poolStore = new ConcurrentLinkedHashMap.Builder<K, OPartitionedObjectPool<T>>().maximumWeightedCapacity(capacity) .listener(evictionListener).build(); Orient.instance().registerWeakOrientStartupListener(this); Orient.instance().registerWeakOrientShutdownListener(this); }
public OPartitionedDatabasePoolFactory(final int capacity) { poolStore = new ConcurrentLinkedHashMap.Builder<PoolIdentity, OPartitionedDatabasePool>().maximumWeightedCapacity(capacity) .listener(evictionListener).build(); Orient.instance().registerWeakOrientStartupListener(this); Orient.instance().registerWeakOrientShutdownListener(this); }
registerWeakOrientStartupListener(profiler); } finally { engineLock.writeLock().unlock();