Package org.apache.ignite.thread
Class IgniteThread
- java.lang.Object
- 
- java.lang.Thread
- 
- org.apache.ignite.thread.IgniteThread
 
 
- 
- All Implemented Interfaces:
- Runnable
 - Direct Known Subclasses:
- IgniteSpiThread
 
 public class IgniteThread extends Thread This class adds some necessary plumbing on top of theThreadclass. Specifically, it adds:- Consistent naming of threads
- Dedicated parent thread group
- Backing interrupted flag
- Name of the grid this thread belongs to
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class java.lang.ThreadThread.State, Thread.UncaughtExceptionHandler
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static intGRP_IDX_UNASSIGNEDIndex for unassigned thread.protected StringigniteInstanceNameThe name of the Ignite instance this thread belongs to.- 
Fields inherited from class java.lang.ThreadMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description IgniteThread(String igniteInstanceName, String threadName)Creates grid thread with given name for a given Ignite instance.IgniteThread(String igniteInstanceName, String threadName, Runnable r)Creates grid thread with given name for a given Ignite instance.IgniteThread(String igniteInstanceName, String threadName, Runnable r, int grpIdx, int stripe, byte plc)Creates grid thread with given name for a given Ignite instance with specified thread group.protectedIgniteThread(String igniteInstanceName, ThreadGroup threadGrp, String threadName)IgniteThread(org.apache.ignite.internal.util.worker.GridWorker worker)Creates thread with given worker.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancachePoolThread()intcompositeRwLockIndex()voidcompositeRwLockIndex(int compositeRwLockIdx)protected static StringcreateName(long num, String threadName, String igniteInstanceName)Creates new thread name.static IgniteThreadcurrent()static booleancurrentThreadCanRequestBinaryMetadata()StringgetIgniteInstanceName()Gets name of the Ignite instance this thread belongs to.booleanisForbiddenToRequestBinaryMetadata()static voidonEntryProcessorEntered(boolean holdsTopLock)Callback before entry processor execution is started.static voidonEntryProcessorLeft()Callback after entry processor execution is finished.static voidonForbidBinaryMetadataRequestSectionEntered()Callback on entering critical section where binary metadata requests are forbidden.static voidonForbidBinaryMetadataRequestSectionLeft()Callback on leaving critical section where binary metadata requests are forbidden.bytepolicy()intstripe()StringtoString()- 
Methods inherited from class java.lang.ThreadactiveCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
 
- 
 
- 
- 
- 
Field Detail- 
GRP_IDX_UNASSIGNEDpublic static final int GRP_IDX_UNASSIGNED Index for unassigned thread.- See Also:
- Constant Field Values
 
 - 
igniteInstanceNameprotected final String igniteInstanceName The name of the Ignite instance this thread belongs to.
 
- 
 - 
Constructor Detail- 
IgniteThreadpublic IgniteThread(org.apache.ignite.internal.util.worker.GridWorker worker) Creates thread with given worker.- Parameters:
- worker- Runnable to create thread with.
 
 - 
IgniteThreadpublic IgniteThread(String igniteInstanceName, String threadName) Creates grid thread with given name for a given Ignite instance.- Parameters:
- igniteInstanceName- Name of the Ignite instance this thread is created for.
- threadName- Name of thread.
 
 - 
IgniteThreadpublic IgniteThread(String igniteInstanceName, String threadName, Runnable r) Creates grid thread with given name for a given Ignite instance.- Parameters:
- igniteInstanceName- Name of the Ignite instance this thread is created for.
- threadName- Name of thread.
- r- Runnable to execute.
 
 - 
IgniteThreadpublic IgniteThread(String igniteInstanceName, String threadName, Runnable r, int grpIdx, int stripe, byte plc) Creates grid thread with given name for a given Ignite instance with specified thread group.- Parameters:
- igniteInstanceName- Name of the Ignite instance this thread is created for.
- threadName- Name of thread.
- r- Runnable to execute.
- plc-- GridIoPolicypolicy.
- grpIdx- Thread index within a group.
- stripe- Non-negative stripe number if this thread is striped pool thread.
 
 - 
IgniteThreadprotected IgniteThread(String igniteInstanceName, ThreadGroup threadGrp, String threadName) - Parameters:
- igniteInstanceName- Name of the Ignite instance this thread is created for.
- threadGrp- Thread group.
- threadName- Name of thread.
 
 
- 
 - 
Method Detail- 
policypublic byte policy() - Returns:
- Related GridIoPolicyfor internal Ignite pools.
 
 - 
stripepublic int stripe() - Returns:
- Non-negative stripe number if this thread is striped pool thread.
 
 - 
cachePoolThreadpublic boolean cachePoolThread() - Returns:
- Trueif thread belongs to pool processing cache operations.
 
 - 
getIgniteInstanceNamepublic String getIgniteInstanceName() Gets name of the Ignite instance this thread belongs to.- Returns:
- Name of the Ignite instance this thread belongs to.
 
 - 
compositeRwLockIndexpublic int compositeRwLockIndex() - Returns:
- Composite RW lock index.
 
 - 
compositeRwLockIndexpublic void compositeRwLockIndex(int compositeRwLockIdx) - Parameters:
- compositeRwLockIdx- Composite RW lock index.
 
 - 
isForbiddenToRequestBinaryMetadatapublic boolean isForbiddenToRequestBinaryMetadata() - Returns:
- Trueif thread is not allowed to request binary metadata to avoid potential deadlock.
 
 - 
currentThreadCanRequestBinaryMetadatapublic static boolean currentThreadCanRequestBinaryMetadata() - Returns:
- Trueif thread is not allowed to request binary metadata to avoid potential deadlock.
 
 - 
onEntryProcessorEnteredpublic static void onEntryProcessorEntered(boolean holdsTopLock) Callback before entry processor execution is started.- Parameters:
- holdsTopLock- Whether to hold topology lock.
 
 - 
onEntryProcessorLeftpublic static void onEntryProcessorLeft() Callback after entry processor execution is finished.
 - 
onForbidBinaryMetadataRequestSectionEnteredpublic static void onForbidBinaryMetadataRequestSectionEntered() Callback on entering critical section where binary metadata requests are forbidden.
 - 
onForbidBinaryMetadataRequestSectionLeftpublic static void onForbidBinaryMetadataRequestSectionLeft() Callback on leaving critical section where binary metadata requests are forbidden.
 - 
currentpublic static IgniteThread current() - Returns:
- IgniteThread or nullif current thread is not an instance of IgniteThread.
 
 - 
createNameprotected static String createName(long num, String threadName, String igniteInstanceName) Creates new thread name.- Parameters:
- num- Thread number.
- threadName- Thread name.
- igniteInstanceName- Ignite instance name.
- Returns:
- New thread name.
 
 
- 
 
-