public class Util
extends java.lang.Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static long |
currentTimeMillis()
Gets the application time in milliseconds.
|
static boolean |
dynamicCodeAllowed()
Tests the ability of the system to download code through
Class.forName(String) |
static boolean |
isInInitialization()
Indicates whether the current code is part of the initialization phase.
|
static boolean |
isInMission()
Indicates whether the system has entered the mission phase, i.e.
|
static long |
platformTimeMillis()
Gets an arbitrary time in milliseconds.
|
static long |
platformTimeNanos()
Gets an arbitrary time in nanoseconds.
|
static void |
setCurrentTimeMillis(java.util.Date d)
Sets the application time.
|
static void |
setCurrentTimeMillis(long t)
Sets the application time.
|
static void |
throwExceptionInThread(java.lang.RuntimeException e,
java.lang.Thread t)
Throws an exception in a specified thread.
|
static void |
throwHardExceptionInThread(java.lang.RuntimeException e,
java.lang.Thread t)
Throws an exception in a specified thread.
|
public static boolean isInMission()
true
if the initialization is doneImmortals
public static boolean isInInitialization()
When Class.forName(String)
triggers classes to be loaded at runtime
dynamically, class initializations are done in a context where isInInitialization()
is
true
and isInMission()
is true
.
true
if the initialization is ongoingImmortals
public static boolean dynamicCodeAllowed()
Class.forName(String)
true
if the system allows dynamic code to be loaded, false
otherwisepublic static void throwExceptionInThread(java.lang.RuntimeException e, java.lang.Thread t)
throwExceptionInThread(RuntimeException, Thread)
or throwHardExceptionInThread(RuntimeException, Thread)
is already pending for the thread, nothing is done.null
, an IllegalArgumentException
is
thrown.e
- the exception to throwt
- the thread in which the exception is thrownjava.lang.IllegalArgumentException
- if any of the arguments is null
.public static void throwHardExceptionInThread(java.lang.RuntimeException e, java.lang.Thread t)
throwHardExceptionInThread(RuntimeException, Thread)
is already pending for the thread, nothing is done.throwExceptionInThread(RuntimeException, Thread)
is already pending for the thread, this exception is replaced by the
given exception.e
- the exception to throwt
- the thread in which the exception is thrownjava.lang.IllegalArgumentException
- if any of the arguments is null
.public static long currentTimeMillis()
Gets the application time in milliseconds.
The result of this method is the same as the System.currentTimeMillis()
method one.
public static long platformTimeMillis()
Gets an arbitrary time in milliseconds.
Only elapsed time between two calls is meaningful.
public static long platformTimeNanos()
Gets an arbitrary time in nanoseconds.
Only elapsed time between two calls is meaningful.
public static void setCurrentTimeMillis(long t)
Sets the application time.
This time does not change the platform time.
t
- the application time to set in millisecondsjava.lang.IllegalArgumentException
- if t
is negativepublic static void setCurrentTimeMillis(java.util.Date d)
Sets the application time.
This time does not change the platform time.
The Util.setCurrentTimeMillis(d)
method has the same effect as Util.setCurrentTimeMillis(d.getTime())
.
d
- the application time to set