Reputation: 7617
What is the purpose of thisThread created after all the gui components are initialised? The first few lines are typical boiler plate code when a new GUI is started, but I'm struggling to understand why this thread is started. Found this in an open source project, and I'm wondering why someone would do this.
public static void main( String args[] ) {
java.awt.EventQueue.invokeLater( new Runnable() {
public void run(){
// initialises gui components
new SchemaRegistrationVisualizer();
final Thread thisThread = new Thread( new Runnable(){
public void run(){
long startTime = System.currentTimeMillis();
while( System.currentTimeMillis() - startTime < Math.pow( 10, 5 ) );
System.exit( 0 );
}
});
thisThread.setPriority( Thread.MAX_PRIORITY ); thisThread.start();
}
});
}
Upvotes: 0
Views: 82
Reputation: 1481
Upvotes: 1
Reputation: 691993
Well, it creates a busy loop that makes one of the CPU cores of the machine go to 100% for 100 seconds, and then exits the JVM.
Upvotes: 4