IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
  • 1.  Thread question

    Posted Fri February 08, 2013 12:51 PM

    Hello, i have a portlet very basic, so i would like to test a threads but it did’t work which may be, if i run it with the method run it work but if i run it with the method start it don’t. I paste the code so if anyone can help to know why it doesn’t work.

    package com.webmethods.caf.prueba_threads;
    
    
    class hil extends com.webmethods.caf.faces.bean.BasePageBean implements Runnable{ //class runnable to start threads
    private com.webmethods.caf.is.wsclient.ws.log.Log1 log = null;
    public com.webmethods.caf.is.wsclient.ws.log.Log1 getLog()  {
    if (log == null) {
    log = (com.webmethods.caf.is.wsclient.ws.log.Log1)resolveExpression("#{Log}");
    }
    
    resolveDataBinding(LOG_PROPERTY_BINDINGS, log, "log", false, false);
    return log;
    }
    private static final String[][] LOG_PROPERTY_BINDINGS = new String[][] {
    {"#{Log.authCredentials.authenticationMethod}", "1"},
    {"#{Log.authCredentials.requiresAuth}", "true"},
    {"#{Log.autoRefresh}", "false"},
    {"#{Log.socketTimeout}", "#{environment[\"wsclient-socketTimeout\"]}"},
    {"#{Log.authCredentials.userName}", "#{environment[\"wsclient-username\"]}"},
    {"#{Log.authCredentials.password}", "#{environment[\"wsclient-password\"]}"},
    {"#{Log.endpointAddress}", "#{environment[\"wsclient-endpointAddress\"]}/ws/ws:log"},
    };
    
    public void run() {
    error("ok");
    getLog().refresh();
    
    }
    }
    
    public class PruebaThreadsDefaultviewView  extends   com.webmethods.caf.faces.bean.BasePageBean {
    private static final long serialVersionUID = 1L;
    private static final String[][] INITIALIZE_PROPERTY_BINDINGS = new String[][] {
    };
    private com.webmethods.caf.prueba_threads.PruebaThreads pruebaThreads = null;
    private com.webmethods.caf.is.wsclient.ws.log.Log1 log = null;
    private static final String[][] LOG_PROPERTY_BINDINGS = new String[][] {
    {"#{Log.authCredentials.authenticationMethod}", "1"},
    {"#{Log.authCredentials.requiresAuth}", "true"},
    {"#{Log.autoRefresh}", "false"},
    {"#{Log.socketTimeout}", "#{environment[\"wsclient-socketTimeout\"]}"},
    {"#{Log.authCredentials.userName}", "#{environment[\"wsclient-username\"]}"},
    {"#{Log.authCredentials.password}", "#{environment[\"wsclient-password\"]}"},
    {"#{Log.endpointAddress}", "#{environment[\"wsclient-endpointAddress\"]}/ws/ws:log"},
    };
    /**
    * Initialize page
    */
    public String initialize()  {
    try {
    
    Thread a = new Thread(new hil()); //NEW THREADS
    a.start();//NOT WORK?????
    a.run();//WORK FINE
    
    resolveDataBinding(INITIALIZE_PROPERTY_BINDINGS, null, "initialize", true, false);
    
    return OUTCOME_OK;
    } catch (Exception e) {
    error(e);
    log(e);
    return OUTCOME_ERROR; 
    }    
    }
    
    public com.webmethods.caf.prueba_threads.PruebaThreads getPruebaThreads()  {
    if (pruebaThreads == null) {
    pruebaThreads = (com.webmethods.caf.prueba_threads.PruebaThreads)resolveExpression("#{PruebaThreads}");
    }
    return pruebaThreads;
    }
    
    public com.webmethods.caf.is.wsclient.ws.log.Log1 getLog()  {
    if (log == null) {
    log = (com.webmethods.caf.is.wsclient.ws.log.Log1)resolveExpression("#{Log}");
    }
    
    resolveDataBinding(LOG_PROPERTY_BINDINGS, log, "log", false, false);
    return log;
    }
    
    
    }

    Thanks you very much.


    #webMethods-BPMS
    #webMethods
    #BPM