Progress monitoring for long operation

I know that questions similar to this have been asked many times, but I have not gotten an answer that works for me, so here goes. I have a dialog box with various parameters that the user can specify for a long running task. After the user clicks "OK", I want the dialog box to disappear and instead to have an indeterminate jprogressbar display while the task is running. I have tried using SwingWorker classes and invokeLater(), but I ahve not gotten anything to work. Could someebody please help me out with which parts of the code:
1. Destroying the old dialog box
2. Starting the long task
3. creating the JProgressbar and making it indeterminate
4. Destroying the JProgressBar
5. informing the user that the task is complete
need to be performed using a SwingWorker or invokelater and how the parts should fit together.
Thank you for the help,
Jeff

1. Destroying the old dialog box"old dialog box".dispose();
3. creating the JProgressbar and making it
indeterminateBetter create JProgressBar object before starting the thread.
2. Starting the long task
4. Destroying the JProgressBar
5. informing the user that the task is completeIn your class, define the SwingWorker as:
    final SwingWorker worker = new SwingWorker() {
        public Object construct() {
            /* start your long task.
             * Call local method, method from other
             * class, whatever.
            return new Object();
        public void finished() {
            /* To finish off the long task.
             * This method is called when the thread
             * finishes.
             * This where you destroy your progress bar
             * and inform user the task is completed.
    };Of course, you'll need another thread to monitor the progress of your task, and increment the value in progress bar.
As for indeterminate progress bar, you'll need to know some estimate anyway.
If at all possible to break the long task in blocks/sections, that number can be applied to the progress bar. Otherwise, get an average performance time, and set the maximum with a figure, and slowly increment the progress bar. If it reaches 99% before finish, then I guess you have to wait till the task ends, then display 100%. If finishes quickly, then you can boost the speed of increment (or instantly display 100%).
Alternatively, if you can determine (dynamically) how long before the end of task while running your task, you can always update your JProgressBar values (you probably aware of this, anyway).
Hope this helps.

Similar Messages

  • Progress Bar or Progress Monitor for a system command

    Hello,
    I am running a DOS copy command in a Java Swing application. I understand that I
    can implement a Progress Bar or a Progress Monitor if I open the first file, read it,
    and write to a second file. But if I have a need to use the DOS copy command,
    is there a way to implement a Progress Bar or a Progress Monitor for it. If there is,
    could you please point me to some example code?
    Thank you,
    Chris

    Hello Chris,
    you would have to write some native code which peeks or watches the DOS process and its progress. Surely not an easy task. But without that information, how will you set values for the ProgressMonitor?
    What you could do, however, is showing an Indeterminate JProgressBar at DOS process start and make it disappear at process end.

  • Basic Network Monitoring for Cisco Operation Manager 2012

    Hello,
    Please bear with me as i'm new the Operations Manager 2012 world. I've just installed operations manager 2012 in our environment and i've setup a network management point. I've discovered my networking gear which is primarily cisco equipment. The devices
    are appearing as CERTIFIED. It appears that they are HEALTHY however in most cases i'm getting some arbitrary monitors. I have a 6509 switch where memory and processor appear to be being monitored out of the box. I'm receiving alerts and everything.
    My question is how do I turn on monitoring for other discovered components. I seem to understand I can make SNMP monitors under the authoring pane if i know the OID. That sounds like it'd be tedious work for such a simple and basic monitor. However I was
    under the impression I would be able to monitor a lot of these components with a simple click of a button. Is this not the case? I'm primarily interested in monitoring the state and performance of particular interfaces as well as the state of the power supplies
    in our switches. Is there a guide that explains the basic principles of this. What are my options?
    Thanks!
    -Brandon

    Hi,
    You will need to edit the discovery and broaden the range. You may use recursive discovery.
    Recursive discovery will try to discover any other network devices it knows about through its Address Routing Protocol (ARP) table, its IP address table, or the topology Management Information Block (MIB) to grow the network map and present all applicable
    devices to you for monitoring.
    You can also filter out devices that you don't want to be discovered by using properties such as the device type, name, and object identifier (OID). This is a handy option if you wanted to quickly discover all the network devices in your network except,
    a small number or some with a specific criteria.
    In really large networks with a lot of network devices, keep in mind that there is a default limit of 1500 network devices that can be discovered recursively. You can of course tweak this limit to suit your environment if you wish, but for most people, this
    won't be needed.
    More details, please go through the article below:
    http://kevingreeneitblog.blogspot.com/2012/07/scom-2012-network-monitoring-explicit.html
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Alert monitor for long running background jobs

    Hello,
    I have to configure an alert moniter for long running background jobs which are running more than 20000 secs using rule based. I have created a rule based MTE and assigend MTE class CCMS_GET_MTE_BY_CLASS to virtual node but i dont find a node to specify the time.
    could any one guide me how can i do this.
    Thanks,
    Kasi

    Hi *,
    I think the missing bit is where to set the maximum runtime. The runtime is set in the collection method and not the MTE class.
    process:  rz20 --> SAP CCMS Technical Expert Monitors --> All Contexts on local application server --> background --> long-running jobs. Click on 'Jobs over Runtime Limits' then properties, click the methods tab then double click 'CCMS_LONGRUNNING_JOB_COLLECT', in the parameters tab you can then set the maximum runtime.
    If you need to monitor specific jobs, follow the process (http://help.sap.com/saphelp_nw70/helpdata/en/1d/ab3207b610e3408fff44d6b1de15e6/content.htm) to create the rule based monitor, then follow this process to set the runtime.
    Hope this helps.
    Regards,
    Riyaan.
    Edited by: Riyaan Mahri on Oct 22, 2009 5:07 PM
    Edited by: Riyaan Mahri on Oct 22, 2009 5:08 PM

  • Long operations session killing

    hi
    i want to remove a particular session which one is running a long query.ie.some user a running a query which one is taking too much time to run.how to kill such session??
    regards
    Edited by: you on May 19, 2010 6:02 AM

    To find SQLs running for more than 5 Seconds:
    col username for a30
    col machine for a30
    select s.sid, a.sql_text, s.username, s.machine
         from v$sqltext a,
         v$session s
         where s.sql_address = a.address
         and s.sid in (select sid
    from v$session
    where LAST_CALL_ET > 5
    and status = 'ACTIVE'
    and username = 'USERNAME' )
    order by s.sid, a.piece;
    check for long operations :
    SET LINES 150
    COLUMN sid FORMAT 9999
    COLUMN serial# FORMAT 9999999
    COLUMN username FORMAT A30
    COLUMN machine FORMAT A30
    COLUMN progress_pct FORMAT 99999999.00
    COLUMN elapsed FORMAT A10
    COLUMN remaining FORMAT A10
    SELECT s.sid,
    s.serial#,
    s.username,
    s.machine,
    ROUND(sl.elapsed_seconds/60) || ':' || MOD(sl.elapsed_seconds,60) elapsed,
    ROUND(sl.time_remaining/60) || ':' || MOD(sl.time_remaining,60) remaining,
    ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
    FROM v$session s,
    v$session_longops sl
    WHERE s.sid = sl.sid
    AND s.serial# = sl.serial#
    AND sl.time_remaining > 0;
    the below query will tell on which object lock has been acquired , if you know the object name on which long operation is running . then after getting sid you can kill it
    select session_id "sid",SERIAL# "Serial",
    substr(object_name,1,20) "Object",
    substr(os_user_name,1,10) "Terminal",
    substr(oracle_username,1,10) "Locker",
    nvl(lockwait,'active') "Wait",
    decode(locked_mode,
    2, 'row share',
    3, 'row exclusive',
    4, 'share',
    5, 'share row exclusive',
    6, 'exclusive', 'unknown') "Lockmode",
    OBJECT_TYPE "Type"
    FROM
    SYS.V_$LOCKED_OBJECT A,
    SYS.ALL_OBJECTS B,
    SYS.V_$SESSION c
    WHERE
    A.OBJECT_ID = B.OBJECT_ID AND
    C.SID = A.SESSION_ID
    ORDER BY 1 ASC, 5 Desc
    Edited by: PrafullaNath on May 19, 2010 3:15 PM
    Edited by: PrafullaNath on May 19, 2010 3:16 PM
    Edited by: PrafullaNath on May 19, 2010 3:17 PM

  • Need configure guide for job progress monitor in JSM

    Hello Guys,
    I have received  an requirement to setup job progress monitoring in JSM(job schedule monitor).i have done my search in Google for configuration guide, but i could not find it.
    My Requirement:- i need to monitor the jobs progress(running on manage system) which consists on nearly 10 setps.End user need to monitoring the job progress  using PI diagram.
    Guys  if any one of you have done this setup please help me with configuration setps.
    Please provide your inputs on this.
    Regards,
    Pavan

    Hi Pavan,
    That should have been my place from where I would have start
    I hope Jansi, Prakhar or Karthik can redirect you on this.
    Meanwhile, If I get any thing, I will share it.
    Regards

  • Monitoring progress when performing filter operations on images

    Hi,
    I am working on Java2D and making some image filters using classes like ImageFilter etc. Now For simple filters I want to get the progress status while the filteting is in progress, so that I can show a progress bar in the GUI.
    For this I do not have much idea. I think we can use the ImageConsumer interface, so that if the class implementing that interface list itself as an image consumer with the filter operation. Here is two way I have tried implanting this:
    1st way:
    Class MyConsumer implements ImageConsumer
    int width,height;
    int percentProgress;
    Public image processImage(Image srcImage, ImageFilter filter){
    FilteredImageSource fis: new FilteredImageSource(srcImage.getSource(),filter());
    //should we do this?
    fis.addConsumer(this);
    //or this?
    srcimage.addConsumer(this)
    Image destImage = this.createImage(fis);
    return destImage;
    //implementing methods of imageConsumer
    //we get the width and height of the new destImage (or do we get the dimension of the srcImage here??)
    public void setDimensions(int width, int height){
    this.width=width;
    this.height=height;
    public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize){
    // Is this the correct way of obtaining the progress????
    progressPercent=(y*100)/height;
    //We also have empty implementation of other ImageConsumer methods after this
    --------------------------------------------------------------2nd way, let?s say we use a smooth filter and replace the processImage(..) method above with the one below (the other methods being same):
    Public image processImage(Image srcImage){
    float[] SHARPEN3x3 = {      0.f, -1.f, 0.f,
                                -1.f, 5.0f, -1.f,
                                0.f, -1.f, 0.f};
    BufferedImage dstbimg = new
                  BufferedImage(iw,ih,BufferedImage.TYPE_INT_RGB);
    Kernel kernel = new Kernel(3,3,SHARPEN3x3);
    ConvolveOp cop = new ConvolveOp(kernel,
                                    ConvolveOp.EDGE_NO_OP,
                                    null);
    //should we do this?
    dst.addConsumer(this);
    //or this?
    srcImage.addConsumer(this);
    cop.filter(srcImage,destImage);
    return destImage;
    }Now I do get a progressPercent. But when the percent is 100%, the destimage does not return, that means the operation is not yet complete.
    So is this the correctw ay, or is there any other way to know the progress of the flter operation.
    Also I extended the ImageFilter class and overrode its setPixel method as:
    public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize){
    int progressPercent=(y*100)/height;
    System.out.println("progress in image filter:"+progressPercent);
    //I simply print out the progress and let the super perform the filter operation
    super.setPixels(x, y,w, h, model, pixels, off, scansize);
    //should I do this below? This calls the imageconsumer's setpixels
    //that I implement in the MyConsumer class
    consumer. setPixels(x, y,w, h, model, pixels, off, scansize);
    }I observe that the setPixel method of MyImageFilter is called several times even for the same scan lines, and even after percentProgress is 100%, the process runs again for 2-4 times. So the filtering operation scans the lines several times to finally perform the filtering, and as such the percentProgress is incorrect.
    Can anybody guide me. Is this approach okay and needs to be modified a bit, or there is a different approach to obtain the progress from a filter operation?
    I would finally want the same progress from other operations like LookupOp, ConvolveOp, AffineTransformOp, ColorConvertOp, RescaleOp.
    Thanks in advance
    Tanveer
    DrLaszloJamf, are you there? I am sure you are one of them who can help me in this.
    anyone can send me a private message too at [email protected]

    Please somebody let me know how to get the progress of imagefilter operation using convolveOp.filter(...) or Filteredimagesource. I waant to display the progress i a JProgressbar.

  • Tracking completion status for long running DML operations

    Does anybody know:
    Is there any possibility to track a completion status for long running DML operations (for example how many rows is inserted)?
    For example if I execute an INSERT statement which is working for several hours it is very important to estimate the total time for this operation.
    Thanks forward

    I'm working with Oracle8 in present, and unfortunately this solution (V$SESSION_LONGOPS)cannot help me.
    On Oracle8 it works, but with some restrictions:
    - You must be using the cost-based optimizer
    - Set the TIMED_STATISTICS or SQL_TRACE parameter to TRUE
    - Gather statistics for your objects with the ANALYZE statement or the DBMS_STATS package.

  • How do I set-up my TV as a dual monitor for my MacBook Pro?

    Hi
    I have a mid-2009 MacBook Pro running (OS X 10.8.2) Mountain Lion, and recently I rearranged my home workspace so that I can view my TV from my desk while I work.
    I would like to set-up my TV as a dual monitor for my MacBook Pro, so I can stream videos on my TV screen and have the whole screen to do work on my MacBook Pro at the same time.
    Is this possible? I've seen people use TVs as a mirror display (where it works as their main and only monitor), but never as a fully operational dual display.
    As an example, I would like to have my MacBook screen showing a desktop with the whole screen devoted to Photoshop, while I have another desktop running on my TV, which shows an internet browser or other application.
    If this is possible, what cords/hardware would I need, and what are the settings that will enable me to do this?
    - My TV is a modern flatscreen LCD, and it has two HDMI ports in the back.
    - It's about 9-10 feet from my desk.
    If anyone could help, that'd be awesome!
    Thanks.

    Yes, you can do that.
    You'll need a mini displayport to HDMI adaptor:
    http://store.apple.com/us/product/H1824ZM/A/moshi-mini-dp-to-hdmi-adapter-with-a udio-support
    and an HDMI cable long enough to reach your TV
    (look on Amazon or Monoprice for the best price on any of those parts)
    In your display options, you will just choose extended desktop vs mirrored display.

  • What's wrong with my Progress Monitor and how do I fix it?

    Hello,
    My progress monitor fails to draw its insides, except when the task is already finished
    Inside a class that extends SwingWorker<Void, Void> ...
         @Override
         public Void doInBackground() throws Exception
              try
                   this.progressMonitor = new ProgressMonitor(jPanelControl,
                             "Running a Long Task",
                             "", 0, data.size());
                        //jPanelControl.invalidate();
                        progressMonitor.setMillisToPopup(500);
                        progressMonitor.setMillisToDecideToPopup(100);
                   this.doProcess();
              catch (Throwable e)
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              return null;
         }doProcess goes on a little journey until we get to:
                      progressMonitor.setNote("Importing " + this.title);
            for (int i = start; i < this.data.size(); i++)
                   progressMonitor.setProgress(i);
                            //doing stuff each iterationQuickly after loading begins the box appears but it's not drawing the graphics inside the window (see screenshot for more)          
    btw: That white background is Java3D, could it be interfering with the way Swing updates graphics?
    Edited by: loza on Aug 25, 2009 4:03 AM

    Hi,
    take a look at [this sample from java tutorial|http://java.sun.com/docs/books/tutorial/uiswing/examples/components/ProgressBarDemoProject/src/components/ProgressBarDemo.java] ;
    Regards,
    Alan Mehio
    London,UK

  • More on Updating Swing Components during long operations...

    After reading thru a few posts here, I've come to the conclusion that what I need is going to be much more difficult than I'd planned. Neverthess i'll try to explain...
    I have a JFrame which contains a simple JLabel and JProgressBar. While I am performing a long network operation, I am making calls to a Thread class (which contains the above components) to update the JFrame indicating the current status. Normally I have no problem with this as the paintImmediately method suffices. However, when I call this long operation from the constructor of a larger, more complex JFrame, the GUI remains unresponsive (despite the plethora of paintImmediately calls that are executed) until the user clicks in the threaded progress box.
    Unfortunately the SwingWorker solution will not work for me as I need to be completely backwards compatible with JDK 1.3 (supporting Mac OSX 10.X). Oddly enough tho, I don;t get these problems when I use the same code in JDK 1.1.8 on Mac OS9.
    Any ideas?
    thanks!

    heh...looks like it was a simple thing afterall :)
    The JDialog (not JFrame) just needed focus.
    heh...is it friday yet? ;)

  • Not Connected Exception during long operation

    Hi all. My program does a very long operation - more than an hour. (import records from excel file). I create a thread, the operation runs there, and put af:poll on the page for changing progress indicator. So it's ok. The trouble is that I get
    Exception in thread "Thread-90" oracle.jbo.NotConnectedException: JBO-25200: Application module is not connected to a database.
         at oracle.jbo.server.DefaultTxnHandlerImpl.handleRollback(DefaultTxnHandlerImpl.java:145)
         at oracle.jbo.server.DBTransactionImpl.doRollback(DBTransactionImpl.java:4872)
         at oracle.jbo.server.DBTransactionImpl.rollback(DBTransactionImpl.java:2429)
         at kz.kklife.insis.modules.policyImport.ImportRunner.run(ImportRunner.java:124)
         at java.lang.Thread.run(Thread.java:619)
    after some time.
    With default jbo.ampool.timetolive (3 600 000) it throws exactly in an hour after starting developer server. So I changed it to 7 200 000. But I got an error on a production server in a random time - because I don't restart it just before importing, of course.
    So, is there any settings for weblogic not to disconnect transactions? (I get a transaction object through getDBTransaction() method of application module) I tried to uncheck "Ignore In-Use Connections" option, but it didn't help.

    Timo Hahn wrote:
    As far as I understand the framework, a transaction begins directly after the last commit or rollback.
    So I assume that the timeout is reset at this point. I would not make sense doing it otherwise. As you already mentioned if you set the timeout to e.g. 2 hours and you get the am instance from the pool after 1:59,59 of initializing the transaction it would be stale before you had any chance to do something with it.Oh. I'll try to commit new transaction just before import, thanks. Need I do something like
      DBTransaction transaction = ADFFacesUtils.getApplicationModuleForDataControl("ImportAppModuleDataControl").getDBTransaction();
      transaction.commit();
      // -- do long running stuffor you mean some another way to commit?
    I would set up a different configuration for this long running transaction (an other AM configuration) where I increase the timeout value to a higher number. Then use an instance from this configuration for the long running stuff only.I use another AM, only for long running stuff. But users can do import simultaneously.

  • Can you Run Lion server on iMac and use monitor for another computer

    With lion server you don't need a monitor and I figure why buy a mac mini when i could by a 27" imac and use it as a display and a mac mini running lion server.
    I have been going over the scenarios and am trying to decide if I should buy the TB display or a second 27" imac.  Eventually I will have 3 27" displays... but I want to run Lion Server off of one of the imacs... and use the display with the other imac.
    do you know if it is possible to use the display of the imac for a mbp or another imac while running an operating system (lion Server) on the computer at the same time.
    not sure if I made my self clear there or not.
    Ryan

    Ryan as long as both the Mac Mini and iMac have Thunderbolt you could use the iMac as an external monitor for the Mac Mini. The current machines with Thunderbolt connections are 2011 iMacs, MacMini's, MacBook Air's & all MacBook Pros.

  • Long Operation - OEM

    I ran a query on a table with 2 million records. When i looked in OEM the session in which the query is running is on Long operation. Selected the Long Operations tab, in which i can see three sections Active Operations, Past Operations and Details.
    My Question is in Detail section the progress bar starts with 0 and ends with a Calculated number (say 2442013). What is the Logic/calculation that oracle uses to arrive at this number (Blocks). My advance thanks for your responses

    When you run the query, it is optimizer who check optimal path to access data, it also know how many block need to scan.
    Same info you will get from v$session_longops.
    SELECT s.sid,s.serial#,s.machine,
    sl.elapsed_seconds, sl.time_remaining,
    ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
    FROM v$session s, v$session_longops sl
    WHERE s.serial# = sl.serial# and s.sid = sl.sid
    Virag

  • After updating to the latest version of Firefox on my Mac there is no progress bar for the page load. I really miss this feature and can't seem to find a way to obtain it.

    The page load progress bar that was on the lower right of the window is no longer there. After updating to the latest version of Firefox on my Mac there is no progress bar for the page load. I really miss this feature and can't seem to find a way to obtain it. The tab has a circular progress wheel but this is useless for determining a stuck or slow loading page.
    PLEASE NOTE: I am typing this in from a Windows based work computer but am asking about my Apple MacBook Pro that i use at home.

    Firefox 4 saves the previous session automatically, so there is no longer need for the dialog asking if you want to save the current session.<br />
    You can use "Firefox > History > Restore Previous Session" to get the previous session at any time.<br />
    There is also a "Restore Previous Session" button on the default <b>about:home</b> Home page.<br />
    Another possibility is to use:
    * [http://kb.mozillazine.org/Menu_differences Firefox (Tools) > Options] > General > Startup: "When Firefox Starts": "Show my windows and tabs from last time"

Maybe you are looking for

  • Canon MF4150 installation on Fedora 18

    I cannot install the Canon drivers for my Image Class MF4150 on Fedora 18. I get a message saying the security signature is missing.  How can I rectify this? Can I create a security signature or can I bypass the need for such in some way? Solved! Go

  • How to create adf-settings.xml

    hi The blog post "How to configure an ADF Phase Listener and where to put the file " by Frank Nimphius at http://blogs.oracle.com/jdevotnharvest/entry/how_to_configure_an_adf_phase_listener_and_where_to_put_the_file says "... To configure the adf-set

  • Fixing Recovery Partition

    I have hp dv6-3037tx I recently installed a new motherboard in my computer. Ever since, I have not been able to boot into the recovery partition. E.g. I press F11 at startup and nothing happens, it just boots directly to the Windows 7 Home Premium  O

  • WEB DB static html

    hello together, i have one question. i have installed oracle 8.i with webdb. I need static html files generated by webdb for a stand alone offline information terminal without webdb or applikation server. In most time this terminal works offline. I n

  • Goods receipt subcontracting item w/o PO

    Hi friends, We have material component A and B. We built BOM with 1A +1B =1C. Both A and B are in house inventory right now. My question is : How do I do goods receipt of C w/o  PO while A and B will be deducted at the same time. thanks in advance. L