JTable - dynamic update exception

Hi,
My application displays a JTable based on an extended TableModel.
The TableModel observes an external source for changes, and updates the internal table data representation accordingly after which it calls
SwingUtilities.invokeLater( new Runnable()
   public void run()
      fireTableDataChanged()
})JTable then makes successive calls of TableModel.getValueAt() to repaint the table.
The problem is that the external source can add/delete rows from the table which JTable is making these calls. Eventually of course I get an exception because getValueAt() runs out of rows in the internal representation.
Making each TableModel method synchronized doesn't solve the problem because JTable will only lock the TableModel for the duration of the getValueAt() call, allowing the external source to update it in between times.
I suppose what really needs to happen is a lock on the table model which JTable is updating its view.
What approaches are other people using to solve this issue?
Thank you for reading, Dave

Hi Gweedo,
Thanks for your response. I agree that as small a change event as possible should be sent.
Here's a sketch of what I have:
class MyTableModel extends AbstractTableModel
   usual TableModel methods
   public synchronized Object getValueAt( int row, int col )
   public synchronized void notifyCreate( Record[] records )
      updateInternalModel();
   public synchronized void notifyUpdate( Record[] records )
      updateInternalModel();
   public synchronized void notifyDelete( int[] recordIds )
      updateInternalModel();
}The create/update/delete methods are called by a short-lived thread. The Record data originates from a CORBA server object, and my GUI application caches it based on the create/update/delete messages. When the server data changes my cache gets CORBA messages like the above, and the cache forwards these to interested objects within the GUI app, one of which is my table. The table does indeed suck the data out of the cache, based on the identity information in the record lists.
Given this, no matter how small I make the fire...Event grain, I don't really see any way to completely overcome my problem, given that notifyUpdate messages may occur in rapid succession. Unless I can know when the JTable has finished updating itself as a result of a fireTableDataChanged() event there doesn't seem to be any way to avoid the overlap between model and view updates.
Would you agree? If not would it be possible to post some code to show what you did??

Similar Messages

  • How to increase the number of rows in a jTable dynamically?

    Can anyone help me in increasing the number of rows in a jTable dynamically without using DefaultTableModel?
    I don't want to use DefaultTableModel because my program is about to finish except this problem.
    Thanks in advance.

    Presumably you're using your own custom table model class. Modify that so that it returns the number of rows you want. Though presumably it would do this anyway so I've no idea what the problem is.
    Do you mean you've added rows to the table model but they're not being reflected in the table itself? You need to fire events - AbstractTableModel provides simple methods to fire them, but if you're not using that then you'll have to fire them manually.

  • Problem with Dynamic Update in Humax MHP STB.

    Anyone encounters this problem b4?
    The dynamic update funtion of my app works well on other STB, except Humax, no update is reflected.
    I really don't know what to do to made it works now. Anyone can give a hint?
    What I can think of is implementing a Thread which keeps track of dynamic content. However, I can't think of the way to do it properly...

    Anyone encounters this problem b4?
    The dynamic update funtion of my app works well on other STB, except Humax, no update is reflected.
    I really don't know what to do to made it works now. Anyone can give a hint?
    What I can think of is implementing a Thread which keeps track of dynamic content. However, I can't think of the way to do it properly...

  • Dynamic Update of .war files or .ear files

    Hello,
    I don't see this ability in the current servlet spec. I was wondering if someone has come up with a way to implement the following idea.
    I'd like to dynamically update, add, and remove files from a .war file that is running in X servlet engine/application server. An example is adding new HTML files on the fly, or new Style Sheets. The files that I'm trying to add are not class files or any executable files.
    If you have any thoughts on how to do this or have done this, please let me know.
    Thanks for you help,
    d.bretenfeld

    It depends on what webserver you're using, and how you configure it.
    With Tomcat 4.0, each .war file on startup is extracted to it's own directory and from there any modifications have to be done with the actual files. the .war file is no longer used except as a backup.
    Now, with something like JBoss + Tomcat, the .war file is hot deployed anytime a new .war file is copied into the deploy folder. Personally I love this feature, as it forces you to actually "deploy" an application with updates all at once. And actually, you can get around this and modify individual files, but I wouldn't recomend it.
    So, as is the answer with so much of Java and J2EE, it all depends on your setup and configuration! =)
    I'd be happy to help you out more if you need anything else!

  • DNS replicating but not being dynamically updated by other DCs

    Background on setup:
    Our campus runs BIND for the DNS solution
    Campus servers do not allow for dynamic updates of the root zone (school.university.edu), but are set to allow dynamic updates of the AD-related zones (_msdcs, _sites, _tcp, _udp, DomainDnsZones, ForestDnsZones)
    We run Active Directory (2008R2/2012R2 Mixed Mode) with DNS
    Our DCs are all listed in the NS tab of our zones, but are not truly authoritative...campus BIND servers are
    We only have the default zones setup in our DNS, all allow for Dynamic updates (Secure Only)
    DNS zones are ADI and replicate to all DNS servers in the domain (All 6 DCs are DNS servers)
    Clients do not register with our DNS, they use the campus BIND servers.  Only AD domain controllers are registered in our zones and allowed to dynamically update
    Once upon a time, this setup worked without an issue.  Dynamic updates worked without an issue within our ADI zones, as well in the campus BIND servers.  When we started to add the new 2012R2 domain controllers into the mix, we noticed that this
    was no longer the case.  Since we don't often add or remove DCs from our setup, we do not know exactly when this broke.
    The issue is that our campus BIND DNS servers show all of the appropriate DNS records flawlessly.  We manually requested entries at the root (looks fine) and all AD zones updated dynamically with all expected records.  Our AD DNS servers on the
    other hand have a fair number of incorrect and missing records.  The only one of the three new servers to have records in our AD DNS is the server we moved all of our FSMO roles to before our technician noticed the DNS issues.  The other two have
    no records dynamically generated in our AD DNS zones.  We pulled one of the old 2008R2 DCs out of the domain using dcpromo since it had some other issues.  As expected, it pulled all of its records out of campus BIND cleanly but left all of its records
    in our AD DNS.
    If we manually add/remove an entry (PTR, CNAME, A, SRV), the change replicates appropriately across the domain.  However, we do not want to put a Band-Aid fix on this and manually enter all of the records.  We want to figure out why these two servers
    are not pushing their records into AD DNS despite updating them flawlessly in campus BIND servers.
    DNS is not my forte, so I'd welcome any advice on what I can as my best next steps.  I have played around a lot with modifying DNS servers listed in the DC network settings, and register this connection.  We can confirm that replication seems to
    be working fine.  We can manually add records.  DNS shows no errors in event log.  When using dcdiag dns test, it shows that we have missing records in our DNS but no other issues are displayed.  NSLOOKUP reveals campus DNS to be correct. 
    Any assistance would be appreciated...even if just to point me to a better tool for diagnostics.  We have not yet tried reinstalling DNS on any of the DCs and wish to avoid that if possible.

    Greg:
    Thank you for taking the time to respond.  I believe I have found a pseudo-solution earlier this week, but I find myself slightly confused by the solution.  On our network connections for the DCs, we had been making the BIND servers the primary
    and secondary DNS servers, then each of our DCs point to two of the other DCs for their tertiary and quaternary DNS servers.  Since the BIND servers have all of the correct records, we flipped those to make the DCs our primary and secondary before BIND
    servers.  This got all of the records into our AD correctly.
    It was my understanding that if you checked the "Register this connection in DNS" checkbox that it would register itself in all of the DNS servers in the list, but based off the above it seems it only registers in the first DNS server it successfully connects
    to; assuming it expects that primary server to replicate the records to others.  If this new assumption is true, then I am trying to figure out how I am supposed to get my DCs to dynamically update both AD-DNS and BIND when I make changes.  This
    may be best suited in another thread, so I'll gladly break it out into another if needed.  I do not have control over the BIND DNS servers, except for the fact that my DCs are allowed to dynamically update the AD subzones.  I have full control over
    my AD-DNS, but my clients computers are required to point to BIND for their DNS.

  • Dynamic Update of Curve Path

    I am using Photoshop CS6. I created a curve path and a "new" layer that contains the brush stroke applied to the path. I want the brush stroke to dynamically update when the path is modified. Can this be done?

    With the exception of extremely simple strokes (Shape Layer’s Stroke or Layer Style Stroke applied to a Layer with a Vector Mask, and those may have issues with unclosed Paths) you should follow Mylenium’s advice and use another application.

  • Noip dynamic update client

    Installed noip dynamic update client from community repo for ssh access if my ip changes while at work.
    No info in wiki or man pages.  Resorted to "noip2 help" no-ip.com support pages and Google for config info.
    Have noip installed and working, although it's not automatically updating no-ip.com when my dynamic ip changes.
    Have noip2 in my daemons list in /etc/rc.conf
    Can access my home computer from work via "ssh *********.no-ip.org" rather than ip addy.
    Logging into no-ip.com account after ip changes shows it does not update the ip.
    Running "noip" in a terminal updates the ip in my no-ip.com account.
    Ran sudo noip2 -C  to configure x times and still have an empty no-ip2.conf,  except for "0.0.0.0"
    Running "sudo noip2 -S" get the following:
    1 noip2 process active.
    Process 18169, started as noip2, (version 2.1.9)
    Using configuration from /etc/no-ip2.conf
    Last IP Address set 7*.***.***.***
    Account j*******@*****.***
    configured for:
    host *********.no-ip.org
    Updating every 10 minutes via /dev/eth0 with NAT enabled.
    Using nano rather than leafpad to look at no-ip2.conf shows the following:
    0.0.0.0^@^@^@^@^@^@^@^@^@
    ^@!L2JA\^@^@^@^A^A^A^@eth0^@^@^@^@^@^@^@^@^@^@^@^@dXNlcm5hbWU9amVmZnJzMTIlND5jb20mcGFzcz1tYXh4d29vZCZoW109amV==
    Should I manually put something into the no-ip2.conf and if so, what?
    I see a bunch of files similar names to this "NO-IPinGDWE" now that are empty in /etc.
    It'd be cool if someone who knows more than me would start a noip wiki page. If no one bites, I'll make one after I get this figured out.
    Last edited by jeff story (2012-07-21 04:50:24)

    Thanks Mektub,
    Yea I'm pretty sure the password was correct and verified by running "noip2" in a terminal and that updated it.  Thanks for the binary no-ip2.conf info. That explains what I saw.  Any idea why would it be a binary file?
    Got it updating now. First prob, I think originally, I ran noip2 -C as user rather than root. Second may have been file permission for no-ip2.conf was read write root only. I changed "root group" and "others" to read only access.
    Not sure which change fixed it but it's updating the ip correctly now.

  • IPS Signature Dynamic Update

    Hello,
    I need to know what type of privilege I need to use IPS Signature Dynamic Update.
    Thank

    Since the IPS dynamic update is accessed from the Admin tab, only the accounts having Admin privilege can change/modify the dynamic update settings, Here is a description of the various user roles in CS-MARS (taken directly from the user guide):
    •Admin: has full use of the MARS.
    •Notification Only: for a non-user of the MARS appliance, use this to send alerts to people who are not administrators, security analysts, or operators.
    •Operator: has read-only privileges.
    •Security Analyst: has full use of the MARS, except cannot access the Admin tab
    Hope this helps

  • How can i dynamically update a table in my program?

    Hi there!
    I would like to know if anyone can assist me with advice on how to dynamically update
    a table within my program, with new values from the database?
    Thanking You all.

    Add rows to its model.
    Kind regards,
    Levi

  • Dynamic update of safety stock in SAP R/3 systems (ECC 5.0 version)

    Hi Friends,
    Forgive my newness to SAP. Let me explain the problem i am facing in SAP. I want to identify the parameters to dynamically update the finished goods safety stock for each depot by SKU wise.
    Current process :- Safety stock is calculated manually and updated by using Transaction code MS02 in the system.
    It would be highly useful if i know the flow in SAP system and how the current process can be changed?
    If more info is required i'm ready to give.
    Thanks in advance

    Hi Mario Adler,
    Thanks a ton for ur answer.
    Will it update safety stock for finished goods in each depot by SKU wise? Raw material safety stock isn't my concern.
    project description :  Manufacturer of chemical goods , 70+ products,350 skus
    Distribution : factory to depot (bulk volume)
                          Mother go-down to depot(Stock transfer)
                         No of depots :33,factory:3,mother go-down -1
    Sales forecasting is done in excel for every month and updated to SAP via  BAPI. After that DRP,MRP and other runs takes place.
    What are all the areas i need to touch in to get the parameters to update the safety stock?
    Regards
    Arasu
    Edited by: Arasu_IIM on Apr 26, 2011 12:52 PM

  • How to dynamically update columns in a where clause to a SQL query in OSB?

    Hi Gurus,
    I have a requirement where in we need to dynamically update a where clause to a SQL query in OSB(11.1.1.6.0).
    For example:
    If the JCA sql string is "select * from emp where emp_id = 100 and emp_status ='Permanent'" now i want to change this where clause and the new query has to be like "select * from emp where emp_name like 'S%' and emp_dept like 'IT' ". basically we need to change the where clause dynamically.
    We can also use "fn-bea:execute-sql()" in a xquery but I don't want to use this function as creates a new connection.
    I have done some home work and found out --> as per the DOC "http://docs.oracle.com/cd/E23943_01/dev.1111/e15866/jca.htm#OSBDV943" section: "25.5.2 JCA Transport Configuration for Proxy and Business Services", when a business service is created by using JCA, we can see Interaction Spec Properties under JCA Transport Tab. This will have a property "SqlString' and we can over ride it. But I am unable to figure out how to over ride the value. I have tried by using Transport Headers activity but no luck. Please guide me how to achieve this?
    Thanks in advance
    Surya

    I solved my problem.
    In my header renderer, I simply added a line to set the text to the object value "label.setText( (String) value );" (where label is an instance of a JLabel.
    Thank you to who took some time to think about it.
    Marc

  • Please help! Ipod not dynamically updating smart playlists!

    I have quite a complex system of smart playlists on my 4G color ipod but I can't get any of them to update dynamically away from the computer. I have a total of 6 and here are their preferences:
    SPL 1:
    match ALL
    1) My rating is in the range 4-5 stars
    2) Last played is not in the last 1 day
    3) Last skipped is not in the last 1 day
    4) Playcount is less than 5
    limit to 100 by most recently added
    SPL 2:
    match ALL
    1) My rating is in the range 0-3 stars
    2) Last played is not in the last 1 day
    3) Last skipped is not in the last 1 day
    4) Playcount is less than 4
    limit to 55 songs by most recently added
    SPL 3:
    match ALL
    1) My rating is in the range 3-5 stars
    2) Last played is not in the last 1 day
    3) Last skipped is not in the last 1 day
    4) Playcount is greater than 5
    limit to 30 songs by random
    SPL 4:
    match ALL
    1) Last played is not in the last 1 day
    2, 3, 4) Playlist is not SPL 1, SPL 2, or SPL 3
    limit to 15 songs by random
    Unwanted:
    match ANY
    1) Time is greater than 15 minutes
    2) Genre is Comedy
    The active playlist that I use to listen to:
    match ANY
    1-4) Playlist is SPL 1, SPL 2, SPL 3, or SPL 4
    5) Playlist is not Unwanted
    So here's the problem. When I sync with my computer, the playlists work great, everything updates as expected and I get a pretty diverse playlist every time I sync which I want. The problem is that while I'm listening to my music on the ipod away from the computer, my playlists don't dynamically update. After I listen to a song, the song's supposed to remove itself from the playlist which doesn't happen, as well as when I skip songs. Even when I rate songs that aren't rated they don't appear in any playlist. This is really frustrating and I can't find a solution anywhere and yes, I do have Live Updating selected. I also have "Match only checked items" selected on all playlists as well. If anyone has any ideas for how to fix this, I would love to know. Thanks!

    I was searching this forum and found someone who says that 4th gen ipods have problems live updating smart playlists if the criteria "last skipped" is on the playlist. I took this off of all of my playlists but they still don't work. Then I tried making a playlist that is just "rating is equal to 5 stars" and it WORKS!!! But that doesn't help me out much for my other playlists so maybe it's some other criteria that's causing the problem. Any ideas?

  • Dynamically Updating Content Server Portlets

    [urlHi, I am currently having difficulty dynamically updating content server portlets.  I have a portlet of the following form:[/url]
    ArticleName Author Title Date mystory author1 title1 04/05/01
    story2 author2 title2 06/07/04
    story author3 title3 01/02/03
    So I have this table where each one of the line items is an article in the content server. So, for example the first line item is an article "mystory" by "author1", with title "title1" and date "04/05/01" additionally there is an article text field, but this isn't displayed unless I click on the article name.
    I can set up the basics of this portlet, but when I try to add any real functionality I run into one of two problems.
    First Problem: Passing Information
    I cannot find a way to pass information between content portlets. For instance, if the user would like to "re-sort" this table based on "date", I would like to have the user click on the "date" column heading and then reload the page. To do so, I would have to pass the section name back to the page so that it could resort based on this data. I have not found anyway to effectively pass information to a content server portlet. I am building these pages through use of the presentation template framework (so I can have access to the content items) but that seems to change the way portlets are handled.
    I got around this limitation with a regular portlet by creating an intermediary page which captures passed information and stores it to the session state. Once the information was in the session state, it is accessible to the portlet on the first page. However, this only works because remote portlets do not change their session id once loaded. Content Server portlets, on the other hand, change their session id after every reload of the browser or page change. I can send information from a content server portlet to an intermediary page, but I cannot send it back to the portlet because the session id has changed so I have no idea of knowing where to send the information. I can write it to a session state, but by the time I return to the portal page, the content server has changed its session id so it does not know where to look any longer.
    I suppose it would be possible to create an application state variable and append it with some static token (if there is some static variable per portal session) but I would rather not have to deal with application variables if at all possible.
    Second Problem: Dynamically Updating PCS Tags
    Even if I were able to the pass information back to my content server portlet, I run into another issue. The easiest way to sort content server items is using the filter command in the pcs:foreach tag. So, if I wanted to sort by author name, I could do something like the following <pcs:foreach var="item" expr="filter(folderByName('content'), filtered.name == '"name")" or something like that (the syntax may be incorrect, I just wrote this off the top of my head). However, it appears that the way the presentation templates are compiled goes in the order of PCS tags THEN JSP. So I would have no way of dynamically changing the variable on which I sort. For example, if I clicked on "Date" above in my table, I would like to be able to dynamically change my code so that I sort on date, and not name. I cannot find a solution to this problem.
    My workaround is to use the pcs tags to write out all the possible sortings to java array objects. This gives me access to the data on a JSP level and based on whatever the user will chose, I could then display that array. While this works, it is extremely ghetto and inefficient. Any help or suggestions would be fantastic.
    Thanks a lot,
    Jason Grauel

    You can use just about any javascript you want in any Content Server presentation template including ones that are used for portlets.
    However, you should be careful to name javascript functions and global variables uniquely so that they do not conflict with any other javascript on the page. To do this, you can append the item id to function and variable names, for example,
    function doSomething<pcs:value expr="pcs_id"></pcs:value>() {
    return true;
    Randy

  • HTTPS, DNS and dynamically updating DNS records

    Hello to you all, if you are able to help with a DNS problem that I'm having then please accept my thanks and appreciation in advance.
    First some background information, I recently  moved my server from my studio to my house where a new purpose built studio will soon be erected. At my old studio any requests for myurl.com came in via the IP (whether that be http, https, ftp etc) from the domain registrar and the router would send the request to the relevant port number whether that be 80 for http or 443 for https etc and all was well as this location had a fixed IP address. Unfortunately at my new location whilst I have a much faster connection I do not have a fixed IP. To get around this I have the following set up (not ideal for a business I know but perfectly OK for home hosting); I set up two psuedo nameservers at no-ip.com (ns1myurl.com and ns2myurl.com) which tracks the changes in my IP address and updates its records accordingly, my registrar then sends any requests to these 'nameservers' and no-ip then forwards it on to my server. So far so good.
    The problem arises once the requests get to my server, whilst I have DNS set up, I can only recieve requests from a straight request to the server ie myurl.com will display the site without any problem, but if I then put a www in front of that or try to access the https part of my site (which is set up as a seperate site on the same server) then the server throws an error. I have tried to put an alias (CNAME) into the zone but it does not want to resolve the request. I have searched around but to no avail, I am totally new to DNS so am currently on a steep learning curve and fumbling around in the dark.
    The first thing that I need to get working is the request to be resolved correctly and then (and this is where the real fun starts!) is to dynamically update the IP in the DNS records as the IP changes. I will probably have to get help in on this as I understand that this requires BIND of which I know nothing about, first though I'd like to get the pages to be served up correctly. Advice, hints, tips or links to tutorials all greatly appreciated. Full set up listed below.
    Many thanks, David.
    Xserve PPC G5 running 10.5.8 unlimited set up as standalone OD master
    Xraid
    APC UPS
    CradlePoint MBR1200 Gateway router which acts as the DHCP
    http://myurl.com and https://myurl.com set up as 2 seperate sites and located on the Xraid
    Current DNS setup:
    Primary Zone name: myurl.com with nameservers ns1myurl.no-ip.info and ns2myurl.no-ip.info and allow zone transfers in checked
    Then
    Name
    Type
    Value
    myurl.com
    Primary Zone
            ns1myurl.no-ip.info
            Machine
    12.34.56.78 (external IP)
            ns2myurl.no-ip.info
            Machine
    12.34.56.78 (external IP)
            myurl.com.
            Machine
    12.34.56.78 (external IP)
            www.myurl.com.
            Alias
    myurl.com.
    With the reverse zone looking thus with allow zone transfers being checked
    Name
    Type
    Value
    56.34.12.in-addr.arpa.
    Reverse Zone
            12.34.56.78
            Reverse mapping
            myurl.com.

    Thanks for the reply Camelot, that part though I had already figured out. I now have this working, all I did was change the external IP to the internal one of the server with resolves with the .local machine name and all is working just fine (for now!). As long as I have primary zones set for each site and any alias or services set up on them then everything works well.. The real test will be when my ISP changes the IP, whilst my tests have proved successful the proof will be when they update the address.
    Thanks anyway. David.

  • Dynamic UPDATE statement with parameters for column names.

    Hello,
    On this* website I read "The SQL string can contain placeholders for bind arguments, but bind values cannot be used to pass in the names of schema objects (table or column names). You may pass in numeric, date, and string expressions, but not a BOOLEAN or NULL literal value"
    On the other hand, in this Re: execute immediate with dynamic column name update and many other
    posts people use EXECUTE IMMEDIATE to create a dynamic UPDATE statement.
    dynSQL:='UPDATE CO_STAT2 CO SET CO.'||P_ENT_B_G_NAME||' = '||P_ENT_E_G_WE||'
    WHERE ST IN
    (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
    '||P_ST||' = CO.ST AND
    CO.'||P_ENT_E_G_NAME||' > '||P_ENT_E_G_WE||' AND
    CO.'||P_ENT_B_G_NAME||' < '||P_ENT_E_G_WE||');';
    EXECUTE IMMEDIATE dynSQL ;
    Since this statement is part of a Stored Procedure, I wont see the exact error but just get a ORA-06512.
    The compiling works fine and I use Oracle 11g.
    http://psoug.org/definition/EXECUTE_IMMEDIATE.htm

    OK I extracted from all of your posts so far that I have to use "bind-variables with :"
    From all the other tuorials and forums posts, I assume using the pipe is correct so I added those as well into the script:
    set serveroutput on format wraped;
    DECLARE
    dynSQL VARCHAR2(5000);
    P_ENT_E_G_NAME VARCHAR2 (100) :='test1'; P_ENT_E_G_WE VARCHAR2 (100) :='01.02.2012'; P_ENT_B_G_NAME VARCHAR2 (100) :='01.01.2012';
    P_ST                VARCHAR2 (100) :='32132';
    BEGIN
    dynSQL:= 'UPDATE CO_STAT2 CO SET CO.'||:P_ENT_B_G_NAME||' = '||:P_ENT_E_G_WE||'
                  WHERE ST IN (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
                  '||:P_ST||'                           = CO.ST                  AND
                  CO.'||:P_ENT_E_G_NAME||'     > '||:P_ENT_E_G_WE||' AND
                  CO.'||:P_ENT_B_G_NAME||'    
    < '||:P_ENT_E_G_WE||')';
    --this is somehow missing after the last < '||:P_ENT_E_G_WE||')';
    dbms_output.enable;
    dbms_output.put(dynSQL);
    --EXECUTE IMMEDIATE dynSQL;    
    END;Problem:I think I figured it out, the dates that I parse into the query need additional '

Maybe you are looking for