Timing a thread

I would like to time a thread in my program to see how long it takes to execute. Can anyone tell me how I should go about doing it? I start my thread with the start() method. It seems like I should start some kind of timer before calling start() and stop it immediately after.

long start = System.currentTimeMillis();
th.start();
th.joing();
long end = System.currentTimeMillis(); Or put the timing calls at the beginning and end of the run() method.
Or use an automatic profiling tool.

Similar Messages

  • ScheduledThreadPoolExecutor core thread pool / keepalive/timing out threads

    Hi,
    I am using a ScheduledThreadPoolExecutor - java1.6 on Windows(currently).
    I would like to minimise the number of threads in the pool running at any one time to around the number of threads required to run the number of tasks that are concurrently executing.
    However, I don't seem to be able to get the thread pool to minimise the number of threads below the max threads in the constructor.
    I want to do this mainly because I have a large delay queue and the performance of the pool seems to be better when the number of threads in the pool is minimised to roughly the number of threads required to service the concurrently executing tasks.
    Any ideas?
    Thanks,
    Alex
                    ThreadFactory tf = new MyThreadFactory();
              ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(50,tf);
              scheduler.setCorePoolSize(10);
              //scheduler.setMaximumPoolSize(50);
              scheduler.setKeepAliveTime(1, TimeUnit.NANOSECONDS);
              scheduler.allowCoreThreadTimeOut(true);
              scheduler.schedule(aTask, 10, TimeUnit.SECONDS);
    ...

    because of how a scheduledthreadpoolexecutor works, it doesn't really make sense to have a variable number of threads. since threads are only added when tasks are added to the pool (aka, when submit is called), once the core threads timed out they would never get replaced (e.g. you would eventually get down to 1 thread and never get anymore added). one way to achieve what you want would be to have a single threaded ScheduledThreadPoolExecutor, where the scheduled jobs do the real work in a separate, variable size thread pool (e.g. the scheduled tasks do not do anything but submit a task to the real work thread pool). this solution would work fine for "schedule at fixed rate" but not for "schedule with fixed delay". you would actually have to simulate the latter by scheduling a one-off task which resubmits itself to the scheduler each time it completes.

  • Timing of threads

    Hi All
    I'm trying to get a constant output rate in combination with a thread. That means that the number of times the thread is called per second should be constant, as the execution time of the thread is not constant.
    I tried the following:
    private final long delayPerFrame = 1000/20; //e.g. 20 FPS
    public void run(){
    long ctm;
    while (true){
    ctm=System.currentTimeMillis();
    //co calculations & output     
    try{
    fireThread.sleep(delayPerFrame-(ctm-System.currentTimeMillis()));
    } catch(Exception e){}
    Unfortunately this method works only theoretically as the resolution of currentTimeMillis() seems to be quite big. Therefore I tried to middle the thread's execution time over some loops. It didn't impove the result because the delay gets very jumpy and unprecise. Should I use timers or does another solution exist?
    I didn't find very much posted in the forums, although I think that I could not be the only one with this problem ;-)
    I would be thankful for every kind of advice.
    exxion

    Hi,
    I have found that in windows,
    getCurrentTimeMillis is only accurate to .01s .For more accurate timers, you can try write the functionality in C/C++ and call it from Java using JNI.

  • Application Server Session timed out (-11) (lack of debug in internal ITS)

    Dear Sirs,
    I get the error message below, when I try to run a IAC through internal ITS. The IAC worked for a while (<30 minutes), and then suddenly this error appeared.
    I can see that this error message has been asked about previously, but then in connection with statefull/stateless BSP applications (e.g "Session timed out thread", on this forum May 31 2005).
    In this thread the solution is apparently to alter the 'rdisp/plugin_auto_logout', is this the case for us as well?
    I have read Error handling using the ICM , but not able to actually beeing able to pinpoint the problme.
    All our other IAC are working it is only a problem with one of them. The problem is still valid even if I log on with different user, and the error is still there now even after two hours. The problem transaction is a altered version of the WSTA, and I am able to get the first screen where I enter the store number. 
    Any tips or suggestions to pinpoint the error?
    +400 Session timed out - please log in again
    Application Server Session timed out (-11)
    Error:     -11
    Version:     6040
    Component:     ICM
    Date/Time:     Thu Apr 27 14:13:56 2006
    Module:     icxxthr_mt.c
    Line:     1719
    Server:     xxXXXt_TXX_XX
    Detail:     Session does not exist+
    In SM21 :
    +Transaction Canceled ITS_P 025 ( 0x2103: Interpreter: The input contains errors. )                                                              
    Documentation for system log message D01 :
    The transaction has been terminated.  This may be caused by a termination message from the application (MESSAGE Axxx) or by an error detected by the SAP System due to which it makes no sense to proceed with the transaction.  The actual reason for the termination is indicated by the T200 message and the parameters.                         
    Additional documentation for message ITS_P               025 Template interpretation terminated - internal error &1                        
    No documentation exists for message IT025+                                     
    Best regards,
    Jørgen

    Dear Sirs,
    The error has been solved. It was a matter of an illegal input sendt to the RetailHeaderFunction.
    However, this makes way for another question.
    On the standalone ITS, it was possible to get error messages which indicated where the code contained errors, when it was runned.
    How is it possible to make the internal ITS gives better feedback (errors?), and show where the error is?
    Jørgen

  • Trigerring BPM from Web Dynpro screen not working

    Hi Guys,
    I am trying to trigger a BPM process from a Web Dynpro screen so I created a BPM process and created a WSDL and consuming the WSDL in the Web Dynpro app but getting an exception "Exception on creation of service metadata for web service mass config parameters service reference ID '28af57ab-9212-4ffd-90c6-0779c78a8da3' and application name 'demo.sap.com/testwd'. Check mass configuration has been done properly."
    Please assist with what I am missing.
    Thanks,
    -Ash

    I ran into the same error when attempting to consume a Process as a web service from my Web Dynpro component.  I found that it is actually succeeding in kicking off my process, but it looks like it fails from my calling component.  It seems to be related to calling a service meant to be asynchronous as a synchronous service.  In my case, it throws a SOAP fault "com.sap.engine.services.webservices.jaxrpc.exceptions.SOAPFaultException: Process start has been triggered" when I run it from the WS Navigator manually.  It turns out that the same error is getting wrapped by the exception you were experiencing.  Try using the getCause method to see if the same is true for you.  This environment is still new to me so I don't have good solution on how to make it not throw that error in the first place.
    [addendum] I ran across [this|Start BPM Process Trigger - Read timed out] thread that explains exactly what I had guessed.  You can remove the response part of your WSDL and it will get called successfully in an asynchronous manor.  Note that you must manually remove some of the entries in the WSDL since the visual editor with the 7.1 environment doesn't clean up after itself as well as it should.
    Edited by: Joseph Robertson on Jan 12, 2011 11:04 PM

  • JSK 11.1.18 not starting two instances simultaniously

    Hi,
    I had downloaded the webcenter site JSK 11.1.1.8 form oracle support and installed two instances one with samples and one with out samples (different ports) .
    But when i try to start the JSK, one is running (one i am starting first) and other is failing always.
    Below is the error
         oracle.fatwire.sites.jsk.utlities.httpRequestBroker:callHTTP  -  Test to http://localhost:9180/cs/CatalogManager?ftcmd=pingdb:9180 failed
    [Thread-4] DEBUG  - [Thread-4] 129:oracle.fatwire.sites.jsk.utlities.httpRequestBroker:callHTTP  - java.net.SocketTimeoutException: connect timed out
    [Thread-4] TRACE  - [Thread-4] 92:oracle.fatwire.sites.jsk.uiElements.jskURLReachableThread:run  - failed to fine required text, server not running      
    Please let me know if any come across this issue and any found solution
    Thanks

    SEVERE: StandardServer.await: create[localhost:9005]:
    java.net.BindException: Cannot assign requested address: JVM_Bind
    this is most likely related to another process using the same port as the one of the JSK . On Windows, run the command: 
    netstat -a -n | grep "LIST"
    And it should list anything there that's blocking the port.
    You can configure the JSK to use a different port if needed.
    Regards,
    Pietro

  • Create Manageable Channel in JSDT and invite the clients to join It

    I am developing a collaborative application using JSDT where I want to incorporate private messaging between two clients. When the Client chooses the private messaging option I am creating a New channel and inviting the other Client to join the Channel using channel.invite(client) method. It throws the permissionDenied exception. I am wondering if it is a client autentication problem. Since there isn't enough good reference on JSDT I am having hard time understanding this problem. I would greatly appreciate any help to solve this problem.

    Sorry I didn't get back to you earlier
    Have taken a look at this problem & have built a skeleton app that works
    I think your problem is probably due to NOT building in a ChannelManager(???) & thus when your client tries to join the Channel within the Session - No Authentication occurs
    Anyhow have a look at the code below (it needs some tidying up)
    Run JSDTManager, then JSDTChatApp, then JSDTChatClient
    ******************* Code for JSDTManager.java *********************
    * JSDTManager.java
    * Created on 09 December 2003, 17:11
    package com.JSDT;
    import com.sun.media.jsdt.*;
    import com.sun.media.jsdt.event.*;
    * @author stefan.maric
    public class JSDTManager extends Thread implements RegistryManager, SessionManager, ChannelManager
         private static JSDTManager manager;
         public static final int nCLIENT_PORT_BASE = 5000;
         public static final int nCLIENT_PORT_LIMIT = 5999;
         public static final String sSU = "SU";
         public static final String sSUALLOWED = "SU_ALLOWED";
         public static final String sJOIN_SESSION_ALLOWED = "OK";
         public static final String sCREATE_CHANNEL_ALLOWED = "CREATE_CHANNEL_OK";
         public static final String sJOIN_CHANNEL_ALLOWED = "CHN_OK";
         public static final String sCREATE_CLIENT_ALLOWED = "CLIENT_OK";
         /** Creates a new instance of JSDTManager */
         private JSDTManager()
         public static JSDTManager getInstance()
              if(manager == null)
                   manager = new JSDTManager();
                   manager.start();
              return manager;
         public void run()
              try{
                   if(!RegistryFactory.registryExists("socket"))
                        RegistryFactory.startRegistry("socket", new JSDTManager());
                        System.out.println("JSDTManager:JSDT Registry Started");
                   while(true)
              }catch(JSDTException eX){
                   eX.printStackTrace();
         public static void channelInvite(String sH, Channel chn, String sCN)
              System.out.println("JSDTManager:channelInvite");
              try{
                   Client[] clients = new Client[1];
                   int nPort = JSDTManager.nCLIENT_PORT_BASE;
                   boolean bFound = false;
                   while(!bFound && nPort <= JSDTManager.nCLIENT_PORT_LIMIT)
                        URLString url = URLString.createClientURL(sH, nPort, "socket", sCN);
                        try{
                             System.out.println(url.toString());
                             clients[0] = ClientFactory.lookupClient(url);
                             bFound = true;
                        }catch(NotBoundException eX){
                             nPort++;
                   if(bFound)
                        System.out.println("JSDTManager:Inviting '" + clients[0].getName() + "' to join Channel '" + chn.getName() + "'");
                        chn.invite(clients);
                   else
                        System.out.println("Could NOT find Client '" + sCN + "' in Registry");
              }catch(JSDTException eX){
                   eX.printStackTrace();
         public boolean registryRequest(AuthenticationInfo info, Client client)
              boolean bRetVal = false;
              String sN = client.getName();
              int nAction = info.getAction();
              char chType = info.getType();
              System.out.println("JSDTManager:registryRequest from Client '" + sN + "'");
              if(nAction == AuthenticationInfo.CREATE_SESSION)
                   String challenge = "Challenge Session Create";
                   String reply = null;
                   info.setChallenge(challenge);
                   reply = (String) client.authenticate(info);
                   if(reply != null)
                        if(reply.equals(sSUALLOWED) || reply.equals(sJOIN_SESSION_ALLOWED))
                             System.out.println("JSDTManager:registryRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' Authenticated");
                             bRetVal = true;
                        else
                             System.out.println("JSDTManager:registryRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' NOT Authenticated");
                   else
                        System.out.println("JSDTManager:registryRequest NULL Reply");
              else if(nAction == AuthenticationInfo.CREATE_CLIENT)
                   String challenge = "Challenge Client Create";
                   String reply = null;
                   info.setChallenge(challenge);
                   reply = (String) client.authenticate(info);
                   if(reply != null)
                        if(reply.equals(sSUALLOWED) || reply.equals(sCREATE_CLIENT_ALLOWED))
                             System.out.println("JSDTManager:registryRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' Authenticated");
                             bRetVal = true;
                        else
                             System.out.println("JSDTManager:registryRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' - NOT Authenticated");
                   else
                        System.out.println("JSDTManager:registryRequest NULL Reply");
              return(bRetVal);
         public boolean sessionRequest(Session session, AuthenticationInfo info, Client client)
              boolean bRetVal = false;
              String sN = client.getName();
              int nAction = info.getAction();
              char chType = info.getType();
              System.out.println("JSDTManager:sessionRequest from Client '" + sN + "' for '" + info.toString() + "'");
              if(chType == AuthenticationInfo.SESSION)
                   String reply = null;
                   String challenge = null;
                   switch(nAction)
                        case AuthenticationInfo.JOIN:
                             challenge = "Challenge Session Join";
                             info.setChallenge(challenge);
                             reply = (String) client.authenticate(info);
                             if(reply != null)
                                  if(reply.equals(sSUALLOWED) || reply.equals(sJOIN_SESSION_ALLOWED))
                                       System.out.println("JSDTManager:sessionRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' Authenticated");
                                       bRetVal = true;
                                  else
                                       System.out.println("JSDTManager:sessionRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' NOT Authenticated");
                             else
                                  System.out.println("JSDTManager:sessionRequest NULL Reply");
                             break;
                        case AuthenticationInfo.CREATE_BYTEARRAY:
                        case AuthenticationInfo.CREATE_TOKEN:
                             break;
                        case AuthenticationInfo.CREATE_CHANNEL:
                             challenge = "Challenge Channel Create";
                             info.setChallenge(challenge);
                             reply = (String) client.authenticate(info);
                             if(reply != null)
                                  if(reply.equals(sSUALLOWED) || reply.equals(sCREATE_CHANNEL_ALLOWED))
                                       System.out.println("JSDTManager:sessionRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' Authenticated");
                                       bRetVal = true;
                                  else
                                       System.out.println("JSDTManager:sessionRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' NOT Authenticated");
                             else
                                  System.out.println("JSDTManager:sessionRequest NULL Reply");
                             break;
              return(bRetVal);
         public boolean channelRequest(Channel channel, AuthenticationInfo info, Client client)
              boolean bRetVal = false;
              String sN = client.getName();
              int nAction = info.getAction();
              char chType = info.getType();
              System.out.println("JSDTManager:channelRequest from Client '" + sN + "' for '" + info.toString() + "'");
              if(chType == AuthenticationInfo.CHANNEL && nAction == AuthenticationInfo.JOIN)
                   String challenge = "Challenge Channel Join";
                   String reply = null;
                   info.setChallenge(challenge);
                   reply = (String) client.authenticate(info);
                   if(reply != null)
                        if(reply.equals(sSUALLOWED) || reply.equals(sJOIN_CHANNEL_ALLOWED))
                             System.out.println("JSDTManager:channelRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' Authenticated");
                             bRetVal = true;
                        else
                             System.out.println("JSDTManager:channelRequest Authentication Reply '" + reply + "' Rxd from Client '" + sN + "' NOT Authenticated");
                   else
                        System.out.println("JSDTManager:channelRequest NULL Reply");
              return(bRetVal);
         * @param args the command line arguments
         public static void main(String[] args) throws Exception
              JSDTManager.getInstance();
    ******************* Code for JSDTManager.java *********************
    ******************* Code for JSDTChatApp.java *********************
    * JsdtChatApp.java
    * Created on 08 December 2003, 12:36
    package com.JSDT;
    import com.sun.media.jsdt.*;
    import com.sun.media.jsdt.event.*;
    * @author stefan.maric
    public class JsdtChatApp implements Client, ClientListener, SessionListener
         public static final String sCHATTER = "Chat Session";
         private String sHost;
         private int nPort;
         private JSDTManager manager;
         private Session session;
         private Channel channel;
         /** Creates a new instance of JsdtChatApp */
         public JsdtChatApp() throws Exception
              manager = JSDTManager.getInstance();
              nPort = 4461;
    //          sHost = "BOH-EAAC-IT3.eaac.boh";
              sHost = "localhost";
              int nTry = 1;
              boolean bCreated = false;
              URLString sessionURL = URLString.createSessionURL(sHost, nPort, "socket", sCHATTER);
              while(bCreated == false)
                   if(SessionFactory.sessionExists(sessionURL))
                        bCreated = true;
                   else
                        try{
                             System.out.println("JsdtChatApp:Session Create Attempt '" + nTry + "'");
                             session = SessionFactory.createSession(this, sessionURL, false, manager);
                        }catch(TimedOutException eX){
                             System.out.println("JsdtChatApp:Session Create Attempt '" + nTry + "' Timed Out");
                             try{
                                  Thread.sleep(5000);
                             }catch(InterruptedException iEX){
                                  iEX.printStackTrace();
                                  System.exit(1);
                   nTry++;
              System.out.println("JsdtChatApp:Session created");
              try{
                   session.join(this);
                   System.out.println("JsdtChatApp:Joined Session");
                   session.addSessionListener(this);
                   channel = session.createChannel(this, "ChatChannel", true, true, true, manager);
                   System.out.println("JsdtChatApp:ChatChannel Created");
    //               RegistryFactory.addRegistryListener(sHost, "socket", this);
              }catch(JSDTException eX){
                   eX.printStackTrace();
              while(true)
    //***********************     Session Listener Inerface     ***********************
         public void byteArrayCreated(SessionEvent event)
         public void byteArrayDestroyed(SessionEvent event)
         public void channelCreated(SessionEvent event)
         public void channelDestroyed(SessionEvent event)
         public void sessionDestroyed(SessionEvent event)
         public void sessionJoined(SessionEvent event)
              String sCN = event.getClientName();
              Session sess = event.getSession();
              String sSN = sess.getName();
              System.out.println("JsdtChatApp: '" + sCN + "' has Joined session '" + sSN + "'");
              manager.channelInvite(sHost, channel, sCN);
         public void sessionLeft(SessionEvent event)
         public void sessionInvited(SessionEvent event)
         public void sessionExpelled(SessionEvent event)
         public void tokenCreated(SessionEvent event)
         public void tokenDestroyed(SessionEvent event)
    //***********************     Session Listener Inerface     ***********************
    //***********************     Client Inerface     ***********************
         public Object authenticate(AuthenticationInfo info)
              System.out.println("JsdtChatApp:authenticate \n" + info.toString());
              return JSDTManager.sSUALLOWED;
         public String getName()
              return JSDTManager.sSU;
    //***********************     Client Inerface     ***********************
    //***********************     Client Listener Section     ***********************
         public void byteArrayExpelled(ClientEvent event)
         public void byteArrayInvited(ClientEvent event)
         public void channelExpelled(ClientEvent event)
         public void channelInvited(ClientEvent event)
         public void sessionExpelled(ClientEvent event)
         public void sessionInvited(ClientEvent event)
         public void tokenExpelled(ClientEvent event)
         public void tokenInvited(ClientEvent event)
         public void tokenGiven(ClientEvent event)
    //***********************     Client Listener Section     ***********************
         * @param args the command line arguments
         public static void main(String[] args) throws Exception
              new JsdtChatApp();
    ******************* Code for JSDTChatApp.java *********************
    ******************* Code for JSDTChatClient.java *********************
    * JSDTClient.java
    * Created on 08 December 2003, 13:10
    package com.JSDT;
    import com.sun.media.jsdt.*;
    import com.sun.media.jsdt.event.*;
    * @author stefan.maric
    public class JSDTChatClient implements Client, ClientListener, SessionListener, ChannelListener
         private static JSDTManager manager;
         private Session session;
         private String name;
         /** Creates a new instance of JSDTClient */
         public JSDTChatClient()
              manager = JSDTManager.getInstance();
         public JSDTChatClient(String sN) throws Exception
              this();
              setName(sN);
    //          String sHost = "BOH-EAAC-IT3.eaac.boh";
              String sHost = "localhost";
              int nPort = JSDTManager.nCLIENT_PORT_BASE;
              int nTry = 1;
              boolean bCreated = false;
              while(bCreated == false && nPort <= JSDTManager.nCLIENT_PORT_LIMIT)
                   URLString clientURL = URLString.createClientURL(sHost, nPort, "socket", sN);
                   if(ClientFactory.clientExists(clientURL))
                        bCreated = true;
                   else
                        try{
                             System.out.println("JSDTChatClient:Client Create Attempt '" + nTry + "'");
                             ClientFactory.createClient(this, clientURL, this);
                        }catch(AlreadyBoundException eX){
                             eX.printStackTrace();
                             System.exit(1);
                        }catch(PortInUseException eX){
                             nPort++;
                             Thread.sleep(5000);
                        }catch(TimedOutException eX){
                             System.out.println("JSDTChatClient:Client Create Attempt '" + nTry + "' Timed Out");
                             Thread.sleep(5000);
                   nTry++;
              if(bCreated)
                   System.out.println("JSDTChatClient:Client Created");
              else
                   System.out.println("JSDTChatClient:Client NOT Created");
                   System.exit(1);
              nPort = 4461;
              nTry = 1;
              bCreated = false;
              URLString sessionURL = null;
              while(bCreated == false)
                   sessionURL = URLString.createSessionURL(sHost, nPort, "socket", JsdtChatApp.sCHATTER);
                   if(SessionFactory.sessionExists(sessionURL))
                        bCreated = true;
                   else
                        try{
                             System.out.println("JSDTChatClient:Session Create Attempt '" + nTry + "'");
                             session = SessionFactory.createSession(this, sessionURL, false);
                        }catch(PortInUseException eX){
                             nPort++;
                             Thread.sleep(5000);
                        }catch(TimedOutException eX){
                             System.out.println("JSDTChatClient:Session Create Attempt '" + nTry + "' Timed Out");
                             Thread.sleep(5000);
                   nTry++;
              System.out.println("JSDTChatClient:Found Session '" + JsdtChatApp.sCHATTER + "'");
              try{
                   session = SessionFactory.createSession(this, sessionURL, false);
                   session.join(this);
                   session.addSessionListener(this);
                   System.out.println("JSDTChatClient:Joined Session");
              }catch(JSDTException eX){
                   eX.printStackTrace();
              while(true)
    //***********************     Client Listener Section     ***********************
         public void byteArrayExpelled(ClientEvent event)
         public void byteArrayInvited(ClientEvent event)
         public void channelExpelled(ClientEvent event)
         public void channelInvited(ClientEvent event)
              Session session = event.getSession();
              String sChn = event.getResourceName();
              System.out.println("JSDTChatClient: has been Invited to join Channel '" + sChn + "'");
              try{
                   Channel chn = session.createChannel(this, sChn, true, true, false);
                   chn.join(this, Channel.READWRITE);
                   System.out.println("JSDTChatClient:Joined Channel '" + chn.getName() + "'");
                   chn.addChannelListener(this);
              }catch(JSDTException eX){
                   eX.printStackTrace();
         public void sessionExpelled(ClientEvent event)
         public void sessionInvited(ClientEvent event)
         public void tokenExpelled(ClientEvent event)
         public void tokenInvited(ClientEvent event)
         public void tokenGiven(ClientEvent event)
    //***********************     Client Listener Section     ***********************
    //***********************     Channel Listener Inerface     ***********************
         public void channelJoined(ChannelEvent event)
         public void channelLeft(ChannelEvent event)
         public void channelInvited(ChannelEvent event)
              System.out.println("JSDTChatClient:Channel Listener - channelInvited from '" + event.getClientName() + "'");
              Channel chn = event.getChannel();
              try{
                   chn.join(this, Channel.READWRITE);
                   System.out.println("JSDTChatClient:Joined Channel '" + chn.getName() + "'");
              }catch(JSDTException eX){
                   eX.printStackTrace();
         public void channelExpelled(ChannelEvent event)
         public void channelConsumerAdded(ChannelEvent event)
         public void channelConsumerRemoved(ChannelEvent event)
    //***********************     Channel Listener Inerface     ***********************
    //***********************     Client Inerface     ***********************
         public Object authenticate(AuthenticationInfo info)
              String sRetVal = null;
              System.out.println("JSDTChatClient:authenticate \n" + info.toString());
              int nAction = info.getAction();
              char chType = info.getType();
              if(chType == AuthenticationInfo.SESSION)
                   if(nAction == AuthenticationInfo.CREATE_CHANNEL)
                        sRetVal = JSDTManager.sCREATE_CHANNEL_ALLOWED;
                   else if(nAction == AuthenticationInfo.JOIN)
                        sRetVal = JSDTManager.sJOIN_SESSION_ALLOWED;
              else if(chType == AuthenticationInfo.CHANNEL)
                   sRetVal = JSDTManager.sJOIN_CHANNEL_ALLOWED;
              else if (chType == AuthenticationInfo.REGISTRY)
                   sRetVal = JSDTManager.sCREATE_CLIENT_ALLOWED;
              return sRetVal;
         public String getName()
              return name;
    //***********************     Client Inerface     ***********************
    //***********************     Session Listener Inerface     ***********************
         public void byteArrayCreated(SessionEvent event)
         public void byteArrayDestroyed(SessionEvent event)
         public void channelCreated(SessionEvent event)
         public void channelDestroyed(SessionEvent event)
         public void sessionDestroyed(SessionEvent event)
         public void sessionJoined(SessionEvent event)
              String sN = event.getClientName();
              System.out.println("JSDTChatClient:sessionJoined from '" + sN + "'");
         public void sessionLeft(SessionEvent event)
         public void sessionInvited(SessionEvent event)
         public void sessionExpelled(SessionEvent event)
         public void tokenCreated(SessionEvent event)
         public void tokenDestroyed(SessionEvent event)
    //***********************     Session Listener Inerface     ***********************
         public void setName(String sN)
              name = sN;
         * @param args the command line arguments
         public static void main(String[] sArgs) throws Exception
              new JSDTChatClient(sArgs[0]);
    ******************* Code for JSDTChatClient.java *********************
    Hope this helps

  • Request threads not timing-out

    I am connecting to the crystal report server(11.5) using RAS APIs from my web application hosted on Websphere 6.
    It seems the threads are not timing out, below are the threads:
    com.crystaldecisions.thirdparty.com.ooc.OB.GIOPClientWorkerThreaded$SenderThread                                                               
    com.crystaldecisions.thirdparty.com.ooc.OB.GIOPClientWorkerThreaded$ReceiverThread      
    com.crystaldecisions.thirdparty.com.ooc.OB.GIOPServerStarterThreaded$StarterThread                                                             
    com.crystaldecisions.thirdparty.com.ooc.OB.GIOPClientWorkerThreaded$SenderThread                                                               
    com.crystaldecisions.thirdparty.com.ooc.OB.GIOPClientWorkerThreaded$ReceiverThread     
    I tried putting clientSDKOptions.xml in my web application but it doesn't seem to be working.
    Any inputs to this will be helpful.

    I'd give more details concerning the clientSDKOptions.xml.
    Sincerely,
    Ted Ueda

  • Os thread startup in Top 5 Timed Events AWR

    Hi all,
    I have Oracle 10.2.0.5 for HP UX
    I'm experiencing some slowness. While checking AWR I see the following:
    Top 5 Timed Events
    Event     Waits     Time(s)     Avg Wait(ms)     % Total Call Time     Wait Class
    CPU time          732          28.0     
    os thread startup      983      665      676      25.4     Concurrency
    log file switch (checkpoint incomplete)     1,279     617     482     23.6     Configuration
    row cache lock     98,641     577     6     22.1     Concurrency
    latch: session allocation     1,377     253     184     9.7     Other
    What could be the reason for os thread startup?
    too many processes due to parallellism?
    I have all tables in NOPARALLEL.
    And regarding log file switch (checkpoint incomplete), I changed redo size from 100 MB to 200 MB to reduce the frequency of logswitching.
    Thanks in advance.

    GOOGLE is your friend, but only when you actually use it!
    http://karlarao.wordpress.com/2009/04/06/os-thread-startup/

  • Providing locking for a thread spaned by the Timing service

    Platform:WL60, windows 2000
              I have a cluster where each member in the cluster has a thread started by
              the timing service. This is a queue manager(If JMS destinations had
              supported failover i would have implemented it with JMS). I want to be sure
              that just one of the threads in the cluster runs. If one is running the
              other threads should be blocked. How can I get this functionality?
              1. By adding an object to the JNDI context that is shared in the cluster.
              The thread will take this object and call a method witch is synchronized?
              Will synchronized methods work on a object in a JNDI Context?
              2. By envokeing a Entiety bean in a transaction in the thread. The other
              threads will be blocked until the thread that is running ends the
              transaction.
              Any other suggestions or comments?
              ~b
              

    I'm sorry to hear. Please send me your details in a PM and I will forward this to responsible person for your market to have someone contact you about this.
    Name:
    Country:
    Phone nr:
    E-mail:
    IMEI:
    Work order nr:
     - Community Manager Sony Xperia Support Forum
    If you're new to our forums make sure that you have read our Discussion guidelines.
    If you want to get in touch with the local support team for your country please visit our contact page.

  • Thread.sleep() timing

    The sleep method doesn't appear to have rock-solid timing. Does anyone know of antoher more stable way to pause in a program for a specified time period?

    Because your Java program is running inside of the JVM, which is in of itself a program too, and since the timing mechanisms are different in different OS's Java's only guarantee is that no less than the amount of time you specify in the sleep method will pass before the thread wakes up again. (i.e. Thread.sleep(10) will sleep for no less than 10 milliseconds, it might be 10, it might be 12, it might even be more than that, but it won't be 9)
    That's as good as it gets.

  • How can i regulate thread timing?

    in my Server/Client app, Server periodically sends an Object thru an ObjectOutputStream dn Client constantly listend for an ObjectInputStream. how can i prevent an ObjectInputStream to be created before an ObjectOutputStream is created to prevent a StreamCorruptedException? thanks

    yes they are. well here is the more detailed thread: http://forum.java.sun.com/thread.jspa?threadID=632037&tstart=15
    in a nutshell: Client is a Thread that sleeps and wakes up every 5 seconds to send "req" string. ServerClient receives the "req" and performs the necessary operations. in this case, its supposed to create an ObjectOutputStream and Client will receieve it using ObjectInputStream. this cycle sometimes goes on for 3 times, 5 times, 8 times, 15 times, or watever, its random. then it blows up and i get a StreamCorruptedException. I googled some stuff and read that it may be because an ObjectInputStream is created before an ObjectOutputStream. thats why i was asking if i can regulate this cycle thru some kind of timing.... or something.. i dunno i dont really understand the problem...

  • Thread safe Timed Set

    Hello,
    I'm trying to create a thread safe set that also contains a time when it was updated last. It's a cache of a table from the db. I am using CopyOnWriteArraySet as the set is going to be modified rarely, items from set are never modified or removed individually.
    There are couple of questions, is the an existing collection that I can use to achieve the same in JDK 6 (not external libraries)? Is there a better choice over CopyOnWriteArraySet? I tried searching but couldn't find anything.
    If not, would the following implementation suffice my requirements?
    Any suggestions greatly appreciated.
    Thanks in advance,
    -t
    public class CacheSet<T> extends CopyOnWriteArraySet<T> {
    private static final long serialVersionUID = 1L;
    private long lastSyncTime = 0;
    * @param lastSyncTime
    *          the lastSyncTime to set
    public synchronized void setLastSyncTime(long lastSyncTime) {
    this.lastSyncTime = lastSyncTime;
    * @return the lastSyncTime
    public synchronized long getLastSyncTime() {
    return lastSyncTime;
    }

    if you are caching the contents of a table, i assume you are only ever replacing the set. i would suggest something like this:
    public class TableData<T>
      private final Set<T> _tableData;
      private final long _timestamp;
      public TableData(Set<T> data, long timestamp) {
        _tableData = Collections.unmodifiableSet(data);
        _timestamp = timestamp;
      // normal accessors here
    public class TableCache<T>
      private volatile TableData<T> _curTable;
      public void update(TableData<T> newTable)
        _curTable = newTable;
      public TableData<T> get()
        return _curTable;
    }the basic idea is that the TableData class is immutable (e.g. when you update the cache, you create a new set and new TableData instance), so you don't need to worry about concurrency issues (you can pass it a normal HashSet or whatever). thread visibility issues are resolved by using volatile on the TableCache class.
    Edited by: jtahlborn on Apr 17, 2010 10:47 AM

  • Thread with timing

    i have learnt how to create threads.
    i heard that you can create a thread that executes every a certain amount of time.
    does anyone have any tutorial to recommend me?
    i wanted to search in the java tutorial section, but i do not know what to type to search.
    tq

    I don't know much about this subject because I use Quartz to schedule job execution, however this link might shed some light:
    [http://www.java2s.com/Code/Java/Threads/Java1550newfeatureThreadSchedule.htm|http://www.java2s.com/Code/Java/Threads/Java1550newfeatureThreadSchedule.htm]
    They use the java.util.concurrent.ScheduledExecutorService class.
    Hope this helps.

  • Bridge is slow because it's only using two threads

    I'm finding that Bridge (CS6) exhibits very poor performance when building 100% previews, I think the software is limited to only two threads.
    If you load bridge and go into a folder with some images and then Tools->Cache->Purge you'll see that Bridge takes a long time to rebuild the previews even on a high end machine, especially if you have both "Always High Quality" and "100% Previews" selected. I think the problem is that it appears to build the previews using only two threads on the CPU, so while a 2005 dual core machine might get maxed out, a Quad Core, or 8 Thread, or even 12 Thread machine sits there mostly idle while Bridge grinds away for an hour or more.
    It's easy to check this, just load up Windows Task Manager, and view the "Processes" tab and Bridge will only ever use 2 threads worth of CPU cycles, i.e. 50% on a Quad Core, and 17% on a 12 Thread high end desktop. I've seen the problem with JPG files, PSD files, and NEF files (Nikon RAW). The processing time of large Nikon D800E NEF files is very slow. After shooting 900 images I can expect the preview build time to take over an hour on a super high end machine with loads of memory, storage IO, and CPU cores and threads, all because it appears bottlenecked on software design. Meanwhile the machine is only running at roughly 20% utilization, the memory barely used, and the IO system close to idle.
    I'm using Windows 7 Ultimate 64-bit, 64GB RAM, 12 Thread Core i7 3960X at 4Ghz, two Nvidia GTX470 graphics (in SLI), a 2-way RAID-0 SSD storage array for the OS, and an 8-way RAID-0 SSD array for the photoshop work files. The hardware is clearly not the issue. Although, just to check, I confirmed the same problem exists on a simple Win8 Core i7 system, and a Core i5 laptop.
    Even worse, after waiting an hour to build previews for 900 images (3 seconds each), after adding GPS data, or after making edits in Camera Raw it then needs to rebuild all the previews again, this is understandable, but super fustrating when you know it's not working as fast as it really should be.
    To be clear, I'm not upset it takes 6 seconds per image per thread - there's a lot of work to do, especially with D800 files. But I'm upset that Bridge's software design only uses 2 threads, and thus limits performance to building a preview every 3 seconds, when in fact it could be working 6 times faster on a PC with 12 thread, and I find it shocking that Adobe's latest software wouldn't be optimized for anything more than a dual core CPU, wasn't quad core launched in 2006?
    Roland.
    P.S. for any Adobe Tech's reading - I submitted this under case number 184020852 and there's an attached PDF in the ticket including several screenshots.

    There have been many discussions in Photoshop forum about processor speed and multicores.  I know Bridge is not Photoshop but it may give you some insight as what is going on.  Photoshop has supported multithreading since CS3.  Here is a quote from Adobe Tech Note:
    Photoshop generally runs faster with more processor cores, although some features take greater advantage of the additional cores than others. There is a law of diminishing returns with multiple processor cores: The more cores you use, the less you get from each additional core. Therefore, Photoshop doesn’t run four times as fast on a computer with 16 processor cores as on a computer with four cores. For most users, the increase in performance that more than six cores provides doesn't justify the increased cost.
    I run embedded thumbnails (therefore 100% previews are off) as they take up less space and are the fastest to load.  I ran a simple test with Bridge CS5 (32 bit) and CS6 (64 bit) on one folder of 200 video images totaling 16 gigs, or 80 meg per file.  With folder loaded I clicked Tools/Cache/purge cache for xxx folder.  I then timed the rebuild until the arrow stopped spinning in lower left hand corner.  For CS5 the time was 35 seconds.  For CS6 the time was 72 seconds. 
    I then took a folder of 1147 jpg images of 660 meg (427k/image).  In CS5 it took 12 seconds to build the cache, and the same for CS6.  However, the interesting part of this is when I loaded this folder in CS6 I had never been there before so it had to build it.  THis took 80 seconds.  When I purged it an it rebuilt it took 12 seconds.  I have noticed this phenomemum before where the initial build takes 5-7 times longer than a rebuild of the cache.
    I then ran the same test with the still images with 100% preview and Always High Quality.  With CS5 it took 3 min 30 seconds and with CS6 it took 5 min. 20 seconds.
    So with these very SIMPLE tests I conclude that CS6 has quite a bit slower cache process than CS5.  As we have all learned with buying new products, new and improved does not always mean it is better. 

Maybe you are looking for

  • Apple TV and iTunes problem - Different Twist

    I, too, can no longer get Apple TVs to show up in my iTunes device list. It DID work until last week when I downloaded two movies. They ATVs (three of them) got stuck in syncing, and were still "syncing" four days later. I quit the app, restarted it,

  • Macbook Pro Crash Down

    Hi, I have a I7 macbook pro. And when a use videos or photos my macbook crash down and restart. Appear this message below. Can u help me? Anonymous UUID:       E72ED860-0FF2-9700-F2B3-E0F0D082BEE0 Sun Mar 30 02:16:22 2014 panic(cpu 0 caller 0xffffff7

  • ChaRM: Support of more than one transport layer

    Hi! We would like to implement ChaRM for the 3 tier landscape (DEV:100 --> QAS:200 --> PRD:100) with several transport layers and transport routes: a) u201CZDEVu201D u2013 Standard transport layer b) u201CSAPu201D u2013 SAP transport layer c) u201CYC

  • No direct postings possible

    hi, sap gurus, while creating G/L account for Payable for services system is throwing an error called "No Direct Postings Possible: i dont know what went wrong please suggest me to correct this issue regards, balaji.t

  • Problem with EMDP0001 customer field es60

    Hi everybody. I added a new field (ci_evbs) in the t-code es60 using EMDP0001.  The new field is showed in the t-code. the problem is that the data is not saved in the field, either in the table. my new fied is called "zzpsumintxt01" I have filled th