Problem about Sparc/solaris10 signal in multi-thread environment

Normally if we send a signal to a process which has several threads, the main thread of this process will handle this signal. But I found in some cases an other thread (not main thread) handled signals even if main thread was alive(mostly main thread was being blocked by __pollsys()).
I want to know why and how this happens.
Thanks.

according to man signal.h from a solaris 10 machine ...
Asynchronously generated signals are not directed to
a particular thread but are handled by an arbitrary thread
that meets either of the following conditions:
.... a list of conditions.
So if you have threads that you don't want to take signals, then those threads
must block that signal eg pthread_sigmask()
it is just chance that it usually goes to your "main" thread.
tim

Similar Messages

  • Multiple Containers read/write access in multi-threaded environment

    I'm been reading the Berkeley DB XML Transaction Processing document and have a few questions. I have a multi-threaded environment (not multi-process).
    1) In the "Summary and Examples" section, there is an example of several worker threads that perform many writes to a shared container. The one container is passed to all the worker threads, rather them having their own instance of the container. In my application, I could potentially have multiple worker threads acting on the same container, is it better to provide some type of connection pool, so each thread has access to the same container? Is their a problem with each thread creating a new instance of the container and writing to that? Is their pros and cons to each approach?
    2) In some specific web applications, they only require read-access and have no intention of writing to the database. If the environment was created with transactions, can these applications open the environment in read-only mode, so as to not suffer the performance penalty of using transactions? Or do they still require transaction support since other threads in other applications might be writing to it. Is it better in this case to
    3) Is there any decent connection pooling framework that work well with BDB XML? If transactions are involved, it seems pretty important to always close the container once you are finished with it, which kind of defeats the purpose of pooling. I see a container somewhat analogous to a JDBC transaction, where in connection pooling these transactions remain open, but in BDB XML, it doesn't seem like this is good practice. So clarification here would be appreciated.
    Thanks in advance...
    Chris

    Chris,
    I'd be careful about trying to draw too many analogies with other sorts of systems. In many ways BDB XML is simpler -- it's just a library, no server process.
    An open container is analogous to an open file handle/descriptor in your operating system. It can safely be shared by all threads within a given process. In fact, you should not create more than one -- while that works, it can just be confusing, and a source of errors (for example, if you use a different path to open the container each time, you'll have problems). So by all means share them. Most Java applications just point them in a class that is accessible to all threads.
    Other objects that can, and should be shared among threads include:
    Environment
    XmlManager
    XmlQueryExpression
    Most others should not. You also mention closing your containers -- there is no reason to close your active container objects until your application needs to shut down. A long-running application will want to use db_checkpoint (or equivalent) to ensure that modified pages are flushed from the transaction log to the database files, but that's about it.
    As for concurrency, you obviously need transactions for concurrent write operations. If you want concurrent read access to the same containers, they should use transactions as well. Even if you don't explicitly use transactions, locks are always taken on pages in transactional containers. You cannot open the same container transactionally and not transactionally at the same time -- bad things could happen.
    Depending on your performance needs, you could using snapshot concurrency, and see how it works for you. While locking does incur some overhead, it may be acceptable.
    You mention creating your own "snapshot" of a container and running read-only on that copy. That's possible to do, but you have to be careful of how you create the snapshot (following hot backup procedures). Also, if you intend to open that "new" container in the same environment or application as the old one, you need to run a program on it to change its internal identification so Berkeley DB won't think it's the same file. That is, you can't just copy a container file to a new name and just open it like it's a new container if it's still in the vicinity of the original. See the -r option for the db_load program.
    Now that you are probably really confused, good luck!
    Regards,
    George

  • Static methods in multi-thread environment.

    Sorry for this silly question, but I have no clue...
    If you're using classes with static methods in a application server environment, would that imply all threads use that same 'one in the jvm' method and would there be a possibility for performance loss?
    Is calling another static method from a static method a good idea in a multi-thread environment, with respect to performance? Somehow I seem to get this java.lang.NoClassDefFoundError. Any ideas? The classes are in the same package. I only get these kind of problems calling static methods from static methods in a multi-thread environmnent. The static methods are pure utility functions and of course do not use class state.
    Thanks for your help.

    Sorry for this question, wasn't thinking straight. I have the answer, won't post question on multiple forums.

  • Memory leak with multi-threaded environment

    When starting an environment with the THREADED_MUTEXED
    or THREADED_UNMUTEXED mode parameter, the oracle OCCI API
    has a memory leak. This can be demonstrated by modifying
    the "occidml.cpp" demo program as follows:
    Replace line 26:
    env = Environment::createEnvironment (Environment::DEFAULT);
    with
    env = Environment::createEnvironment (Environment::THREADED_MUTEXED);
    And replace line 164:
    demo->displayAllRows();
    with
    for (int ii=0; ii<10000; ii++) demo->displayAllRows();
    Recompile and run the program, and use "top" to see the
    size of the process's used memory continually increase
    unbounded.
    I am using the Oracle 9.2.0.1.0 database on Linux,
    gcc version 2.96.
    Is anyone aware of a fix for this problem?

    Yeah, I did suffer from this.
    If possible , you can switch to using OCCI on Oracle 10G client , you will find no memory leak issue anymore.
    Another issue is that OCCI is using default connection-blocking implementation , if a DB connection is blocked by accident just like plugging out the network link, you can not get any timeout or connection closed indications. You must implement your own OCCI connection timeout strategy, and you must kill the thread/process you are using.

  • Static methods in multi-threaded environment

    Hi,
    I am wondering what happens when several threads try to access the same static method ?
    The static method is not synchronized.
    Will this create any performance issues ?
    The actual scenario is of a J2EE server, where several Session Bean instances try to access a static method in a utility class. Will some session beans have to wait till others are being serviced ?
    thnx n regards
    s giri

    thanx for replying.
    yes. the operations are thread-safe. we do not change the state of any object.
    but we make an rmi call to another application thru this static method.
    is it ok?
    Currently, my session bean has too many private methods - each calling the other application. Due to some quality metrics (a class must be restricted to 700 lines) we have to consider moving these private methods into some Helper class in the form of "public static methods". We have made many utility methods as static, but have some reservations abt doing a similar thing for these methods that call other application.
    regards
    Shivraman

  • Using iTunes SDK in multi thread environment

    I'd like to use the Windows iTunes COM SDK in a multithread manor.
    Ex. create the iTunes COM object in thread A and use it again in thread B.
    How it the COM interface for iTunes defined (MULTITHREADED, APPERTMENT THREAD, SINGLETHREADED)
    Can I then marshall the interface, between interfaces, without deadlocking my app? (I hate frozen apps, so I use threads as much as possible).

    Annoyingly the SDK hasn't been updated in over three years. I've had a casual look via Visual Studio's object inspector to see if I can spot any new methods or properties that could be useful but if they are there then they are hidden well. Media Kind, for example, was introduced in iTunes 9, I think, but can't be read from code.
    I don't know what tasks you're hoping to automate, but you might find some of my scripts useful either in their own right or as food for thought.
    tt2

  • Question using Java API in a multi threaded application for MDX queries

    Currently I’m building a web application that makes a lot of MDX calls using the Essbase Java API. Each time we run an MDX call we basically run the following code:
    IEssbase ess = IEssbase.Home.create(IEssbase.JAPI_VERSION);
    IEssDomain dom = ess.signOn(userName, password, false, null, "embedded");
    IEssCubeView cv = cv=dom.openCubeView("view", hostName, appName, cubeName);
    IEssOpMdxQuery op = cv.createIEssOpMdxQuery();
    op.setQuery(false,mdx,false,IEssOpMdxQuery.EEssMemberIdentifierType.NAME);
    cv.performOperation(op);
    IEssMdDataSet mddata = cv.getMdDataSet();
    cv.close();
    My questions is, is this the correct way to use the API in multi threaded environment where many users may be hitting the application at the same time? For every request do I need to create a separate IEssbase object and sign on to an IEssDomain? Or can I use a single IEssbase and IEssDomain object for the entire application? If not should I call the IEssDomain.signOff() method after each user’s request has completed? Which of the above objects are thread safe? I’m using Essabae 9.3.1. Any insight would be really appreciated.
    Thanks
    David

    Thanks for the input friend,
    I should have mentioned that in my application all
    connections to Essbase use the same user name and
    password so the filtering isn’t a concern. This is my
    first Java application using Essbase has a data
    source, I’m used to connecting to various SQL
    databases and I always use a connection pool, how is
    connection pooling handled in the Essbase java API?I'm not sure what happened to it since I never used it, but there used to be something called the High Availability Services or something that was essentially a connection pool for Essbase JAPI connections, but it required an extra license.
    Since you don't care about identity (everyone has full access to everything), you can create your own connection pool, but you'll have to manage your multithreading yourself. Its been this way since the beginning. The C API isn't/wasn't thread-safe either (we tried).

  • Force a multi-threaded client to use more than one proxy.

    I have a multi-threaded client app. that I'm using to test our proxy throughput. I've run into the same problem I've seen other people run into where the client application threads all get sent via the same proxy (in my case, I have 16 proxies available and configured in the client config.)
    Now I've seen threads like this one: Re: How to dynamically connect Extend client to proxy server?
    I just wondered, has a solution appeared since that time? I guess Coherence 3.6 and 3.7 have appeared in the interim. I'm on 3.6.1.4.
    My "Coherence specific" code is all localised in each thread and nothing is shared, so I guess the behaviour I'm seeing is something to do with the way Coherence initialises it's client classes within the JVM, rather than something it defers until a cache connection is established.
    Any solutions to this problem, so I can get my multi-threaded client (where each thread opens a NamedCache connection and then establishes a CQC against it) to use all (or at least more) of the available 16 proxies?
    Cheers,
    Steve

    I have a multi-threaded client app. that I'm using to test our proxy throughput. I've run into the same problem I've seen other people run into where the client application threads all get sent via the same proxy (in my case, I have 16 proxies available and configured in the client config.)
    Now I've seen threads like this one: Re: How to dynamically connect Extend client to proxy server?
    I just wondered, has a solution appeared since that time? I guess Coherence 3.6 and 3.7 have appeared in the interim. I'm on 3.6.1.4.
    My "Coherence specific" code is all localised in each thread and nothing is shared, so I guess the behaviour I'm seeing is something to do with the way Coherence initialises it's client classes within the JVM, rather than something it defers until a cache connection is established.
    Any solutions to this problem, so I can get my multi-threaded client (where each thread opens a NamedCache connection and then establishes a CQC against it) to use all (or at least more) of the available 16 proxies?
    Cheers,
    Steve

  • HELP!....GUI crashes when i call a multi-threaded program from it

    Hi..I have encountered a problem in my end of year project, which i cant see to solve. The problem is i am starting a multi-threaded program for a JButton on a GUI. All though this starts the other program it crashes the GUI completely how do i stop this.
    this is the code i use to call the threaded program.
    public void actionPerformed(ActionEvent e)
    Object target=e.getSource();
    String line = new String();
    if( target==b1 )
         try
    cl = new client();
         cl.startup();
         catch(Exception ex){ex.printStackTrace();}
    thanks Mike

    No there is no exceptions being given. this is one of the reasons why i dont no what to do. i thought myself that the threaded was taking all the resources and not going back to the GUI. if this is the case is there anyway that i can call back the GUI and keep the threaded program running?
    thanks
    mike.

  • JMS multi thread best practise

    Hi,
    I would like to code a JMS layer that could be accessed by
    a multi thread environment (a web app)
    Is there any "Connection-Pool/DAO" equivalent design
    pattern for JMS ?
    Form what I know, connection are Thread Safe and Sessions
    are not ...
    Philippe

    Many J2EE providers have their own JMS facades which provide pooling - so you could just use your container's JMS wrappers.
    Another option, if you are inside a Servlet Engine, is to use Jencks which provides JMS & JDBC connection pooling as well as pooling of threads & message listeners & exception handling when consuming JMS messages.
    e.g. here's inbound message consumption...
    http://jencks.org/Message+Driven+POJOs
    and here's outbound JMS (i.e. pooling when sending JMS messages etc)
    http://jencks.org/Outbound+JMS
    Jencks is basically a Spring based JCA container so it takes care of all the pooling for you as well as handling message inflow & outflow and can work with XA if you need it as well as local transactions.
    James
    http://logicblaze.com/

  • The problem about multi-thread in java application

    i have problem with the multi-thread in java application, i don't know how to stop and restart a thread safely, because the function thread.stop(),thread.suspend() are both deprecated.
    now what i can only do is making the thread check a flag(true or false) to determine whether to start or to stop, but i think this thread will always be in the memory and maybe it will lower the performance of the system, as the program i am developping is working under realtime enviorement.
    please help me about it. thanks !

    hi,
    you can stop a thread by exiting it's run()-method which in terms can be done by checking the interrupted-flag:
    public void run(){
    while(interrupted()){ //if the thread consists of a loop
    or
    public void run(){
    if(interrupted())return;
    if(interrupted())return;
    or by the use of the return-statement anywhere withing the run-method. Afterwards, that is when the thread is no longer needed, you clear all the references to the specific thread object by setting them to null:
    Thread t;
    ... //working
    t.interrupt(); //interrupting
    while(t.isAlive()){
    Thread.yield(); //wait till thread t has stopped
    t=null;
    best regards, Michael

  • Some general questions about multi-threading

    Hey Everybody,
    I have a dilemma with a multi-threaded program that I have written.
    Well to be truthful I actually wrote the program with no consideration whatsoever for multithreading.
    As a result of this complete lack of concern I get a completely hung user interface.
    My program performs a lot of network communications over URL��s and also writes information from URL��s to disk. The combination of networking and I/O in my program and the fact that I have not built multi-threading into the program has lead to complete failure of the user interface. When I say complete failure I mean complete failure. If it were only button��s not responding then I wouldn��t be all that worried, however the entire drawing area of my programs ��Frame�� completely freezes. It��s cool if nothing is maximized or minimized over the frame but as soon as this happens my programs drawing area has a ��serious hang over!��.
    I have begun learning about threads, in principle they sound wicked however in practice they have proven to be a brain tease (oops �K.. honesty).
    The difficulty of threads should not be all that daunting to me, however I have a couple of very simple questions that I would love to have answered�K..anybody out there!!!!!!!!!
    This is the normal basic method of running a thread that I have been attempting to incorporate into my program:
    1). Extend the thread class,
    2). Override the run() method in the subclass (created from step 1),
    3). Create an instance of the subclass,
    4). Call the start() method on the instance (from step 3).
    I have read that every statement the thread will execute is contained within it��s run() method.
    Question 1). This being the case is it possible to have member variables or methods inside a class that extends thread? Please explain!
    Question 2). Can a class that extends thread contain a constructor? Please explain!
    Question 3). If a subclass of thread cannot contain a constructor as I assume to be the case then how can code executing within the newly spawned thread reference information from the object that spawned it?
    If anybody out there on the great net can answer even half of one of these questions I will be more than grateful. Thanks for your time, and rock on Java!
    David

    Thread t = new Thread(MyRunnableDerivedClass);
    t.start();I hope it is understood that MyRunnableDerivedClass is actually an object of the MyRunnableDerivedClass. sorry for the confusion.
    so here's a thread that reads from a file using constructors, member variables, other funcs. It's not optimal but shows use of all of the above. I just typed this in so there are probably syntax errors, but you should get the point.
    public class ThreadedFileReader implements Runnable
        private File m_File;
        byte[] contents = new byte[0];
        public ThreadedFileReader( File f )
           m_File = f;
        public void run()
            BufferedInputStream bis = null;
            try
                bis = new BufferedInputStream( new FileInputStream( m_File ));
                int avail = bis.available();
                while (avail > 0)
                    int oldLen = contents.length();
                    contents = expand( contents, avail );
                    bis.read( contents, oldLen, avail );
                    avail = bis.available();
            catch (Exception e)
            { //do something witty
            finally
                try{ if (bis != null) bis.close(); } catch (Exception e){}
       private byte[] expand( byte[] oldBuf, int addedLen )
          byte[] newBuf = new char[oldBuf.length + addedLen];
          System.arrayCopy( newBuf, 0, oldBuf, 0, oldBuf.length );
          return newBuf;
       public byte[] getContents()
           return contents;
    //here's where we use it
    File f = new File( "c:\myfile" );
    ThreadedFileReader tfr = new ThreadedFileReader( f );
    Thread t = new Thread( tfr );
    t.start();
    t.join();
    // At this point the thread has died, but the thread object still exists
    byte [] data = tfr.getContents();

  • Multi-Instrument + Multi-Thread problem found

    Right.....I have done a lot of research on why logic was not multi-threading correctly and have narrowed it down to one problem...using Kontakt as a multi instrument.
    My Mac is a 2 x 2.26 GHz Quad-Core Intel Xeon. This means that it is capable of distributing work loads over the multiple cores of the CPU to prevent core audio overloads from happening.
    If I run any plug ins in stereo or mono mode, the CPU acts as it should; I will load up a program, add processing and when the load is becoming a strain for the CPU, I use a bus send and work on that, then the workload is redistributed across more of the cores by logic, allowing me to continue working.
    However, I need to use Kontakt as a multi instrument. I usually have 3 instances of Kontakt open and on each one of these, I usually have a minimum of 10 outputs being sent to the aux channels of logic. Therefore using Kontakt as a stereo instrument is not an option, as I would have to open around 30 instances!
    Here is the problem; say for example, in Kontakt I send a kick drum out of Kontakt into AUX 3 + 4. The AUX channel in logic will being to show output. I can now EQ this single kick drum seperate from any other sound in logic.
    If I began to add processor heavy plug ins to this AUX output, rather than share the workload across the cores as it should and does with stereo instruments, logic now only uses a single core and it will core audio overload very quickly.
    As I said, this only happens when I set up Kontakt as a multi instrument. The main problem is when I begin to have many different outputs from my 3 instances of Kontakt, as by this stage, many different sounds will have processing. All 3 multi instruments and their processing are then controlled by the single processor and the other 7 are almost inactive! It therefore becomes impossible to use Kontakt and I have to switch to stereo instances. This happens for all multi-instruments not just Kontakt.
    I have just purchased Kontakt 4, I am upgrading to OSX 10.6 (Snow Leopard) and am updating Logic to v9.1. (From v9.0) Will this help at all? Is there an answer to this problem or will I just have to open 30 stereo and mono instances of Kontakt to continue working!
    I have included a link to a ZIP file with two photos of the problem. In the photo named MASSIVE. I have one instance of massive running as a stereo instrument. It is sent to a BUS where I applied the WAVES L316 Limiter. I did this multiple times and if you can see on the system performance (Top right) Logic is sharing the workload over the processors as it should.
    In the second picture named KONTAKT MULTI - I have done the same thing, but I have opened Kontakt as a multi instrument, sent a kick drum to AUX 2 and then forwarded this to a send where I applied the same WAVES L316. You can see on the system performance meter (Top Right) that Logic now does not re-distribute the workload, it is using one core and anymore plug ins applied to the AUX or bus channels relating to Kontakt will now make it core audio over load, even though now I am using far less processing.
    PHOTOS: http://www.sendspace.com/file/og8a94

    Ditto
    Using Pro 8 Studio, I had this problem after installing Snow Leopard.
    Invested £159 in Pro 9 update, same problem.
    This has stopped most of my work since my external WK4 sounds are superior to the included software sounds.
    As suggested, will now report since since it obviously seems to be a general problem.

  • The problem of profiling a multi-thread flash game  using adobe scout cc

    I have a multi-thread flash game code, it can run perfectly. The main swf creates another swf which will connect to a remote server. I can get profiling information of the main swf  using adobe scout cc, but the problem is that I can't get profiling information of another swf ! The scout complains " can't start a session because the telemetry data isn't valid" for another swf. Although some times, the scout does not complain, the Summary Panel of scout provides information“We encountered an error while processing this session: Some of the data we present may not be correct". And the scout log file shows:
    Log file created: 2014/11/20 15:35:08
    11/20/2014 15:35:08.395 Scout starting up.
    11/20/2014 15:35:08.471 InitDNSService failed
    11/20/2014 15:36:47.055 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [100000,200000] is greated than its parent
    11/20/2014 15:36:47.057 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [200000,300000] is greated than its parent
    11/20/2014 15:36:47.058 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [300000,400000] is greated than its parent
    11/20/2014 15:36:47.058 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [400000,500000] is greated than its parent
    11/20/2014 15:36:47.061 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [500000,600000] is greated than its parent
    11/20/2014 15:36:47.062 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [600000,700000] is greated than its parent
    11/20/2014 15:36:47.063 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [700000,800000] is greated than its parent
    11/20/2014 15:36:47.063 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [800000,900000] is greated than its parent
    11/20/2014 15:36:47.064 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [900000,1000000] is greated than its parent
    11/20/2014 15:36:47.064 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1000000,1100000] is greated than its parent
    11/20/2014 15:36:47.064 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1100000,1200000] is greated than its parent
    11/20/2014 15:36:47.065 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1200000,1300000] is greated than its parent
    11/20/2014 15:36:47.065 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1300000,1400000] is greated than its parent
    11/20/2014 15:36:47.065 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1400000,1500000] is greated than its parent
    11/20/2014 15:36:47.066 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1500000,1600000] is greated than its parent
    11/20/2014 15:36:47.066 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1600000,1700000] is greated than its parent
    11/20/2014 15:36:47.066 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1700000,1800000] is greated than its parent
    11/20/2014 15:36:47.067 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1800000,1900000] is greated than its parent
    11/20/2014 15:36:47.067 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [1900000,2000000] is greated than its parent
    11/20/2014 15:36:47.067 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2000000,2100000] is greated than its parent
    11/20/2014 15:36:47.068 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2100000,2200000] is greated than its parent
    11/20/2014 15:36:47.068 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2200000,2300000] is greated than its parent
    11/20/2014 15:36:47.068 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2300000,2400000] is greated than its parent
    11/20/2014 15:36:47.069 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2400000,2500000] is greated than its parent
    11/20/2014 15:36:47.069 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2500000,2600000] is greated than its parent
    11/20/2014 15:36:47.069 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2600000,2700000] is greated than its parent
    11/20/2014 15:36:47.070 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2700000,2800000] is greated than its parent
    11/20/2014 15:36:47.070 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2800000,2900000] is greated than its parent
    11/20/2014 15:36:47.070 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [2900000,3000000] is greated than its parent
    11/20/2014 15:36:47.071 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [3000000,3100000] is greated than its parent
    11/20/2014 15:36:47.071 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [3100000,3200000] is greated than its parent
    11/20/2014 15:46:30.931 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [100000,200000] is greated than its parent
    11/20/2014 15:46:30.933 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [200000,300000] is greated than its parent
    11/20/2014 15:46:30.936 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [300000,400000] is greated than its parent
    11/20/2014 15:46:30.937 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [400000,500000] is greated than its parent
    11/20/2014 15:46:30.937 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [500000,600000] is greated than its parent
    11/20/2014 15:46:30.937 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [600000,700000] is greated than its parent
    11/20/2014 15:46:30.937 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [700000,800000] is greated than its parent
    11/20/2014 15:46:30.938 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [800000,900000] is greated than its parent
    11/20/2014 15:46:30.938 <2896> <telemetryCore.Query> <1> Incorrect data: Memory category 7 for frame stats query over time interval [900000,1000000] is greated than its parent
    I run flash code directly on flash_player_11_7_sa.exe. I think the problem may have something to do with ActionScript Sampler of scout, because I can get the correct profiling information  without ActionScript Sampler.
    But I don't know what the information in the log file means.

    We are using Microsoft SQL Server 2008 . but it's well with MySQL & JBoss

  • PROBLEM OF MULTI-THREAD?????

    Hi I'm writing a program like Multi-tap (the text entry before T9 introduced) on mobilephone.
    I'm having problem with some of the KEYs. They do not work properly.
    As indicated in the code
    HERE HERE [3] suppose to function as space button....However whenever the key is pressed before the 'time out' (I use sceduler to implement the time out) it will print half of the previous character instead of space. this key is not related to the scheduler. so i suspect it is something related to multi-thread programming.
    HERE HERE [1] function as the caps lock. it can even show the indicator properly.... so i need to settle this b4 i continue.
    HEREHERE [2] function as clear button. it doest work too
    Someone please help me....
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package textEntry;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.*;
    import java.util.*;
    * @author Ed's
    public class MyCanvas extends GameCanvas {
        public static final String[] keys =
        {".?!,@`-_:;()&\'\"~10�$��+x*/\\|[]=<>#","abc", "def", "ghi", "jkl",
        "mno", "pqrs", "tuv", "wxyz"};
        public static final String[] capitalKey =
        {".?!,@`-_:;()&\'\"~10�$��+x*/\\|[]=<>#","ABC", "DEF", "GHI", "JKL",
        "MNO", "PQRS", "TUV", "WXYZ"};
        StringBuffer width = new StringBuffer();
        Timer keyTimer;
        textEntryMain main;
        public static char ch;
        public boolean keypress=false;
        public boolean capital;
        public boolean diffrentKey;
        String currentIndicator="abc";
        int countPress=0;
        //int previndex=0;
        public int counter=-1;
        int index=-1;
        int print=0;
        int white_space=6;
        public StringBuffer sms;
        int baseline=10;
        int y_axis=12;
        int line=1;
        char last;
        boolean dontPrint=true; //dont print if timer printed or it is at begining
        Font font;
        Graphics g;
        public long time;
        int poundHit=0;
        String justPressed;
        String prevPressed=null;
        char prevChar;
        //Sms class
        Form smsfrm;
        TextField smsField ;
        //Char Selection speed
        public boolean first;
        int selection_speed=1500;
        //font color (blue)
        public int red=0,green=0,blue=255;
        //Background color (white)
        public int back_red=250,back_green=250,back_blue=250;
        Form menu;
        public MyCanvas(textEntryMain main){
            super(false);
            first=true;
            this.main=main;
            sms=new StringBuffer();
            g=getGraphics();
            font=Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD,Font.SIZE_LARGE);
            keyTimer = new Timer ();
            keyTimer.schedule (new task (this), selection_speed, selection_speed);
            drawIndicator(currentIndicator);
        public void drawIndicator(String indicator){
            Font f = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_SMALL);
            Graphics g = getGraphics();
            g.setFont(f);
            int x= getWidth()-20;
            g.setColor(back_red,back_green,back_blue);
            g.fillRect(x,2,15,10);
            g.setColor(20,20,20);
            g.drawString(indicator, x, 2, g.TOP|g.LEFT);
        public void callPaint(char ch){
            drawIndicator(currentIndicator);
            Graphics g= getGraphics();
            g.setColor(back_red,back_green,back_blue);
            if(first){
                g.fillRect(0,0,getWidth(),getHeight());
                reset();
                redrawAll();
                first=false;
            //baseline -1 so that i can cover the pointer
            g.fillRect(baseline-1,y_axis,font.charWidth(this.last)+3,font.getHeight());
            g.setColor(red,green,blue);
            g.setFont(font);
            g.drawChar(ch,baseline,line*24,g.LEFT|g.BASELINE);
            flushGraphics();
        public void showPointer(){
            Graphics g = getGraphics();
            g.setColor(0,0,0);
            g.drawLine(baseline,y_axis,baseline,2*line*12);
            flushGraphics();
        //pointer appear //pointer disappear-use white line so that it cover the pointer line
        public void hidePointer(){
            Graphics g = getGraphics();
            g.setColor(back_red,back_green,back_blue);
            g.drawLine(baseline,y_axis,baseline,2*line*12);
            flushGraphics();
        //draw the selected
        public void ConfirmPaint(char ch){
            Graphics g = getGraphics();
            sms.append(ch);
            g.setColor(red,green,blue);
            g.setFont(font);
            g.drawChar(ch,baseline,line*24,g.LEFT|g.BASELINE); //draw the selected
            baseline+=font.charWidth(ch); // so that the nect letter won't be drawn on the same position
            if(baseline>getWidth()-30){     //move to the next line
                width.append((char)baseline);
                baseline=10;y_axis+=24;
                line+=1;
            flushGraphics();
        public synchronized void deleteChar(){
            if(sms.charAt(sms.length()-1)==' '){
                baseline-=white_space;
                Graphics g= getGraphics();
                g.setColor(back_red,back_green,back_blue);
                g.fillRect(baseline,y_axis,font.charWidth(sms.charAt(sms.length()-1))+2,font.getHeight());
                sms.deleteCharAt(sms.length()-1);
            else{
                baseline-=font.charWidth(sms.charAt(sms.length()-1));
                Graphics g= getGraphics();
                g.setColor(back_red,back_green,back_blue);
                g.fillRect(baseline,y_axis,font.charWidth(sms.charAt(sms.length()-1))+2,font.getHeight());
                sms.deleteCharAt(sms.length()-1);
            flushGraphics();
        public void redraw(char ch ){
            Graphics g= getGraphics();
            g.setColor(red,green,blue);
            g.setFont(font);
            g.drawChar(ch,baseline,line*24,g.LEFT|g.BASELINE);
            baseline+=font.charWidth(ch);
            if(baseline>getWidth()-30){
                width.append((char)baseline);
                baseline=10;y_axis+=24;
                line+=1;
            flushGraphics();
        public void reset(){
            if(width.length() >0)
            width.delete(0,width.length()-1);
            line=1;
            baseline=10;y_axis=12;
        public void redrawAll(){
            Graphics g=getGraphics();
            g.setColor(back_red,back_green,back_blue);
            g.fillRect(0,0,getWidth(),getHeight());
            reset();
            for(int a=0;a<sms.length();a++)
            redraw(sms.charAt(a));
        /*public synchronized void keyRepeated (int keyCode) {
            int one=1;
        /*    if(keyCode != KEY_POUND && keyCode != KEY_STAR){       
                ConfirmPaint((char)keyCode);
            if (keyCode == 1){
            ConfirmPaint((char)one);
        public synchronized void keyPressed (int keyCode) {
            justPressed=getKeyName(keyCode);
            time=System.currentTimeMillis(); // record the time when the keypress is pressed
            if(justPressed.equals("NUM0")){ //caps lock show indicator .............HERE HERE HERE HERE [1]
                if(poundHit == 0){
                    currentIndicator="ABC";
                    poundHit++;
                    drawIndicator(currentIndicator);
                    //set the string buffer to another one
                if(poundHit == 1){
                    currentIndicator="123";
                    poundHit++;
                    drawIndicator(currentIndicator);
                if(poundHit == 2){
                    currentIndicator="abc";
                    poundHit=0;
                    drawIndicator(currentIndicator);
            if(justPressed.equalsIgnoreCase("SEND")){ //send button allocated as clear button   ................. HERE HERE HERE [2]
                if(sms.length()>0){
                    hidePointer();
                    if(baseline<=10){
                        System.out.println(baseline);
                        line-=2;
                        baseline=(int)width.charAt(line);
                        line++;
                        y_axis-=24;
                    deleteChar();
            if(justPressed.equals("STAR")){//space  ........................................    HERE HERE HERE HERE HERE [3]
                    hidePointer();
                    sms.append(" ");
                    baseline+=white_space;
                    showPointer();
                    prevPressed=justPressed;
            else{
                if(justPressed.equals("NUM1")){index=0;}       
                if(justPressed.equals("NUM2")){index=1;}
                if(justPressed.equals("NUM3")){index=2;}       
                if(justPressed.equals("NUM4")){index=3;}       
                if(justPressed.equals("NUM5")){index=4;}
                if(justPressed.equals("NUM6")){index=5;}
                if(justPressed.equals("NUM7")){index=6;}
                if(justPressed.equals("NUM8")){index=7;}
                if(justPressed.equals("NUM9")){index=8;}
                if(index==0){
                    keypress=true;
                    if(justPressed.equalsIgnoreCase(prevPressed) || dontPrint){
                        if(dontPrint){countPress=35;}
                        if(countPress<34){
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        else{
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        dontPrint=false;
                    else{   //this is executed when the key is not repeated (prev!=)
                            ConfirmPaint(last);
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                    last=MyCanvas.ch;
                    prevPressed=justPressed;
                if(index==1 || index==2 || index == 3 || index == 4
                || index ==5 || index==7){
                    keypress=true;
                    if(justPressed.equalsIgnoreCase(prevPressed) || dontPrint){
                        if(dontPrint){countPress=4;}
                        if(countPress<3){
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        else{
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        dontPrint = false;
                    else{   //this is executed when the key is not repeated
                            ConfirmPaint(last);
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);                  
                            callPaint(MyCanvas.ch);
                            countPress++;
                    last=MyCanvas.ch;
                    prevPressed=justPressed;
                if(index==6 || index==8){
                    keypress=true;
                    if(justPressed.equalsIgnoreCase(prevPressed)|| dontPrint){
                        if(dontPrint){countPress=5;}
                        if(countPress<4){
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        else{
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        dontPrint=false;
                    else{   //this is executed when the key is not repeated
                            ConfirmPaint(last);
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                    last=MyCanvas.ch;
                    prevPressed=justPressed;
    /////////////task class for schedule on constructor
    class task extends TimerTask {
        public static boolean bool;
        MyCanvas canvas;
        public task (MyCanvas canvas) {
            this.canvas=canvas;
        public void run () {
            if(canvas.keypress){
                if(System.currentTimeMillis()-canvas.time>150){ //compare the time with the time out
                    canvas.ConfirmPaint(MyCanvas.ch);
                    canvas.counter=-1;
                    canvas.keypress=false;
                    canvas.dontPrint=true;
                    canvas.showPointer();
    }

    Hi I'm writing a program like Multi-tap (the text entry before T9 introduced) on mobilephone.
    I'm having problem with some of the KEYs. They do not work properly.
    As indicated in the code
    HERE HERE [3] suppose to function as space button....However whenever the key is pressed before the 'time out' (I use sceduler to implement the time out) it will print half of the previous character instead of space. this key is not related to the scheduler. so i suspect it is something related to multi-thread programming.
    HERE HERE [1] function as the caps lock. it can even show the indicator properly.... so i need to settle this b4 i continue.
    HEREHERE [2] function as clear button. it doest work too
    Someone please help me....
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package textEntry;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.*;
    import java.util.*;
    * @author Ed's
    public class MyCanvas extends GameCanvas {
        public static final String[] keys =
        {".?!,@`-_:;()&\'\"~10�$��+x*/\\|[]=<>#","abc", "def", "ghi", "jkl",
        "mno", "pqrs", "tuv", "wxyz"};
        public static final String[] capitalKey =
        {".?!,@`-_:;()&\'\"~10�$��+x*/\\|[]=<>#","ABC", "DEF", "GHI", "JKL",
        "MNO", "PQRS", "TUV", "WXYZ"};
        StringBuffer width = new StringBuffer();
        Timer keyTimer;
        textEntryMain main;
        public static char ch;
        public boolean keypress=false;
        public boolean capital;
        public boolean diffrentKey;
        String currentIndicator="abc";
        int countPress=0;
        //int previndex=0;
        public int counter=-1;
        int index=-1;
        int print=0;
        int white_space=6;
        public StringBuffer sms;
        int baseline=10;
        int y_axis=12;
        int line=1;
        char last;
        boolean dontPrint=true; //dont print if timer printed or it is at begining
        Font font;
        Graphics g;
        public long time;
        int poundHit=0;
        String justPressed;
        String prevPressed=null;
        char prevChar;
        //Sms class
        Form smsfrm;
        TextField smsField ;
        //Char Selection speed
        public boolean first;
        int selection_speed=1500;
        //font color (blue)
        public int red=0,green=0,blue=255;
        //Background color (white)
        public int back_red=250,back_green=250,back_blue=250;
        Form menu;
        public MyCanvas(textEntryMain main){
            super(false);
            first=true;
            this.main=main;
            sms=new StringBuffer();
            g=getGraphics();
            font=Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD,Font.SIZE_LARGE);
            keyTimer = new Timer ();
            keyTimer.schedule (new task (this), selection_speed, selection_speed);
            drawIndicator(currentIndicator);
        public void drawIndicator(String indicator){
            Font f = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_SMALL);
            Graphics g = getGraphics();
            g.setFont(f);
            int x= getWidth()-20;
            g.setColor(back_red,back_green,back_blue);
            g.fillRect(x,2,15,10);
            g.setColor(20,20,20);
            g.drawString(indicator, x, 2, g.TOP|g.LEFT);
        public void callPaint(char ch){
            drawIndicator(currentIndicator);
            Graphics g= getGraphics();
            g.setColor(back_red,back_green,back_blue);
            if(first){
                g.fillRect(0,0,getWidth(),getHeight());
                reset();
                redrawAll();
                first=false;
            //baseline -1 so that i can cover the pointer
            g.fillRect(baseline-1,y_axis,font.charWidth(this.last)+3,font.getHeight());
            g.setColor(red,green,blue);
            g.setFont(font);
            g.drawChar(ch,baseline,line*24,g.LEFT|g.BASELINE);
            flushGraphics();
        public void showPointer(){
            Graphics g = getGraphics();
            g.setColor(0,0,0);
            g.drawLine(baseline,y_axis,baseline,2*line*12);
            flushGraphics();
        //pointer appear //pointer disappear-use white line so that it cover the pointer line
        public void hidePointer(){
            Graphics g = getGraphics();
            g.setColor(back_red,back_green,back_blue);
            g.drawLine(baseline,y_axis,baseline,2*line*12);
            flushGraphics();
        //draw the selected
        public void ConfirmPaint(char ch){
            Graphics g = getGraphics();
            sms.append(ch);
            g.setColor(red,green,blue);
            g.setFont(font);
            g.drawChar(ch,baseline,line*24,g.LEFT|g.BASELINE); //draw the selected
            baseline+=font.charWidth(ch); // so that the nect letter won't be drawn on the same position
            if(baseline>getWidth()-30){     //move to the next line
                width.append((char)baseline);
                baseline=10;y_axis+=24;
                line+=1;
            flushGraphics();
        public synchronized void deleteChar(){
            if(sms.charAt(sms.length()-1)==' '){
                baseline-=white_space;
                Graphics g= getGraphics();
                g.setColor(back_red,back_green,back_blue);
                g.fillRect(baseline,y_axis,font.charWidth(sms.charAt(sms.length()-1))+2,font.getHeight());
                sms.deleteCharAt(sms.length()-1);
            else{
                baseline-=font.charWidth(sms.charAt(sms.length()-1));
                Graphics g= getGraphics();
                g.setColor(back_red,back_green,back_blue);
                g.fillRect(baseline,y_axis,font.charWidth(sms.charAt(sms.length()-1))+2,font.getHeight());
                sms.deleteCharAt(sms.length()-1);
            flushGraphics();
        public void redraw(char ch ){
            Graphics g= getGraphics();
            g.setColor(red,green,blue);
            g.setFont(font);
            g.drawChar(ch,baseline,line*24,g.LEFT|g.BASELINE);
            baseline+=font.charWidth(ch);
            if(baseline>getWidth()-30){
                width.append((char)baseline);
                baseline=10;y_axis+=24;
                line+=1;
            flushGraphics();
        public void reset(){
            if(width.length() >0)
            width.delete(0,width.length()-1);
            line=1;
            baseline=10;y_axis=12;
        public void redrawAll(){
            Graphics g=getGraphics();
            g.setColor(back_red,back_green,back_blue);
            g.fillRect(0,0,getWidth(),getHeight());
            reset();
            for(int a=0;a<sms.length();a++)
            redraw(sms.charAt(a));
        /*public synchronized void keyRepeated (int keyCode) {
            int one=1;
        /*    if(keyCode != KEY_POUND && keyCode != KEY_STAR){       
                ConfirmPaint((char)keyCode);
            if (keyCode == 1){
            ConfirmPaint((char)one);
        public synchronized void keyPressed (int keyCode) {
            justPressed=getKeyName(keyCode);
            time=System.currentTimeMillis(); // record the time when the keypress is pressed
            if(justPressed.equals("NUM0")){ //caps lock show indicator .............HERE HERE HERE HERE [1]
                if(poundHit == 0){
                    currentIndicator="ABC";
                    poundHit++;
                    drawIndicator(currentIndicator);
                    //set the string buffer to another one
                if(poundHit == 1){
                    currentIndicator="123";
                    poundHit++;
                    drawIndicator(currentIndicator);
                if(poundHit == 2){
                    currentIndicator="abc";
                    poundHit=0;
                    drawIndicator(currentIndicator);
            if(justPressed.equalsIgnoreCase("SEND")){ //send button allocated as clear button   ................. HERE HERE HERE [2]
                if(sms.length()>0){
                    hidePointer();
                    if(baseline<=10){
                        System.out.println(baseline);
                        line-=2;
                        baseline=(int)width.charAt(line);
                        line++;
                        y_axis-=24;
                    deleteChar();
            if(justPressed.equals("STAR")){//space  ........................................    HERE HERE HERE HERE HERE [3]
                    hidePointer();
                    sms.append(" ");
                    baseline+=white_space;
                    showPointer();
                    prevPressed=justPressed;
            else{
                if(justPressed.equals("NUM1")){index=0;}       
                if(justPressed.equals("NUM2")){index=1;}
                if(justPressed.equals("NUM3")){index=2;}       
                if(justPressed.equals("NUM4")){index=3;}       
                if(justPressed.equals("NUM5")){index=4;}
                if(justPressed.equals("NUM6")){index=5;}
                if(justPressed.equals("NUM7")){index=6;}
                if(justPressed.equals("NUM8")){index=7;}
                if(justPressed.equals("NUM9")){index=8;}
                if(index==0){
                    keypress=true;
                    if(justPressed.equalsIgnoreCase(prevPressed) || dontPrint){
                        if(dontPrint){countPress=35;}
                        if(countPress<34){
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        else{
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        dontPrint=false;
                    else{   //this is executed when the key is not repeated (prev!=)
                            ConfirmPaint(last);
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                    last=MyCanvas.ch;
                    prevPressed=justPressed;
                if(index==1 || index==2 || index == 3 || index == 4
                || index ==5 || index==7){
                    keypress=true;
                    if(justPressed.equalsIgnoreCase(prevPressed) || dontPrint){
                        if(dontPrint){countPress=4;}
                        if(countPress<3){
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        else{
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        dontPrint = false;
                    else{   //this is executed when the key is not repeated
                            ConfirmPaint(last);
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);                  
                            callPaint(MyCanvas.ch);
                            countPress++;
                    last=MyCanvas.ch;
                    prevPressed=justPressed;
                if(index==6 || index==8){
                    keypress=true;
                    if(justPressed.equalsIgnoreCase(prevPressed)|| dontPrint){
                        if(dontPrint){countPress=5;}
                        if(countPress<4){
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        else{
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                        dontPrint=false;
                    else{   //this is executed when the key is not repeated
                            ConfirmPaint(last);
                            countPress=0;  
                            MyCanvas.ch=keys[index].charAt(countPress);
                            callPaint(MyCanvas.ch);
                            countPress++;
                    last=MyCanvas.ch;
                    prevPressed=justPressed;
    /////////////task class for schedule on constructor
    class task extends TimerTask {
        public static boolean bool;
        MyCanvas canvas;
        public task (MyCanvas canvas) {
            this.canvas=canvas;
        public void run () {
            if(canvas.keypress){
                if(System.currentTimeMillis()-canvas.time>150){ //compare the time with the time out
                    canvas.ConfirmPaint(MyCanvas.ch);
                    canvas.counter=-1;
                    canvas.keypress=false;
                    canvas.dontPrint=true;
                    canvas.showPointer();
    }

Maybe you are looking for