@Override public String toString() { return super.toString()+ ", min-threads="+getCorePoolSize()+ ", max-threads="+getMaximumPoolSize()+ ", max-queue-size="+getMaxQueuedTasksCount(); }
final Object newValueReference(V value, ReferenceType valueType, ReferenceQueue<Object> refQueue) { if (valueType == ReferenceType.WEAK) return new WeakValueReference<V>(value, keyRef, hash, refQueue); if (valueType == ReferenceType.SOFT) return new SoftValueReference<V>(value, keyRef, hash, refQueue); return value; }
public Thread newThread(Runnable r) { return new WorkerThreadImpl(AbstractThreadPool.this, getName() + "-WorkerThread(" + nextThreadId() + ")", r, getInitialByteBufferSize()); } };
/** * Creates {@link InputReader} */ protected InputReader createInputReader() { return new InputReader( ByteBufferFactory.allocateView(bbSize,false)); }
@Override protected void reset() { if (threadAttachment != null) { /** * ThreadAttachment was created during prev. processing and wasn't * detached. It could happen due to some error - we need to release * the ThreadAttachment association with the current thread */ threadAttachment.deassociate(); } threadAttachment = null; super.reset(); } }
@Override public String toString() { return super.toString()+ ", min-threads="+getCorePoolSize()+ ", max-threads="+getMaximumPoolSize(); } }
/** * @deprecated please use {@link GrizzlyExecutorService#reconfigure(com.sun.grizzly.util.ThreadPoolConfig)} * to change thread pool configuration settings. */ public void setPriority(int priority) { reconfigure(getConfiguration().setPriority(priority)); }
/** * {@inheritDoc} * * @throws NullPointerException if the specified key is null */ public boolean remove(Object key, Object value) { int hash = hashOf(key); if (value == null) return false; return segmentFor(hash).remove(key, hash, value, false) != null; }
/** * Tests if the specified object is a key in this table. * * @param key possible key * @return <tt>true</tt> if and only if the specified object * is a key in this table, as determined by the * <tt>equals</tt> method; <tt>false</tt> otherwise. * @throws NullPointerException if the specified key is null */ public boolean containsKey(Object key) { int hash = hashOf(key); return segmentFor(hash).containsKey(key, hash); }
public void run() { try { onWorkerStarted(this);//inside try, to ensure balance doWork(); } finally { onWorkerExit(this); } }
final Object newKeyReference(K key, ReferenceType keyType, ReferenceQueue<Object> refQueue) { if (keyType == ReferenceType.WEAK) return new WeakKeyReference<K>(key, hash, refQueue); if (keyType == ReferenceType.SOFT) return new SoftKeyReference<K>(key, hash, refQueue); return key; }
/** * Must hold statelock while calling this method. * @param wt */ private void doStartWorker() { startWorker(new BasicWorker()); expectedWorkerCount++; }
public void start() { synchronized(statelock) { while (currentPoolSize < corePoolSize) { startWorker(new SyncThreadWorker(true)); } } }
/** * Creates {@link InputReader} */ protected InputReader createByteBufferInputStream() { return new InputReader( ByteBufferFactory.allocateView(bbSize,false)); } }
@Override protected void reset() { if (threadAttachment != null) { /** * ThreadAttachment was created during prev. processing and wasn't * detached. It could happen due to some error - we need to release * the ThreadAttachment association with the current thread */ threadAttachment.deassociate(); } threadAttachment = null; super.reset(); } }
/** * Removes the key (and its corresponding value) from this map. * This method does nothing if the key is not in the map. * * @param key the key that needs to be removed * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt> * @throws NullPointerException if the specified key is null */ public V remove(Object key) { int hash = hashOf(key); return segmentFor(hash).remove(key, hash, null, false); }