Record Class ThreadExecutor
java.lang.Object
java.lang.Record
com.iohao.net.common.kit.concurrent.executor.ThreadExecutor
- Record Components:
name- Thread executor nameexecutor- Thread executorthreadNo- Number
-
Constructor Summary
ConstructorsConstructorDescriptionThreadExecutor(String name, Executor executor, int threadNo) Creates an instance of aThreadExecutorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.voidExecutes the given command at some time in the future.voidexecuteTry(Runnable command) Executes the given command at some time in the future.executor()Returns the value of theexecutorrecord component.intfinal inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.intthreadNo()Returns the value of thethreadNorecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ThreadExecutor
-
-
Method Details
-
execute
Executes the given command at some time in the future.Note that developers need to catch exceptions within the command themselves (in other words, do not let the Runnable throw an exception during execution), otherwise it may cause executor thread corruption, making the thread unusable. If you are unsure whether the Runnable will throw an exception during execution, consider using the executeTry method.
- Parameters:
command- Command- See Also:
-
executeTry
Executes the given command at some time in the future.- Parameters:
command- Command
-
getWorkQueue
public int getWorkQueue() -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
-
executor
-
threadNo
-