public class ThreadsInfo extends java.lang.Object implements Poolable<ThreadsInfo>
| Modifier and Type | Field and Description |
|---|---|
private long |
currentInstanceId
Stores the current instance identifier (
0 means none). |
private long |
currentThreadId
Stores the id of the (initially) creating thread.
|
private long |
currentThreadTicks
Stores the current time ticks of the (initially) creating thread.
|
static ObjectPool<ThreadsInfo> |
POOL
Defines an object pool for this class.
|
| Constructor and Description |
|---|
ThreadsInfo()
Creates a new thread information object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears this instance before returning it to the pool.
|
ThreadsInfo |
create()
Creates a further instance of this instances (intended as factory method
to be executed on a prototypical instance).
|
long |
getCurrentInstanceId()
Returns the current instance id.
|
long |
getCurrentThreadId()
Returns the current thread id as given in the constructor.
|
long |
getCurrentThreadTicks()
Returns the time ticks consumed by the current thread as given in the
constructor.
|
void |
read(java.io.DataInputStream in)
Reads this instance from a data input stream.
|
static ThreadsInfo |
readFromPool(java.io.DataInputStream in)
Obtains an instance from the object pool and reads the related
data from a data input stream (convenience method).
|
void |
setCurrentThreadTicks(long currentThreadTicks)
Specifies the thread time ticks to initialize (reusable)
instances.
|
void |
setIds(long currentThreadId,
long currentInstanceId)
Specifies both ids to initialize (reusable)
instances.
|
void |
setInstanceId(long currentInstanceId)
Specifies the instance id to initialize (reusable)
instances.
|
void |
setThreadId(long currentThreadId)
Specifies the thread id to initialize (reusable)
instances.
|
java.lang.String |
toString()
Returns a textual representation.
|
void |
write(java.io.DataOutputStream out)
Writes this instance to a data output stream.
|
public static final ObjectPool<ThreadsInfo> POOL
private long currentThreadTicks
private long currentThreadId
private long currentInstanceId
0 means none).ThreadsInfo()
Do not call this constructor from outside as the instances of this
class are pooled POOL!
public ThreadsInfo create()
create in interface Poolable<ThreadsInfo>public static ThreadsInfo readFromPool(java.io.DataInputStream in) throws java.io.IOException
in - the input streamjava.io.IOException - in case that an I/O error occurred while readingpublic void setThreadId(long currentThreadId)
currentThreadId - the current thread idpublic void setInstanceId(long currentInstanceId)
currentInstanceId - the current instance id (0 for disabled)public void setIds(long currentThreadId,
long currentInstanceId)
currentThreadId - the current thread idcurrentInstanceId - the current instance id (0 for disabled)public void setCurrentThreadTicks(long currentThreadTicks)
currentThreadTicks - the current thread time ticks (CPU time)public void clear()
clear in interface Poolable<ThreadsInfo>public void write(java.io.DataOutputStream out)
throws java.io.IOException
out - the output streamjava.io.IOException - in case that an I/O error occurred while writingpublic void read(java.io.DataInputStream in)
throws java.io.IOException
in - the input streamjava.io.IOException - in case that an I/O error occurred while readingpublic long getCurrentThreadTicks()
public long getCurrentThreadId()
public long getCurrentInstanceId()
0)public java.lang.String toString()
toString in class java.lang.Object