ActionListener inside a thread

As title says my whole method is in a thread all works great except for the button (actionlistener) any ideas?

Please be more clear about your problem. Send relevant code snippet. Mention what exactly doesn't work or what's the actual behaviour? A good clarity on your problem will help people address your problem well.
Thanks,
Kannan

Similar Messages

  • Can I have a Thread running inside another Thread.

    I am in the process of trying to (somehow) develop a simple pluginable application. At least for now just to start understanding the concept of such applications (like eclipse).
    I tought of loading each plugin inside a thread as a seperate process. So that all the plugins can run concurently. However what if one of the plugins make use of threads? Is that possible? however most important then that, do you think it makes sense?
    I must admit I still did not even try an example of this, since I am still coding the refectoring section, and most of the time I have spent it on ant build (I know just acuses ... but :$)
    regards,
    sim085

    Why would every plugin run in it's own thread? Consider the example of Eclipse. I've got an XML editor plugin installed. Now when I only edit Java files, would the code of that xml editor run in it's own Thread and waste resources? No, it would not run at all. In eclipse there is a central resource that knows "when the user wants to open an XML file then let the xml editor plugin handle that" and only when I click on an XML file the code from that plugin is actually run.
    Basically you'll have to think about what your plugins should be able to do. Do you simply want to provide additional actions for your menus? Or do you want it to open a seperate window?
    Btw, did you consider using Eclipse as a base? It's got the entire plugin concept worked out already and is a rather stable and powerful target platform IMHO.

  • Different behaviour inside a Thread

    Hello ,
    I am developing a software to help in automating certain tasks related to certain voice switch , i connect to the switch using ssh . i send commands generally using a button that ptints the content of a textbox into the outputstream . every thing works fine as long as i print the command into the outputstream from the code of the button press event . This hangs the interdace because i have to wait for a specific output format . So i used a Thread to execute the same code so that the interface doesn't hang . The strange thing is after the thread finishes i am not able to receive any thing from the switch ( although the printing into the output stream doesn't produce any exceptions and this is not the same if i executed the same code without the thread) . The question is why the program has different behaviour inside a thread and outside it ?
    Best Regards ,

    >
    Sounds like this actually is more related to Swing than concurrency (if I'm correct). I think that everything is working, but you are failing to update the UI with the result. You are only allowed to update the UI from the AWT thread, so you probably need to publish the result using invokeLater or use a SwingWorker.

  • Parsing an xml document inside a Thread

    Hi Friends
    I have to do some processing in my application for which i need to use multithreading.
    Inside every new thread created i have to parse an xml document using s parsing tool like castor or jibx.
    My question is that is it possible to parse a xml document inside a new thread everytime it gets created.
    is it a good coding practice as it involves java code to do it.
    Thanks
    Vikeng

    vikeng wrote:
    Hi
    Thanks for the reply.
    Well i need to do some kind of a batch processing in my application.
    I need to parse an xml document and upload the data i get after parsing into columns in the database.
    Since its a batch what i was asking was is it possible to do it for every request as batch needs to handle hundreds of records during the daily or nightly sync.
    Is it a good practice to do parsing for every record in a batch
    Thanks
    VikengI don't get it. One batch is one document, and that document contains e.g. 100 records? What's one request? A request for one batch? I would execute one batch in one thread.
    Kaj

  • Why can't I make call to parse HTML from inside a Thread?

    This is driving me crazy. With a defined HTMLEditorKit.ParserCallback object "callback", I am attempting to parse an HTML document retrieved from a URL by using:
    new ParserDelegator().parse(new InputStreamReader(url.openStream( )), callback, true);
    It doesn't work if I initiate the call in any way from within the run method of a Thread subclass (the way I'd like to do it). If I make the call in the constructor of the Thread subclass, however, it runs fine. I know it must have something to do with the fact that parse runs in a Thread of it's own - but the way to fix it isn't apparent to me.
    I would appreciate some words from people who might know what's happening here... THANKS in advance.

    Don't bother - figured it out - thanks.

  • How to use EntityManager in a thread inside a J2EE container

    Hi,
    I'm looking for a usage pattern to use an EntityManager inside a thread of J2EE container. I used injection to inject an EntityManager in a EJB3 service and I can use the em with no problem. But the problem occurs when the service spin a thread and operations of the EntityManager (which is obtained using JNDI lookup ) inside that thread always fails.
    What is the correct usage pattern to obtain/use an EntityManager inside a thread of a J2EE container?
    Thanks.

    What you are trying to do should work as long as you are using the Measurement Studio C++ classes in MStudio version 6.0 or later.
    What version of Measurement Studio are you using? Could you post a simple program that demonstrates the problem?
    There is a fundamental limitation in Windows that prevents you from using a Window handle (HWND) in a different thread than the one that created it. However, the Measurement Studio C++ classes (e.g. CNiGraph) are designed to automatically handle accessing the underlying handle from multiple threads. This is done through standard COM marshaling mechanisms and was implemented in version 6.0 of Measurement Studio.
    David Rohacek
    National Instruments

  • Exceptions inside threads

    hi,
    it seems to me like checked exceptions can't be thrown inside threads. is there any way to throw them? another question, even more important, is: where both runtime and checked exceptions end up in the case they occur inside a thread (within the run() method), that is, where in the code could i catch them?
    thank you for the help.

    1. Of course you can throw a checked exception inside a Thread, you just can't let it escape the Run method. ;->
    2. If an exception remains uncaught and propogrates outside of the run() method, the Thread will be stopped (since run() exited) and the Exception will be caught by the JVM and passed to the uncaughtException() method of the ThreadGroup to which that thread belongs. By default this method either propogates the call to its parent ThreadGroup or (if it is the outer most parent) will call Exception.printStackTrace() sending the output to stderr.
    Chuck

  • Search inside threads

    hey all,
    i'm relatively new to this forum, but i oooften used it to solve issues i had relating arch.
    so here's what's really missing in this forum: you cannot search inside of threads.
    this feature would really make problem-solving related search much easier, especially in those huuuge threads.
    is this a feature that could be integrated?
    if yes: discuss.
    regrets

    lukrass wrote:is this a feature that could be integrated?
    We use vanilla FluxBB as provided by the upstream. We do not add any modifications/patches. So if you want any feature in the forum, you will likely have to contact the FluxBB devs.
    And as hauzer mentioned, google is available.

  • Nasty memory leak using sockets inside threads

    In short, any time I create or use a socket inside a worker thread, that Thread object instance will never be garbage collected. The socket does not need to be connected or bound, it doesn't matter whether I close the socket or not, and it doesn't matter whether I create the Socket object inside the thread or not. As I said, it's nasty.
    I initially encountered this memory leak using httpclient (which creates a worker thread for every connect() call), but it is very easy to reproduce with a small amount of stand-alone code. I'm running this test on Windows, and I encounter this memory leak using the latest 1.5 and 1.6 JDK's. I'm using the NetBeans 5.5 profiler to verify which objects are not being freed.
    Here's how to reproduce it with an unbound socket created inside a worker thread:
    public class Test {
         public static class TestRun extends Thread {
              public void run() {
                   new Socket();
         public static void main(String[] strArgs) throws Exception {
              for(;;) {
                   (new TestRun()).start();
                   Thread.sleep(10);
    }Here's how to reproduce it with a socket created outside the thread and used inside the worker thread:
    public class Test {
         public static class TestRun extends Thread {
              Socket s;
              public TestRun(Socket s) { this.s = s; }
              public void run() {
                   try {
                        s.bind(new InetSocketAddress(0));
                        s.close();
                   } catch(Exception e) {}
         public static void main(String[] strArgs) throws Exception {
              for(;;) {
                   (new TestRun(new Socket())).start();
                   Thread.sleep(10);
    }Here's how to reproduce it implementing Runnable instead of extending Thread:
    public class Test {
         public static class TestRun implements Runnable {
              public void run() {
                   Socket s = new Socket();
                   try { s.close(); } catch(Exception e) {}
         public static void main(String[] strArgs) throws Exception {
              for(;;) {
                   (new Thread(new TestRun())).start();
                   Thread.sleep(10);
    }I've played with this a lot, and no matter what I do the Thread instance leaks if I create/use a socket inside it. The Socket instance gets cleaned up properly, as well as the TestRun instance when it's implementing Runnable, but the Thread instance never gets cleaned up. I can't see anything that would be holding a reference to it, so I can only imagine it's a problem with the JVM.
    Please let me know if you can help me out with this,
    Sean

    Find out what is being leaked. In the sample programs, add something like this:
        static int loop_count;
            while (true) {
                if (++count >= 1000) {
              System.gc();
              Thread.sleep(500); // In case gc is async
              System.gc();
              Thread.sleep(500);
              System.exit(0);
            }Then run with java -Xrunhprof:heap=sites YourProgram
    At program exit you get the file java.hprof.txt which contains something like this towards the end of the file:
              percent          live          alloc'ed  stack class
    rank   self  accum     bytes objs     bytes  objs trace name
        1  0.47%  0.47%       736    5       736     5 300036 char[]
        2  0.39%  0.87%       616    3       616     3 300000 java.lang.Thread
        3  0.30%  1.17%       472    2       472     2 300011 java.lang.ThreadLocal$ThreadLocalMap$Entry[]
        4  0.27%  1.43%       416    2       416     2 300225 java.net.InetAddress$Cache$Type[]See, only three live Thread objects (the JVM allocates a few threads internally, plus there is the thread running main()). No leak there. Your application probably has some type of object that it's retaining. Look at "live bytes" and "live objs" to see where your memory is going. The "stack trace" column refers to the "TRACE nnnnn"'s earlier in the file, look at those to see where the leaked objects are allocated.
    Other quickies to track allocation:
    Print stats at program exit:
    java -Xaprof YourProgram
    If your JDK comes with the demo "heapViewer.dll" (or
    heapViewer.so or whatever dynamic libraries are called on your system):
    java -agentpath:"c:\Program Files\Java\jdk1.6.0\demo\jvmti\heapViewer\lib\heapViewer.dll" YourProgram
    Will print out statistics at program exit or when you hit Control-\ (Unix) or Control-Break (Windows).

  • Database call fired twice when using actionListener in dataTable

    Hi all,
    I have a question regarding the request bean lifecylce in the current use case (using Sun JSF 1.2)
    I have a managed bean in request scope that contains an ArrayList which is used as the data provider in a dataTable on a faces page.
    The bean contains an init() method to populate the ArrayList using a database call.
    The dataTable also contains a column with a commandLink that calls a method via actionListener inside the managed bean to delete the current row.
    When I click the link the action gets called and deletes the row from the database. I also reload the data from the database and assign it to my ArrayList.
    However, the init Method is also called before the action is executed. So the database call is fired twice when hitting the link:
    - First time in the init() method of the bean
    - Second time in the actionListener method when reloading the data
    I can not remove the call from the actionListener, because the data has not deleted yet.
    Question:*
    How can I make sure the database call is fired once only? (and also making sure the ArrayList is populated appropriate)
    Maybe I am doing something wrong here? Thanks in advance for any help.
    Maik
    This is the request scope bean:
    public class UserBean implements Serializable {
        private List all;
        private Long userId = null;
        @PostConstruct
        public void init() {
            if(all == null) {
                new ArrayList();
                loadUserList();
         * Constructor
        public UserBean() {
            super();
         * @return the userId
        public Long getUserId() {
            return userId;
         * @param userId
         *            the userId to set
        public void setUserId(Long userId) {
            this.userId = userId;
         * @param all
         *            the all to set
        public void setAll(List all) {
            this.all = all;
        public List getAll() throws GeneralModelException {
            return all;
        public void loadUserList() {
            EntityManager em = Contexts.getEntityManager();
            Query q = em.createNamedQuery("user.findAll");
            all = q.getResultList();
        public void deleteAction(ActionEvent ae) {
            EntityManager em = Contexts.getEntityManager();
            Query q = em.createNamedQuery("user.byId");
            q.setParameter("id", userId);
            try {
                User user = (User) q.getSingleResult();
                if (user != null) {
                    em.remove(user);
                    loadUserList();
            } catch (NoResultException e) {
                // TODO
    }

    No, I do not call the init() method.
    Basically the init() is called before the deleteAction() so the ArrayList still contains the old value, unless a second database call is triggered after the entity has been deleted.
    Maybe I am missing something here...
    See also here (JSF 1.2 RI - Bean Instantiation and Annotation)
    [http://weblogs.java.net/blog/jhook/archive/2007/05/jsf_12_ri_backi.html]
    Here is the init() call stack trace
    Daemon Thread [http-8080-2] (Suspended (breakpoint at line 32 in UserBean))     
         UserBean.init() line: 32     
         NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]     
         NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available     
         DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available     
         Method.invoke(Object, Object...) line: not available     
         DefaultAnnotationProcessor.postConstruct(Object) line: 79     
         Tomcat6InjectionProvider.invokePostConstruct(Object) line: 118     
         ManagedBeanBuilder(BeanBuilder).invokePostConstruct(Object, InjectionProvider) line: 223     
         ManagedBeanBuilder(BeanBuilder).build(InjectionProvider, FacesContext) line: 108     
         BeanManager.createAndPush(String, BeanBuilder, ELUtils$Scope, FacesContext) line: 368     
         BeanManager.create(String, FacesContext) line: 230     
         ManagedBeanELResolver.getValue(ELContext, Object, Object) line: 88     
         FacesCompositeELResolver(CompositeELResolver).getValue(ELContext, Object, Object) line: 53     
         FacesCompositeELResolver.getValue(ELContext, Object, Object) line: 72     
         AstIdentifier.getValue(EvaluationContext) line: 61     
         AstValue.getTarget(EvaluationContext) line: 59     
         AstValue.setValue(EvaluationContext, Object) line: 129     
         ValueExpressionImpl.setValue(ELContext, Object) line: 249     
         JspValueExpression.setValue(ELContext, Object) line: 85     
         RestoreViewPhase.doPerComponentActions(FacesContext, UIComponent) line: 240     
         RestoreViewPhase.doPerComponentActions(FacesContext, UIComponent) line: 245     
         RestoreViewPhase.doPerComponentActions(FacesContext, UIComponent) line: 245     
         RestoreViewPhase.execute(FacesContext) line: 195     
         RestoreViewPhase(Phase).doPhase(FacesContext, Lifecycle, ListIterator<PhaseListener>) line: 100     
         RestoreViewPhase.doPhase(FacesContext, Lifecycle, ListIterator<PhaseListener>) line: 104     
         LifecycleImpl.execute(FacesContext) line: 118     
         FacesServlet.service(ServletRequest, ServletResponse) line: 265     

  • Problem with threads within applet

    Hello,
    I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
    this thread is running in endless loop.
    he is doing something and go to sleep on and on.
    the problem is,
    when I refresh my IE6 browser I see more than 1 thread.
    for debug matter, I did the following things:
    inside the thread, sysout every time he goes to sleep.
    sysout in the singleton constructor.
    sysout in the singleton destructor.
    the output goes like this:
    when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
    The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
    The destructor never works (no output there).
    I don't understand what is going on.
    someone can please shed some light?
    thanks.
    btw. I am working with JRE 1.1
    this is very old and big applet and I can't convert it to something new.

    Ooops. sorry!
    I did.
         public void start() {
         public void stop() {
         public void destroy() {
              try {
                   resetAll();
                   Configuration.closeConnection();
                   QuoteItem.closeConnection();
              } finally {
                   try {
                        super.finalize();
                   } catch (Throwable e) {
                        e.printStackTrace();
         }

  • Problem with StatelessConnectionPool and Threads on Windows XP

    I am trying to use a StatelessConnectionPool in a multithreaded app under Windows using 10g. The problem is that when my application is exiting and I go to terminate the StatelessConnectionPool, I get an access violation inside Environment::terminateStatlessConnectionPool.
    A short program that demonstrates the problem is at the end of this post. One thing I have noticed is that by calling terminateConnection inside the thread instead of releaseConnection the problem goes away. However, performance really degrades. Thanks in advance.
    #include <windows.h>
    #include <occi.h>
    #include "RegisterDataMappings.h"
    #include "Consumers.h"
    #include "Thread.h"
    using namespace oracle::occi;
    Environment* env = NULL;
    StatelessConnectionPool* connPool = NULL;
    //Derived from opur Thread class
    class TestThread : public Thread
    public:
         TestThread(void){}
    protected:
         //get an object 10 times, sleeping every 500 msecs in between
         virtual DWORD run(void)
              printf("Thread 0x%08x Enter...\n", GetCurrentThreadId());
              Sleep(500);
              int i = 0;
              while(i < 10)
                   try
                        Connection* conn = connPool->getConnection();
                        Statement* stmt = conn->createStatement("select Ref(c) from consumers c where pid = 7038878582");
                        ResultSet* rs = stmt->executeQuery();
                        if(rs->next())
                             Ref<Consumers> consumer = rs->getRef(1);
                             printf("Thread 0x%08x #%d - %.0f\n", GetCurrentThreadId(), i+1, (double)consumer->getconsumerid());
                        stmt->closeResultSet(rs);
                        conn->terminateStatement(stmt);
                        connPool->releaseConnection(conn);
                        //connPool->terminateConnection(conn);
                        Sleep(500);
                        ++i;
                   catch(SQLException& sql)
                        printf("Oracle exception: %s\n", sql.getMessage().c_str());
              printf("Thread 0x%08x Leave...\n", GetCurrentThreadId());
              return 0;
    //Helper function to create a connection
    void createConnection(void)
         env = Environment::createEnvironment((Environment::Mode)(Environment::OBJECT|Environment::THREADED_MUTEXED));
         RegisterDataMappings(env);
         connPool = env->createStatelessConnectionPool("user", "pass", "orcldev", 10, 10, 0, StatelessConnectionPool::HOMOGENEOUS);
    //Helper function to terminate a connection
    void terminateConnection(void)
         env->terminateStatelessConnectionPool(connPool);
         Environment::terminateEnvironment(env);
    int main(int argc, char* argv[])
         try
              //Connect to the database
              createConnection();
              //Create 10 threads and wait for them to complete
              const int numThreads = 10;
              HANDLE handles[numThreads];
              for(int i = 0; i < numThreads; i++)
                   TestThread* thread = new TestThread;
                   thread->start();
                   handles[i] = thread->getThreadHandle();
              WaitForMultipleObjects(numThreads, handles, TRUE, INFINITE);
              //Clean up
              terminateConnection();
         catch(SQLException& sql)
              printf("SQLException caught: %s\n", sql.getMessage().c_str());
         return 0;

    When I search MetaLink for bug 4183098, it says there's nobug 4183098. Any information on this?

  • CW++ and Threads (Follow up to David Rohacek)

    Thanks for the info David. I sure would like to call my CNiGraph:lotY method from inside any thread and I would appreciate some example code. Don't spend to much time on it because I know you are working hard to get the new version of Measurement Studio released. I'd hate to think that I slowed down the process. Well, slowed it down too much anyway.
    I keep thinking that there should be some kind of a simple solution because everthing seems to work fine until I try and automate a button press. My message thread is polling an A/D over a can bus and feeding back the data continuously to an edit box. I have a button that uses the DDX communication function UpdateData(TRUE); to load the member variable w
    ith the value of the edit box and then add that value to my chart. This works fine if I press the button myself. If I try and just call the function that the button calls each A/D conversion though I get a Run Time error "abnormal program termination". Do you think I could write my own thread to just press the button? That's still in a thread though isn't it. Would I still have to do the marshaling?
    Right now I'm just anxious to get something working. For sure the next release of Measurement Studio will solve this problem but in the meantime I would really appreciate just some way to work around this. I've already spent a good deal of time on it and am not afraid to spend a great deal more. If you could make some example code that would be great but maybe the number of people interested in this issue doesn't warrent the time spent. Thanks again for your help and the cool software.
    Grant
    Grant M. Johnson
    Project Engineer
    LECO Corporation

    Being a little too close to the implementation, I overlooked the easier solution, for which we actually already have an example program. Check out
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&24C350515009D6A1862569AC0073ACC6&cat=61B119A9F74ADC07862568C50070CE22
    This example shows you how to create and use a user-defined windows message to pass a value to the main thread, which then accesses the Measurement Studio ActiveX control. This should provide similar performance to that which you would get by marshaling the interface manually.
    David Rohacek
    National Instruments

  • Please help me figure out why this thread's performance degrades over time

    Hello.
    The code below is from a Runnable that I've tested inside a Thread operating on a TreePath array of size 1500; the array 'clonedArrayB' is this TreePath array. The code is designed to create a more stepped version of setSelectionPaths(TreePath[]) from class JTree.
    The performance decrease of the thread is very rapid; this is discernible simply from viewing the println speed. When it gets to about 1400 TreePaths added to the JTree selection, it's running at roughly 1/10 the speed it started running at.
    I know there's no problem with maintaining a set of selected paths of that size inside a JTree. I also know that the thread stops when it should. So it must be some operation I'm performing inside the brief piece of code shown below that is causing the performance degradation.
    Does anyone have any idea what could be causing the slowdown?
    Many thanks for your help. Apologies if you would have liked an SSCCE, but I very much doubt it's necessary for this. Either you can see the problem or you can't. And sadly I can't x:'o(
    int indexA = 0;
    public void run() {
         // Prevent use of / Pause scanner
         try {
              scannerLock.acquire();
         } catch (InterruptedException exc) {
              Gecko.logException("Scanner lock could not be acquired by expansion thread", exc);
         while (!autoExpansionComplete) {
              while (indexA < clonedArrayA.length) {
                   int markerA = indexA + 10;
                   for (int a = indexA; a < markerA && a < clonedArrayA.length; a++) {
                        pluginTreeA.addSelectionPath(clonedArrayA[a]);
                   indexA = markerA;
                   System.out.println(indexA + "," + clonedArrayA.length);
                        if (autoExpansionComplete) {
                             break;
                   stop();
    };

    Well, since I've had no responses, I tried to think of other ways to speed the code up.
    I'd already made nearly every tweak I know. The only additional thing I could think of was to use addSelectionPaths(TreePath[]) on a subarray of the cloned array, instead of addSelectionPath(TreePath) on the cloned array's elements, since obviously it would be fewer method calls. It has sped things up an awful lot (my new code is shown below - I've left in some things I chopped out above, so you can see exactly what I see). The problem is though, obviously an increase in initial velocity doesn't solve the problem of deceleration occurring, if you get me.
    // Clone the selection arrays to non-volatile arrays for better access
    // speeds
    final TreePath[] clonedArrayA = selectionPathsArrayA.clone();
    final TreePath[] clonedArrayB = selectionPathsArrayB.clone();
    // Create a new runnable to perform the selection task
    Runnable selectionExpander = new Runnable() {
         /** Position within cloned array A */
         int indexA = 0;
         /** Position within cloned array B */
         int indexB = 0;
         /** Length of subarray grabbed from cloned array A */
         int lengthA;
         /** Length of subarray grabbed from cloned array B */
         int lengthB;
         /** Subarray destination */
         private TreePath[] subarray = new TreePath[100];
         public void stop() {
              autoExpansionComplete = true;
              automatedSelection = false;
              scannerLock.release();
          * Grabs 10 blocks of each selection paths array at a time, adding
          * these to the tree's current selection and then moving to the next
          * cycle
         public void run() {
              // Prevent use of / Pause scanner
              try {
                   scannerLock.acquire();
              } catch (InterruptedException exc) {
                   Gecko.logException("Scanner lock could not be acquired by expansion thread", exc);
              while (!autoExpansionComplete) {
                   while (indexA < clonedArrayA.length || indexB < clonedArrayB.length) {
                        // Set subarray lengths
                        lengthA = subarray.length;
                        lengthB = subarray.length;
                        // If subarray length is greater than the number of
                        // remaining indices in the source array, set length to
                        // the number of remaining indices
                        lengthA = indexA + lengthA > clonedArrayA.length ? clonedArrayA.length - indexA : lengthA;
                        lengthB = indexB + lengthB > clonedArrayB.length ? clonedArrayB.length - indexB : lengthB;
                        // Create subarrays and add TreePath elements to trees'
                        // selections
                        System.arraycopy(clonedArrayA, indexA, subarray, 0, lengthA);
                        pluginTreeA.addSelectionPaths(subarray);
                        System.arraycopy(clonedArrayB, indexB, subarray, 0, lengthB);
                        pluginTreeB.addSelectionPaths(subarray);
                        // Remember the latest index reached in source arrays
                        indexA += lengthA;
                        indexB += lengthB;
                        System.out.println(indexA + "," + clonedArrayA.length);
                        System.out.println(indexB + "," + clonedArrayB.length);
                        if (autoExpansionComplete) {
                             break;
                   stop();
    // Create and start new thread to manage the selection task runner
    selector = new Thread(selectionExpander);
    selector.start();I really can't think what could be causing the slowdown. I've done everythng I can think of to increase the velocity, such as cloning the source arrays since they're volatile and access could be slightly slower as a result.
    Nothing I try gets rid of the slowdown effect though :(
    - Dave

  • Why can't I access the variables in my threads?

    hello.
    another question about threads..
    ==========================
    I have an inner class that implements Runnable (i.e. a thread) and has a variable in it. I want to be able to access that variable from outside the thread class so that I can set or retrieve the variable.
    here is the code for the program
    class myClass
         public static void main(String[] args)
              myClass c = new myClass();
         myClass()
              Thread t = new Thread(new myThread());
              t.number = 1;
              t.start();
         class myThread implements Runnable
              int number = 0;
              public void run()
         }//end myThread
    }//end myClassthe line
    t.number = 1;
    where I try to set the number variable to 1 gives me an error (in the MyClass constructor)
    This is my error
    AccessThreadVars.java:11: cannot find symbol
    symbol  : variable number
    location: class java.lang.Thread
              t.number = 1;
                        ^
    1 errorif I put a method in myThread, and then try to call that method from myClass (via t.MethodName()) it gives me that same error telling me it can't find it..
    what am I doing wrong? how can I get access my thread's variables and methods??

    1. Type names should start with an uppercase letter
    2. t is defined as a Thread, not as a myThread
    (which, may I insist, should be "MyThread"), so the
    compiler has no means of detecting that "number" is
    an accessible field of the object... which wouldn't be accessible anyway, cause you're trying to get attributes from your Runnable after wrapping it inside a Thread.
    Why don't you do something like :
    MyThread t = new MyThread();
    t.number = 1;
    new Thread(myThread).start();?
    I bet you don't use Thread's own methods anyway...

Maybe you are looking for

  • Where can i get a superdrive or a mac format dvd burner?

    hey i ve been working on a movie on imovie hd on my mac and the macbook that i have doesnt have a superdrive, so im goin to have to buy one or a firewire formated dvd burner. and since the dvd burn would much more cheaper i would think im goin to get

  • Is iPhone 6 bent problem serious?

    I have an iPhone 4 since 2011 and decided to upgrade to iPhone 6, but i've heard (on the internet) new iPhones will bend easily. Is this true? I don't put my phone on the back pocket. Thanks.

  • Synced phone to itunes on my computer now I can't find my pics and I sold my phone

    I Synced my old iPhone with my itunes account on my computer. I sold my phone but now I cannot find my pictures. Is there anyway to recover those pictures?

  • Multi - City cheque facility- SAP configuration

    Dear All, Please guide me how to configure Multi City Check Payment Method in Automatic Payment Programme. regards Rama Mohan

  • Transport a namespace

    Hi all, I try to transport a namespace, which can be maintained in transaction SE03, but these namespaces can't be added to a transport task. I also tried to add the corresponding entries from the tables TRNSPACET and TRNSPACEL but they are not trans