Java thread WAIT(400).. using NetBeans 6.0

Hi everyone, can someone please help me! Im trying to make something look like a 'loading' bar but I cant
get this to wait(200)... like for ex:
I want to ProgressBar1, to load up like 10% and then wait 4 seconds, and load up to 40% but Im not sure how to wait! Look at my code below and please help:
Look at comments towards middle of the script!
Please help! -- Thanks
package my.numberaddition;
public class NumberAdditionUI extends javax.swing.JFrame{
public NumberAdditionUI() {
initComponents();
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jProgressBar1.setValue(0);
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
float num1,num2,result;
num1 = Float.parseFloat(jTextField1.getText());
num2 = Float.parseFloat(jTextField2.getText());
result = num1 + num2;
jTextField3.setText(String.valueOf(result));
jProgressBar1.setValue(40);
jLabel3.setText("Stablizing");
Thread.currentThread().sleep(4000); //This is where it should wait!
jLabel3.setText("Loading Graphics");
jProgressBar1.setValue(60);
Thread.currentThread().sleep(4000); //And here!
jProgressBar1.setValue(95);
jLabel3.setText("Loading..");
Thread.currentThread().sleep(2000; ///And finally here
jProgressBar1.setValue(100);
jLabel3.setText("Loaded");
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NumberAdditionUI().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration
}

I want to ProgressBar1, to load up like 10% and then wait 4 seconds, and load up to 40%Why? Why not have it show the actual progress, in the actual time that it took?
In other words, just update the ProgressBar every time you get to a significant point. Forget the waiting, make the 'progress' instead.

Similar Messages

  • Thread waits and locks using Solaris 8 T1 threads

    Hi,
    I have got a problem relating to Webmethods running on JVM Hot Spot server VM (1.4.2_07-b05 mixed mode).
    From time to time the webmethods applications seems to slow down and completely lock up with the mpstat on solaris showing:
    1. context switching increases (csw)
    2. spin on mutexes also show approximately 25 % increase (smtx)
    The only way i could overcome this problem is to kill the process - which incidentally produces a thread dump. Incidentally i have also done a pstack on the process.
    The thread dump shows among other things alots of object waits, with locks on objects in an object Pool. The main process is in a waiting state on object, locked by itself, similarly other thread deamon are also in a waiting state on objects which itself has locked. Seems rather wierd (dont understand that).
    Anyway we are on Solaris 8 -using the T1 solaris thread library. My question is whether we need to move to T2 solaris thread library and use the option of -XX:-UseLWPSynchronization on JVM would help in the long run. As i am quire new to the JVM Hot Spot (excuse my lack of knowledge in this sphere), i am also posting the thread dump or parts of it here - I am reading them as dead locks but i could be wrong, would also appreciate some help on this matter to clarify what i am reading:
    "IS <ENERGYAUST#wm.ip.ebxml.MSH:process>" prio=5 tid=0x00a2e570 nid=0x12c in Object.wait() [63f7e000..63f819c0]
         at java.lang.Object.wait(Native Method)
         at java.lang.Object.wait(Object.java:429)
         at com.wm.util.pool.ObjectPool.allocate(ObjectPool.java:248)
         - locked <0x97835bf8> (a java.lang.Object)
         at com.wm.util.pool.ObjectPool.allocate(ObjectPool.java:191)
         at com.wm.app.b2b.server.ThreadManager.runTarget(ThreadManager.java:83)
         at com.wm.app.b2b.server.ThreadManager.runTarget(ThreadManager.java:62)
         at com.wm.app.b2b.server.control.ControlledThreadPool.runTarget(ControlledThreadPool.java:359)
         at wm.ip.ebxml.coder.util.getEnvelopeStream(util.java:588)
         at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:322)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:113)
         at com.wm.app.b2b.server.Service.doInvoke(Service.java:635)
         at com.wm.app.b2b.server.Service.doInvoke(Service.java:584)
         at com.wm.app.tn.route.RoutingActions.invokeWrapper(RoutingActions.java:959)
         at com.wm.app.tn.route.RoutingActions.invoke(RoutingActions.java:827)
         at wm.tn.route.route(route.java:750)
         at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:322)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:113)
         at com.wm.app.b2b.server.Service.doInvoke(Service.java:635)
         at com.wm.app.b2b.server.Service.doInvoke(Service.java:584)
         at wm.ip.ebxml.Receiver.processMessage(Receiver.java:588)
         at wm.ip.ebxml.Receiver.process(Receiver.java:186)
         at wm.ip.ebxml.MSH.process(MSH.java:165)
         at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:322)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:113)
         at com.wm.app.b2b.server.ServiceThread.run(ServiceThread.java:82)
         - locked <0xbb1b42e0> (a com.wm.app.b2b.server.ServiceThread)
         at com.wm.util.pool.PooledThread.run(PooledThread.java:105)
         - locked <0x9ad44eb8> (a com.wm.app.b2b.server.TMPooledThread)
         at java.lang.Thread.run(Thread.java:534)
    "IS <ENERGYAUST#wm.ip.ebxml.MSH:process>" prio=5 tid=0x00a2d980 nid=0x12b in Object.wait() [6407e000..640819c0]
         at java.lang.Object.wait(Native Method)
         at java.lang.Object.wait(Object.java:429)
         at com.wm.util.pool.ObjectPool.allocate(ObjectPool.java:248)
         - locked <0x97835bf8> (a java.lang.Object)
         at com.wm.util.pool.ObjectPool.allocate(ObjectPool.java:191)
         at com.wm.app.b2b.server.ThreadManager.runTarget(ThreadManager.java:83)
         at com.wm.app.b2b.server.ThreadManager.runTarget(ThreadManager.java:62)
         at com.wm.app.b2b.server.control.ControlledThreadPool.runTarget(ControlledThreadPool.java:359)
         at wm.ip.ebxml.coder.util.getEnvelopeStream(util.java:588)
         at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:322)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:113)
         at com.wm.app.b2b.server.Service.doInvoke(Service.java:635)
         at com.wm.app.b2b.server.Service.doInvoke(Service.java:584)
         at com.wm.app.tn.route.RoutingActions.invokeWrapper(RoutingActions.java:959)
         at com.wm.app.tn.route.RoutingActions.invoke(RoutingActions.java:827)
         at wm.tn.route.route(route.java:750)
         at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:322)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:168)
         at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324)
         at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:581)
         at com.wm.lang.flow.FlowState.step(FlowState.java:438)
         at com.wm.lang.flow.FlowState.invoke(FlowState.java:403)
         at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:982)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:113)
         at com.wm.app.b2b.server.Service.doInvoke(Service.java:635)
         at com.wm.app.b2b.server.Service.doInvoke(Service.java:584)
         at wm.ip.ebxml.Receiver.processMessage(Receiver.java:588)
         at wm.ip.ebxml.Receiver.process(Receiver.java:186)
         at wm.ip.ebxml.MSH.process(MSH.java:165)
         at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:322)
         at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:612)
         at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
         at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:226)
         at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
         at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:198)
         at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:39)
         at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:411)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:521)
         at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:369)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:246)
         at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:113)
         at com.wm.app.b2b.server.ServiceThread.run(ServiceThread.java:82)
         - locked <0xbb1b4410> (a com.wm.app.b2b.server.ServiceThread)
         at com.wm.util.pool.PooledThread.run(PooledThread.java:105)
         - locked <0x9ad44f30> (a com.wm.app.b2b.server.TMPooledThread)
         at java.lang.Thread.run(Thread.java:534)
    "AuditRejectHandler" daemon prio=5 tid=0x009b23c8 nid=0x23 in Object.wait() [73681000..736819c0]
         at java.lang.Object.wait(Native Method)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:74)
         - locked <0x97800e18> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.app.store.impl.TSSimpleQueue._waitForMessage(TSSimpleQueue.java:585)
         at com.wm.app.store.impl.TSSimpleQueue.getWait(TSSimpleQueue.java:464)
         at com.wm.app.store.impl.TSSimpleQueueConsumer.getWait(TSSimpleQueueConsumer.java:37)
         at com.wm.app.audit.AuditFactory$AuditRejectHandler.run(AuditFactory.java:1646)
    "AuditRetryHandler" daemon prio=5 tid=0x007bc5c8 nid=0x22 in Object.wait() [73781000..737819c0]
         at java.lang.Object.wait(Native Method)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:74)
         - locked <0x97800ed0> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.app.store.impl.TSSimpleQueue._waitForMessage(TSSimpleQueue.java:585)
         at com.wm.app.store.impl.TSSimpleQueue.getWait(TSSimpleQueue.java:464)
         at com.wm.app.store.impl.TSSimpleQueueConsumer.getWait(TSSimpleQueueConsumer.java:37)
         at com.wm.app.audit.AuditFactory$RetryHandler.run(AuditFactory.java:1495)
    "AuditExceptionHandler" daemon prio=5 tid=0x009b1e30 nid=0x21 in Object.wait() [73881000..738819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x97800f90> (a com.wm.util.sync.CountingSemaphore)
         at java.lang.Object.wait(Object.java:429)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:71)
         - locked <0x97800f90> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:56)
         - locked <0x97800f90> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.app.audit.AuditFactory$ExceptionHandler.run(AuditFactory.java:1410)
    "AuditProducer0" daemon prio=5 tid=0x009bb4e8 nid=0x20 in Object.wait() [73a81000..73a819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x97801000> (a com.wm.util.sync.CountingSemaphore)
         at java.lang.Object.wait(Object.java:429)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:71)
         - locked <0x97801000> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.app.store.impl.TSSimpleQueue._waitForMessage(TSSimpleQueue.java:585)
         at com.wm.app.store.impl.TSSimpleQueue.getWait(TSSimpleQueue.java:464)
         at com.wm.app.store.impl.TSSimpleQueueConsumer.getWait(TSSimpleQueueConsumer.java:37)
         at com.wm.app.audit.AuditFactory$AuditProducerHandler.run(AuditFactory.java:1576)
    "TS-EventHandler" daemon prio=5 tid=0x005c1d20 nid=0x1f in Object.wait() [73981000..739819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x978010c8> (a com.wm.util.sync.LatchedSemaphore)
         at java.lang.Object.wait(Object.java:429)
         at com.wm.util.sync.LatchedSemaphore.semWait(LatchedSemaphore.java:54)
         - locked <0x978010c8> (a com.wm.util.sync.LatchedSemaphore)
         at com.wm.util.sync.LatchedSemaphore.semWaitReset(LatchedSemaphore.java:101)
         - locked <0x978010c8> (a com.wm.util.sync.LatchedSemaphore)
         at com.wm.app.store.TransientStoreFactory$NotifyHandler.run(TransientStoreFactory.java:2173)
    "FSData Free Cache Handler" daemon prio=5 tid=0x006eca38 nid=0x1d in Object.wait() [73b81000..73b819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x97801130> (a com.wm.util.sync.CountingSemaphore)
         at java.lang.Object.wait(Object.java:429)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:71)
         - locked <0x97801130> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:56)
         - locked <0x97801130> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.driver.data.fs.FSData$FreeCacheHandler.run(FSData.java:3976)
    "Thread-12" daemon prio=5 tid=0x009bc0a0 nid=0x1c in Object.wait() [73c81000..73c819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x97801140> (a com.wm.app.jdbc.JDBCConnPoolMgr$ConnectionTimeoutMgr)
         at com.wm.app.jdbc.JDBCConnPoolMgr$ConnectionTimeoutMgr.run(JDBCConnPoolMgr.java:394)
         - locked <0x97801140> (a com.wm.app.jdbc.JDBCConnPoolMgr$ConnectionTimeoutMgr)
    "FSData Free Cache Handler" daemon prio=5 tid=0x006ebcf0 nid=0x1b in Object.wait() [73d81000..73d819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x978011e8> (a com.wm.util.sync.CountingSemaphore)
         at java.lang.Object.wait(Object.java:429)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:71)
         - locked <0x978011e8> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.util.sync.CountingSemaphore.semWait(CountingSemaphore.java:56)
         - locked <0x978011e8> (a com.wm.util.sync.CountingSemaphore)
         at com.wm.driver.data.fs.FSData$FreeCacheHandler.run(FSData.java:3976)
    "Thread-10" daemon prio=5 tid=0x00590d90 nid=0x1a in Object.wait() [73e81000..73e819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x978011f8> (a com.wm.app.repov4.server.RepoServer$RepoLockTimeoutMgr)
         at com.wm.app.repov4.server.RepoServer$RepoLockTimeoutMgr.run(RepoServer.java:1533)
         - locked <0x978011f8> (a com.wm.app.repov4.server.RepoServer$RepoLockTimeoutMgr)
    "Thread-9" daemon prio=5 tid=0x000e9f48 nid=0x19 in Object.wait() [74081000..740819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x978012b0> (a com.wm.driver.queue.data.DataQueue)
         at java.lang.Object.wait(Object.java:429)
         at com.wm.driver.queue.data.DataQueue.dequeue(DataQueue.java:310)
         - locked <0x978012b0> (a com.wm.driver.queue.data.DataQueue)
         at com.wm.driver.queue.data.DataQueue.dequeueCommit(DataQueue.java:260)
         - locked <0x978012b0> (a com.wm.driver.queue.data.DataQueue)
         at com.wm.driver.queue.data.DataQueue.dequeueCommit(DataQueue.java:254)
         - locked <0x978012b0> (a com.wm.driver.queue.data.DataQueue)
         at com.wm.app.repov4.server.RepoServerBase$RepoEventManager.run(RepoServerBase.java:224)
    "TxnData-Deadlock-Manager" daemon prio=5 tid=0x00799c18 nid=0x14 in Object.wait() [73f81000..73f819c0]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x97801338> (a java.lang.Object)
         at com.wm.util.data.TxnData$DeadlockManager.run(TxnData.java:4945)
         - locked <0x97801338> (a java.lang.Object)
    "Thread-2" daemon prio=5 tid=0x00104430 nid=0x12 in Object.wait() [74181000..741819c0]
         at java.lang.Object.wait(Native Method)
         at com.wm.util.queue.FSMTDirValuesHash$VHLockTimeoutMgr.run(FSMTDirValuesHash.java:448)
         - locked <0x978013b0> (a com.wm.util.queue.FSMTDirValuesHash$VHLockTimeoutMgr)
    "Log Thread" prio=5 tid=0x002e9f10 nid=0x11 in Object.wait() [74281000..742819c0]
         at java.lang.Object.wait(Native Method)
         at com.wm.util.sync.SimpleQueue.deq(SimpleQueue.java:171)
         - locked <0x97801458> (a com.wm.util.sync.SimpleQueue)
         at com.wm.util.sync.SimpleQueue.deq(SimpleQueue.java:126)
         - locked <0x97801458> (a com.wm.util.sync.SimpleQueue)
         at com.wm.app.b2b.server.ServerLogHandler$LogThread.run(ServerLogHandler.java:274)
    "Cron

    Hi,
    I've just found the following in another thread:
    The workaround for the bugID 6221832 (java being in another path than the default /usr/j2se/bin/ for Patch Manager 2.0 on Solaris 8) is to edit the pprosetup and pprosvc scripts
    from /usr/sbin/pprosvc :
    JAVACMD=/usr/j2se/bin/java
    edit pprosetup and pprosvc scripts file and set JAVACMD locale variable to newly java installed path and launch smpatch get command again
    Thank you. I've editted both scripts and changed the JAVACMD variable to be ${JAVA_HOME}/bin/java and now everything is working.
    Thanks.

  • How to use Java threads in ColdFusion

    Hello Everybody,
    I have a question in concerns to threads. We all know that in
    CF8 we have this fantastic tag called <cfthread> which give
    us the ability to create assyncronous code, however, I was
    concerned about earlier versions of ColdFusion, like CF7 and CF
    6.1.
    How can I create a Java thread and use it in my CF code?
    Please, any help is much appreciated. Thanks in advance.
    Alvaro Costa
    Systems Analyst
    [email protected]

    A bean is obtain by <jsp:useBean> tag nd once bean is obtained we can get its property by using getProperty tag.

  • Use java thread? or Oracle DB scheduler?

    I have a java thread which purge records in a table every 30 seconds. The thread calls a prepared statement which is like "delete from MyTable where status=99"
    can I use DB's scheduled job to do the same thing? I can create a DB schedule, and a job in plsql.
    Thus I can save on DB connections.
    Which one is better in terms of performance?

    SoulTech2012 wrote:
    i personally recommend against PL/SQL if you can manage it
    some will argue that it's okay to couple yourself to a database because you're likely not to change it
    but i've seen enough migrations to know the painConversely I have seen attempts to process data by dragging it across the network in the vain attempt to make the application database agnostic. Which results in orders of magnitude more processing time when the application needs to do anything approaching real volume.

  • Using NetBeans Java ME Designer for List

    I'm using the Java ME screen Designer in NetBeans. I'd like to create a simple list from which users can select one option. I know how to write code to do it, but how do I do it through the screen designer?

    import java.util.ArrayList;
    import java.util.List;
    import java.util.Map;
    import javax.xml.ws.BindingProvider;
    import weblogic.wsee.security.unt.ClientUNTCredentialProvider;
    import weblogic.xml.crypto.wss.WSSecurityContext;
    import weblogic.xml.crypto.wss.provider.CredentialProvider;
    you can add username for weblogic client using
    // Create list of credential providers
    List credProviders = new ArrayList();
    // Create user name token provider
    ClientUNTCredentialProvider unt = new ClientUNTCredentialProvider("weblogic", "weblogic");
    credProviders.add(unt);
    credProviders.add(cp);
    // Finally add the credential providers to the request context
    Map<string, object=""> requestContext = ((BindingProvider)brokerService).getRequestContext();
    requestContext.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credProviders);

  • How does the Java Card simulator work? (Using NetBeans)

    Hi,
    I'm using NetBeans and am trying to simulate:
    Someone powering up the card, saving a value, and powering down... And then they power it up again, get the value, and power down.
    When I edit my APDU script to do the second part, the value I entered the first time is never stored, which probably means that when I 'run' my code, my application is loaded and everything is initialized again.
    How do I edit NetBeans to not install the application every time I hit 'run'? And not to initialize the values, so that when i power it up again, I can get a value stored in a previous running of a script?
    When I use powerup, powerdown and then powerup again, NetBeans doesn't powerup the simulator the second time. So understanding the Java Card Simulator would also help... where it is, how it runs, what options it runs with, etc.

    Hi Shane,
    I have not read anywhere else that the JC3 cards are not available, thank you so much for that tip! I am not doing it for research, but I am working on this alone and will have to deploy a card later on. I will be getting all the right versions now.
    I'll ask the question then, using just the JCDK:
    If I want to save a value on the card, and then need it at a later time, how do I go about it. Do I do the following?
    (1) Install the application on the card. (I know how to do this)
    (2) Run the simulator using -o "eeprom data filename"
    (3) Save the value using the APDU calls and Java code on the card + close connection.
    Code:
    public class MyApp extends Applet {
        private static byte[] data = {0x00, 0x00, 0x00};
        // Install method, method to register, process method that can call saveData or recallData, etc
        public static void saveData()
           // code to change data
           data = {0x01, 0x01, 0x01};
        public static byte[] recallData()
           // code to return data
           return data;
    }(4) Run the simulator using -i "eeprom data filename". get the value using recallData().
    Will selecting the app not make data initialize to {0x00, 0x00, 0x00} again?
    If I know this is the correct way of going about it, then I can work towards it getting done.
    From other examples I can see that this is probably the way it should work, but my data array always returns as {0x00, 0x00, 0x00}.

  • Under CentOS 6 x64, Java Thread.sleep()/Object.wait() will be influenced.

    Under CentOS 6 x64, Java Thread.sleep()/Object.wait() will be influenced while changing OS time.
    I found a BUG in java bug list. The bug id is 6311057 with fixed status. But I find it still existing.
    Under CentOS6 x64 platform, on JDK1.6.0_33, the bug still exists.
    But under CentOS5 x64 platform, on same JDK, the problem does not exist.
    Could anyone give me help? Thanks.
    The bug's link is http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6311057
    Edited by: user10222290 on 2012-6-13 下午9:22

    user10222290 wrote:
    One server could want to synchronize it's OS time with another server when they connected each other for some business reasons. I have 3 computers running pretty much continuously with time synchronised from one of the internet time servers. They never seem to be more than about 1/10 th second apart and any time corrections are very very small.
    Some threads have started to run before changing OS time, so these thread's sleep process will be influenced sometime seriously.I understand that but I would only expect this to be a problem when there is a significant change to the OS time. If each server is synchronized to a time server then the time corrections will be very very small.
    If OS time was turned back some days, these thread could not wake up untill some days passed.Agreed but why would the "OS time be turned back some days" ?
    This whole problem seems to me to arise because the servers are not time synchronized. Now I understand that there may be concerns about the security of external time servers but it is easy enough to make one of the local servers a master and act as a time server to the others.
    I have a small server that typically services some 30 or so external clients. I don't have any control over the clients and do not know anything about the setting of their system clocks. The clients send a time signal as part of a heartbeat and from this the server keeps track of the local time on each client and compensates for any difference when writing logs. I have seen this difference as big as 4 months but the compensation corrects it to within about a second. No adjustment of clocks is required for this.
    I still don't see this 'bug' as a serious bug. I just see a design problem to be solved without changing the OS time on any computer. I know this can be done since I do it. The only problem I see is if you want an accuracy of better than about 20 mS but that does not seem to be required for your system.
    Note - if Oracle accept your new bug report it could take years to fix even if lots of people vote for it to be fixed.

  • Can i make Thread safe without using synchronised keyword in java

    Hi all,
    please tell me code and concept that we can make Thread safe without using synchronised keyword in java programming.
    regards
    Mohan kumar

    There's a series of new features in Java 5.0 (JDK 1.5.0) to address things like concurrency.
    See: http://java.sun.com/j2se/1.5.0/docs/guide/concurrency/overview.html
    -Alexis

  • Changing wait cursor in netbeans.

    Hi,
    I'm having problems trying to change my cursor, I'm using netbeans and i want to change the cursor when a task is been doing.
    I have a frameview and will show you the code. But i'm getting a error using setCursor().
    I tried using a Jframe instead of a FrameView and this code works ok. Who knows why i can't use setCursor() with a FrameView?
    Thanks for your help
    public class ProgressBarDemo extends FrameView
    private Task task;
    class Task extends SwingWorker<Void, Void> {
    @Override
    public Void doInBackground() {
    Random random = new Random();
    int progress = 0;
    //Initialize progress property.
    setProgress(0);
    while (progress < 100) {
    //Sleep for up to one second.
    try {
    Thread.sleep(random.nextInt(1000));
    } catch (InterruptedException ignore) {}
    //Make random progress.
    progress += random.nextInt(10);
    setProgress(Math.min(progress, 100));
    return null;
    @Override
    public void done() {
    Toolkit.getDefaultToolkit().beep();
    startButton.setEnabled(true);
    setCursor(null); //turn off the wait cursor
    taskOutput.append("Done!\n");
    /** Creates new form ProgressBarDemo */
    public ProgressBarDemo() {
    initComponents();
    private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {
    startButton.setEnabled(false);
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    //Instances of javax.swing.SwingWorker are not reusuable, so
    //we create new instances as needed.
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new ProgressBarDemo().setVisible(true);
    }

    So, you are talking about Swing application Framework???
    It would certainly not work because 'FrameView' is neither a Frame, nor a Panel, etc. , I don't think NetBeans would allow you to compile such a code.
    See you can use:
    there is an '.........App' class,( for your case it may be ProgressBarDemoApp, but I doubt it), use its static method to obtain refrence to mainframe like this:
    JFrame frm= ProgressBarDemoApp.getApplication().getMainFrame();
    frm.setCursor(Cursor.WAIT_CURSOR);Another possibility is:
    NetBeans make a default main panel in View named 'mainPanel', you can set its default cursor:
    mainPanel.setCursor(Cursor.WAIT_CURSOR);hope it works............
    Thanks!

  • How can I draw a bar graph using netbeans?

    Hello, I am quite new to java and netbeans. I have got the hang of placing controls on the forms and getting them to function.. Now I want to be able to draw a graph. Is there a way I can do this is net beans? Or is there a control that lets me draw lines into it, like the PictureBox in Visual Basic?
    Thanks

    Speedster239 wrote:
    You need to get the grapics of the frame component in order to draw on it with java.awt.Graphics.
    Use something like:
    Graphics g = frame.getGraphics();
    This is wrong. See the comment about subclassing JPanel. Demo:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    public class ExamplePanel extends JPanel implements ActionListener {
        private java.util.List<Shape> shapes = new ArrayList<Shape>();
        private Random rnd = new Random();
        public ExamplePanel() {
            new javax.swing.Timer(500, this).start();
        public void actionPerformed(ActionEvent evt) {
            int x = rnd.nextInt(getWidth());
            int y = rnd.nextInt(getHeight());
            shapes.add(new Rectangle(x-5, y-5, 10, 10));
            repaint();
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            for(Shape shape : shapes) {
                g2.draw(shape);
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    ExamplePanel comp = new ExamplePanel();
                    comp.setPreferredSize(new Dimension(400, 300));
                    JFrame f = new JFrame();
                    f.getContentPane().add(comp);
                    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    f.pack();
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • How to terminate a java thread from c++ code?

    Hi,
    I made a screensaver which loads a jvm, forks a thread running a java class, wait until user's action(i.e. mouse move/click keyboard input), then terminate the java thread.
    However, I met a problem, How to terminate a running java thread from c++ code?
    Here is my code, but it does not work: (even after the terminate is called, jvm throws an error)
    JNIEnv* env;
    JavaVM* jvm;
    HANDLE hThread; //handle for the startThread
    unsigned __stdcall startThread(void *arg)
         jclass cls;
         jmethodID mainId;
         jint          res;
         int threadNum = (int)arg;
         res = jvm->AttachCurrentThread((void**)&env, NULL);
    cls = env->FindClass( MAIN_CLASS);
         mainId = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
         // setup the parameters to pass to main()
         jstring str;
         jobjectArray args;
         int i=0;
         args = env->NewObjectArray(1, env->FindClass("java/lang/String"), 0); //only one input parameters
         str = env->NewStringUTF("localhost");
         env->SetObjectArrayElement(args, 0, str);
         env->CallStaticVoidMethod(cls, mainId, args); // call main()      
         if (env->ExceptionOccurred()) {
                   env->ExceptionDescribe();
         return TRUE;
    Here is the main method:
    First create the jvm and load the thread. then tries to terminate the thread, but failed here
    switch (msg)
    { case WM_CREATE:
              JavaVMOption options[NUMBEROFOPTIONS];
              JavaVMInitArgs vmargs;     
              jint rc;
              vmargs.version = JNI_VERSION_1_4; /* version 1.4 */
              vmargs.options = options;
              vmargs.nOptions = NUMBEROFOPTIONS;
              vmargs.ignoreUnrecognized = JNI_FALSE;          
              rc=JNI_CreateJavaVM( &jvm, (void **)&env, &vmargs ); /* create JVM */
              /* We pass the thread number as the argument to the invoked thread */
              unsigned int threadId = -1;
              // to initialize a thread-safe C runtime library
              hThread = (HANDLE)_beginthreadex(NULL, 0, &startThread, NULL, 0, &threadId );
    } break;
    case (WM_DESTROY):
              CloseHandle( hThread );
              jvm->DestroyJavaVM(); /* kill JVM */
              Debug("Destroy Java Virtual Machine\n");
    }break;
    Note, after the thread "startThread" runs, it has an infinite loop and will not terminate, until the user clicks to terminate.(I didn't call jvm->DetachCurrentThread();_endthreadex(0); in the "startThread" because the java thread will not terminate by itself)
    Thus, the only way to terminate the thread is to call closehandle(hthread) in the main thread, which may cause jvm to throw an error.
    Do you know how to terminate a java thread safely???
    Thanks a lot

    Assuming that your java thread is in a loop of some kind. Such as
    int i=1; /* I tried using a boolean, I just could not get my C++ env, to change this value. So i decided to use an int */
    run {
    while(i)
    isdfjsdfj
    void seti()
    i=0
    So, B/4, i call destroyVM in my C++ code, i call this seti(). so the loop terminates, therefore my thread finishes executing and ends.
    Hope this helps
    tola.

  • How to include others jar in my project use netbean

    Hi,
    Here i'm build my project in netbean, in compile source i add jdom.jar. Afer compile, run jar from terminal. But, application can't use and error :
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jpos/
    iso/ISOPackager
    Now, i ask : How to include others lib or jar in my project use netbean
    Rgds,
    Wira S

    Dear All,
    The code In manifest.mf, like :
    Manifest-Version: 1.0
    X-COMMENT: Main-Class will be added automatically by build
    Main-Class: root/Phase3/TesterPhase3/IsolibTester/src/isolibtester/DynamicTreeTester
    Class-Path: root/Phase3/TesterPhase3/jpos/lib/jdom.jar
    When build jar, error :
    error while reading original manifest: error in opening zip file
    Building jar: /root/PHASE3/TesterPhase3/IsolibTester/dist/IsolibTester.jar
    Manifest is invalid: Manifest sections should start with a "Name" attribute and not "Main-Class"
    /root/PHASE3/TesterPhase3/IsolibTester/nbproject/build-impl.xml:273: Invalid Manifest: /root/PHASE3/TesterPhase3/IsolibTester/manifest.mf
    BUILD FAILED (total time: 0 seconds)
    So, i tried add classpath in bash_profile and build.xml, unseccessful
    But, when runing my project from terminal can't found component jdom.jar

  • Jstack shows a thread waiting for monitor entry but it's already acquired

    I have a heavy load website powered by tomcat-6.0.14 and jdk1.6.0_02-b05(amd64) on a 2 dual-core amd Opteron. When tomcat started, and I directed the http request(~200/s) abruptly to tomcat, it looks choked for over one minute, and if I took off the http requests, tomcat can recover in a few minutes.
    Then I use jstack during the choke time to find what's the cause, where I found a strange situation. Almost all threads are blocking on getting a log4j lock(I think it's normal,since log4j use a coarse lock), but one thread which already got the lock are also blocked. Below is the stack trace.
    "http-172.23.24.29-8011-exec-175" daemon prio=10 tid=0x00002aad37843400 nid=0x542d waiting for monitor entry [0x0000000052e55000..0x0000000052e55da0]
    java.lang.Thread.State: BLOCKED (on object monitor)
    at org.apache.log4j.Category.callAppenders(Category.java:201)
    - locked <0x00002aaab39d5670> (a org.apache.log4j.spi.RootLogger)
    at org.apache.log4j.Category.forcedLog(Category.java:388)
    at org.apache.log4j.Category.log(Category.java:853)
    at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:133)
    at com.xxx.xxxx.TimingLogFilter.doFilter(TimingLogFilter.java:39)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:887)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:696)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2009)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    And all the other threads waiting for the log4j lock.
    "http-172.23.24.29-8011-exec-176" daemon prio=10 tid=0x00002aad37773800 nid=0x542e waiting for monitor entry [0x0000000052f56000..0x0000000052f56b20]
    java.lang.Thread.State: BLOCKED (on object monitor)
    at org.apache.log4j.Category.callAppenders(Category.java:201)
    - waiting to lock <0x00002aaab39d5670> (a org.apache.log4j.spi.RootLogger)
    at org.apache.log4j.Category.forcedLog(Category.java:388)
    at org.apache.log4j.Category.log(Category.java:853)
    at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:133)
    at com.xxx.xxxxx.TimingLogFilter.doFilter(TimingLogFilter.java:39)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:887)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:696)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2009)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    I'm really wondering why jstack shows the first thread is BLOCKED but no blocker.
    And also, it's not a deadlock, since I made jstack log after sever seconds, and found this time another thread has the same problem.
    "http-172.23.24.29-8011-exec-170" daemon prio=10 tid=0x00002aad3784d800 nid=0x5428 waiting for monitor entry [0x0000000052950000..0x0000000052950c20]
    java.lang.Thread.State: BLOCKED (on object monitor)
    at org.apache.log4j.Category.callAppenders(Category.java:201)
    - locked <0x00002aaab39d5670> (a org.apache.log4j.spi.RootLogger)
    at org.apache.log4j.Category.forcedLog(Category.java:388)
    at org.apache.log4j.Category.log(Category.java:853)
    at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:133)
    at com.xxx.xxxx.TimingLogFilter.doFilter(TimingLogFilter.java:35)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:887)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:696)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2009)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    What's the cause? Is jstack accurate? Or, the problem is caused by hotspot compling since tomcat is just started? Or it's just because log4j's coarse lock? ( but after the starup, tomcat can handle the same traffic without any problem, and jstack shows no log4j block at all.)
    Thanks in advance.
    Jimcgnu

    "http-172.23.24.29-8011-exec-175" daemon prio=10 tid=0x00002aad37843400 nid=0x542d waiting for monitor entry [0x0000000052e55000..0x0000000052e55da0]
    java.lang.Thread.State: BLOCKED (on object monitor)
    at org.apache.log4j.Category.callAppenders(Category.java:201)
    - locked <0x00002aaab39d5670> (a org.apache.log4j.spi.RootLogger)
    It seems like a Dead Lock.
    The thread must have entered into a synchronized block/method1() and acquired a lock.
    - locked <0x00002aaab39d5670> (a org.apache.log4j.spi.RootLogger)
    While having lock the thread might be trying to acquire a lock to another synchronized block/method2()
    waiting for monitor entry
    java.lang.Thread.State: BLOCKED (on object monitor)
    and someother thread might have already acquired a lock to that block/method2().
    Can we check for Dead Lock??

  • JNDI problem using netbean

    i followed the documents in sun to use JNDI for database connection but i got an expection:
    Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    how can i solve it?
    thank you very much
    i followed http://www.netbeans.org/kb/50/using-netbeans/dbconn.html#pgfId-1156774 and also the procedures from the "help" in netbean:
    Accessing a Connection Pool from a Java Class
    Applications that are deployed to servers often need to access databases that reside on remote machines. You therefore have to set up a JDBC connection pool the server that points to the database. You then create a data source that connects to the connection pool and use the data source's JNDI name to acquire a connection to the database.
    To access a database from an enterprise application:
    1. (Optional) Create a service locator class to handle getting the reference to the database.
    2. Open the Java file from which you want to access the database. In the Source Editor, right-click the file and choose Enterprise Resources > Use Database.
    3. Enter a JNDI name for the database connection. This name must be the same as the JNDI name of the JDBC data source for the database on the target server.
    If you are deploying to the Sun Java System Application Server, you can also generate a connection pool and data source for the database connection by selecting the Create Server Resources checkbox. The resources are created under the project's Server Resources node.
    4. Select the database to which you want to connect in the Connection drop-down list. If the database is not listed, do the following:
    i) If the JDBC driver for the database server is not registered in the IDE, click Add Driver.
    ii) Click Add Connection to connect to the database.
    5. Under Service Locator Strategy, specify whether to generate inline lookup code or use an existing service locator. You can click the Browse to search for the service locator class name.
    6. Click OK.
    The Use Database command is only available in EJB module and web application projects.

    Exception in thread "main"
    javax.naming.NoInitialContextException: Need to
    specify class name in environment or system property,
    or as an applet parameter, or in an application
    resource file: java.naming.factory.initialYou need to pass the environment properties to the InitialContext constructor specifying the java.naming.factory.initial property and also the host name, I think. I read in your post that you are using Sun application server. The preferred method for lookup with Sun's server is Corba. So you need to set the org.omg.CORBA.ORBInitialHost and org.omg.CORBA.ORBInitialPort and have the appserver-rt.jar in the classpath.

  • GUI - Using NetBeans

    Hi,
    I am new to using NetBeans and have built a basic GUI using it. However, I want to change the background colour of my GUI to black and cant see how to do this using NetBeans. Please could someone explain to me how to do this.
    My code is as follows :-
    * GUIII.java
    * Created on 29 November 2007, 19:47
    package my.GUIII;
    public class GUIII extends javax.swing.JFrame {
    /** Creates new form GUIII */
    public GUIII() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    jLabel1 = new javax.swing.JLabel();
    jDialog1 = new javax.swing.JDialog();
    jPanel1 = new javax.swing.JPanel();
    jButton5 = new javax.swing.JButton();
    jButton4 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jButton1 = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    jLabel1.setText("jLabel1");
    javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
    jDialog1.getContentPane().setLayout(jDialog1Layout);
    jDialog1Layout.setHorizontalGroup(
    jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 400, Short.MAX_VALUE)
    jDialog1Layout.setVerticalGroup(
    jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 300, Short.MAX_VALUE)
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Guiness Rugby League");
    setBackground(new java.awt.Color(0, 0, 0));
    jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
    jButton5.setText("Exit");
    jButton4.setText("Clear");
    jButton3.setText("Update Database");
    jButton2.setText("Read Database");
    jButton1.setText("Read File");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
    .addComponent(jButton1)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jButton2)
    .addGap(18, 18, 18)
    .addComponent(jButton3)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jButton4)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jButton5)
    .addGap(36, 36, 36))
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(20, 20, 20)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jButton1)
    .addComponent(jButton3)
    .addComponent(jButton4)
    .addComponent(jButton5)
    .addComponent(jButton2))
    .addContainerGap(21, Short.MAX_VALUE))
    jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\Blampied\\Desktop\\P_GPremLogo.gif")); // NOI18N
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(117, 117, 117)
    .addComponent(jLabel2))
    .addGroup(layout.createSequentialGroup()
    .addGap(25, 25, 25)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap(42, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 446, Short.MAX_VALUE)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap())
    pack();
    }// </editor-fold>
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new GUIII().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JDialog jDialog1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration
    }

    Use Component's setBackground method; See this tutorial that has examples of its use:
    http://java.sun.com/docs/books/tutorial/uiswing/components/jcomponent.html
    Please post future Swing questions in the Swing forum.

Maybe you are looking for