Using DelayQueue with dynamically changing delay times?

Greetings all:
First-time poster, so please be gentle. :-)
I am implementing a cache timer task whose job is to removes idle elements from a cache after x time, and was considering a DelayQueue as potentially more efficient than iterating through the entire cache each time. Important point is that the delay time of elements in the queue will be dynamically changing while they're in the queue, until the point when they become idle, i.e., each time an element's content changes, its expiration time moves further out.
I went looking in the DelayQueue source (and from there to PriorityQueue) as I was interested to see how it implements its sorting mechanism, and it appears to me that it may not handle this properly. Specifically, it appears that the queue is sorted when elements are added or removed but not otherwise, so that you could end up with the head of the queue being an element that has not really expired.
Question: Has anyone used a DelayQueue for this kind of scenario, and if so, did it work as expected?
Thanks,
Brian

If you want this behaviour I suggest you look at
overriding LinkedHashMap as it has a means to
maintain sorted from most recently accessed to last
accessed.
Thus to clear it all you need to do is remove the
oldest elements.Interesting. Currently I'm using a HashMap so changing to a LinkedHashMap would require virtually no changes to existing code. It still won't quite work as-is, though, because access only gets updated on put's and remove's, whereas I would need access updated on any modification to a contained object as well. I'll think about it a bit more - thanks for the suggestion.

Similar Messages

  • How to dynamically  change start time in calendar

    Hi !
    Is it possible dynamically change start time attribute in calendar. Let's say I'd like to have start time = sysdate through 24 for display

    Hello Johann,
    If you created the calendar region using the wizard, it should have created a page item 'P#_CALENDAR_DATE' (# being your page number). Look at the Default setting for that item and it will likely be:
    return to_char(localtimestamp,'YYYYMMDD');This is the default date for the calendar (current date), in 'YYYYMMDD' format. Any code that sets this item to a date in 'YYYYMMDD' format should tell the calendar to display the calendar for that date. For example, I just changed it to this:
    return '20080101';And it displayed the calendar for that January, 2008. To test further I created a submit button and a branch, and in that branch I specified to set my P1_CALENDAR_DATE item to 20080601 and when I clicked the button it redisplayed the calendar for June, 2008.
    Hope this helps,
    John

  • Cannot change delay time for animated GIFs

    I just got PSE 6.0 for Mac, and I've slowly been learning how to do what I'd like to with it. I've noticed that there have been some problems with the program, though, such as sudden lockups that make me force-quit. One of my more serious issues involves making adjustments to the delay time in some simple, animated GIF files that I have been working on, using the Save For Web command. For some reason, I can't change the delay time from its default of 0.2 seconds to anything else; the slider doesn't respond when I click on it, nor can I make any direct adjustments in the field itself. In the end, I'm stuck with just that 0.2-second delay. Is this a bug in the program, or am I just missing something?
    If this helps, I have created a set of animated GIFs with two layers/frames apiece, looping continuously. The second and topmost layer is asigned a Dissolve filter, and usually left at 100% opacity when I make the final adjustments. The workspace background for each is transparent when I begin.
    Oh, also, I am using PSE on an Intel iMac with OS 10.5.6, with 2GB RAM and enough hard drive space to fit everything.

    Unfortunately, this is a known bug in PSE 6 for mac:
    http://kb.adobe.com/selfservice/viewContent.do?externalId=333620&sliceId=1

  • Dynamically change the time value in the report used on user's locale?

    Hello
    Just a question as I have been thinking about a lot of new scenarios in OBIEE. This is an open discussion and I'd like to learn from you experts on this...
    Let's say I have a report that has date, time, and stock.
    The date and time are stored in a time dimension in the DB.. I also have a user table in the DB that stores user's information for authentication purpose.. The stock comes from a fact table..
    So let's say it is 9am in NYC when the stock market is opened, and my company's stock value is $10/share at 9am est, April 20th.
    Then I have a user who is in California, he logs on to his system at 9am pst, he show see the stock value at 9am pst, which is actually 12pm est. Then I can have a user from India, or Japan or UK that their local time may be the next day already..
    If they are all coming to the same stock report and select the date and time filter say "April 20th", "9am", the resulting stock value should not be $10 like it would be for NYC users. It should be a different value corresponding to the stock value at a different est time after converting the local time zone to est..
    If I want to implement this, how would i go about it?
    Should The data loaded into the date dimension be kept at 1 standard time zone?
    How would the system automatically know what time zone when an user logged in to the system?
    Where does the conversion take place?
    In summary, what would be an overall process at a high level to implement such thing?
    Please share your thoughts..
    Thank you

    Hi Careen,
    You have to go for Controller extension and add a firePartialAction event for that item,
    get the handle of that event then get the bean handle where you want to set the value
    and set the value to that bean.
    Or you can get the VO handle and set the field's attribute(may be name) and its Form attribute(may be id).
    Thanks,
    With regards,
    Kali.
    OSSi.

  • Problem with dynamic change a page item value

    Hi,
    I'm trying to dynamically calculated the value of an item based on a simple formula that involves the multiplication of two elements from the same page.
    To do this, create dynamic action as follows:
    Event: Change
    Selection Type: Item(s)
    Item(s): P19_DURATION
    Action: Set value
    Fire on page load: TRUE
    Set Type: SQL Statement
    SQL Statement: SELECT :P19_DURATION * :P19_RATE FROM DUAL
    Page items to submit: P19_DURATION
    Selection Type: Item(s)
    Item(s): P19_AMOUNT
    When altering the P19_DURATION get no change in P19_AMOUNT
    Since my knowledge of javascript is almost zero, I'm trying to do this with pl / sql or sql. Try the dynamic action with a function or a PL / SQL statement and nothing works.
    Have to use javascript for this?
    Searching the forum I think it's something simple, but I did not find an example similar to what I need.
    Regards

    Event: Change
    Selection Type: Item(s)
    Item(s): P19_DURATION
    Action: Set value
    Fire on page load: TRUE
    Set Type: javascript
    javascript Code:
    amount = $v('P19_DURATION') *  $v('P19_RATE');
    $s('P19_AMOUNT',amount);

  • Using chart to track changes over time

    Hi, I'm monitoring the progress of recovery from injury and need to analyse changes in grip strength over time. I would like to use a chart with grip strength on the Y axis and time along the X axis.
    Unfortunately, the records were not taken at regular intervals, so the chart resulting from my data gives a misleading visual of progress. For example, my dates are sometimes one week apart, sometimes two, sometimes four.
    Is there a way to get the time intervals to scale properly? That is, at the moment each date is at an equal point along the X axis, regardless of how long between the two dates (3 April, 14 April, 28 May and so on). What I want is for those dates to be separated along the X axis in equivalent proportions to their relationship in time (thus 3 April would be much closer to 14 April, than 14 April is to 28 May).
    My only thought is to manually extrapolate the "missing" dates and guess the grip strength on those dates. Unfortunately this will defeat the purpose of the exercise. Any help most gratefully accepted, thank you!

    An XY scatter plot (third from the bottom) will preserve proportions on both axes. Connect the points with (straight) lines for a broken line graph.
    Regards,
    Barry

  • Using download_print_document with dynamic procedure

    I am using the version of download_print_document that calls a function (returning clob) for my reports (see below). I need to dynamicaly change the procedure being called in p_report_data line based on what report they run. Is it possible to store that in a DB column and pass that to the API or possibly use dynamic SQL etc?
    apex_util.download_print_document(
    p_file_name => l_form,
    p_content_disposition => 'attachment',
    p_report_data => sis_express_nj02.transcript (:P1,:P2,:P3),
    p_report_layout => l_layout,
    p_report_layout_type => 'rtf',
    p_document_format => 'pdf',
    p_print_server => null);*/

    Hi,
    Try something like:
    FUNCTION transcript (l_user in varchar2,
    l_owner in varchar2,
    l_report_order1 in varchar2,
    l_report_order2 in varchar2,
    l_report_order3 in varchar2,
    l_report_order4 in varchar2,
    l_start_yy in varchar2,
    l_resides_only in varchar2) return CLOB IS
    declare v_clob CLOB;
    l_p_report_data varchar2(30000) := 'sis_express_va23b.transcrip(
      v(''P507_APP_USER''),
    v(''P507_OWNER''),
    v(''P507_REPORT_ORDER''),
    v(''P507_REPORT_ORDER2''),
    v(''P507_REPORT_ORDER3''),
    v(''P507_REPORT_ORDER4''),
    v(''P507_YEAR''),
    v(''P507_RESIDES_ONLY'')
    begin
    execute immediate 'begin '|| ':1 := ' || l_p_report_data ||'; end;' using out v_clob;
    apex_util.download_print_document(
    p_file_name => l_form,
    p_content_disposition => 'attachment',
    p_report_data => v_clob,
    p_report_layout => l_layout,
    p_report_layout_type => 'rtf',
    p_document_format => 'pdf',
    p_print_server => null);
    end;The previous suggestion should work too but I think you don't you don't need *'* around l_p_report_data
    and you need OUT before v_clob parameter
    execute immediate l_p_report_data
    using OUT v_clob,l_user,lowner,l_report_order1,l_report_order2, ...Regards,
    Lev
    Edited by: le on Jan 12, 2011 1:09 PM
    Edited by: le on Jan 12, 2011 1:14 PM
    Edited by: le on Jan 12, 2011 1:17 PM

  • ADOBE Form Using Table with dynamic number of rows

    Hi All
    First some information about our infrastructure:
    - AdobeDesigner 7.1 in the Developerstudio
    - SAP-Portal 7.0 SP15
    I have a View with tabstrips and behind the tabs i have defined an event. On one Tab I included a ADOBE-Form with Table. The Data for the PDF sould only filled in the context for the Form when i jump to this Tab. I created the Form by using this documentation [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0859ad1-53aa-2a10-78ae-99e41c407669].
    To fill the tablecontext I use the following Code:
    IPrivateAnlegenBANFView.IPositionenElement position = null;
    IPrivateAnlegenBANFView.IPositionenNode posNode = wdContext.nodePositionen();
    int NUM_5_TIMES = 5;
    for (int i = 0; i < NUM_5_TIMES; i) {
    IPrivateAnlegenBANFView.IPositionenElement posElement = wdContext.createPositionenElement();
    +posElement.setMaterial("" + i);+
    +posElement.setKurztext("Test" + i);+
    +posElement.setWarengruppe("Warengr" + i);+
    posNode.addElement(posElement);
    If i put this code in the wdDoInit method it  works fine and shows me 5 Rows. But if I put the code in the Action of the tabstrip it shows me only one row. I checked the entries of the context and there are 5 entries (showed them in a WD-Table).
    Can someone tell me what im doing wrong?
    Thanks for a answer and kind regards
    Pascal

    Hi All
    finally i found the solution for the problem.
    When you define the interactive Form in the view do not define the property "dataSource" of UI-Element Interactive Form it seems, that the binding is static and not dynamic.
    Add the following source to the viewCotroller
    Global Part of the Source:
    private static IWDInteractiveForm form = null;
    Method wdDoModify:
    if (firstTime) {
      form = (IWDInteractiveForm) view.getElement("InteractiveForm");
    When you have an Event where you fill your Contextnode which you want to display in the table of an Adobe Form Use this code:
    Action:
    public void onActionFillTab(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ){
      //@@begin onActionFillTab(ServerEvent)
         * Code to fill the Node for AdobeForm Table
        form.bindDataSource(wdContext.nodeTabelle().getNodeInfo());
      //@@end
    If you want to clear your table and show it directly use in the action the following code:
    wdContext.nodeTabelle().invalidate();
    form.bindDataSource(wdContext.nodeTabelle().getNodeInfo());
    Kind regards
    pascal

  • Mass mailing with dynamically changing body of message

    I am working on mass mailing app where in I have set to email IDs to which I am sending message
    Each message should have first line address by respective first names fetched from the contacts. Is there any way to achieve this using default email editor. Can the default messageing be customized so it body of the message could be framed at run time

    Update - Not to answer my own question, but I think I may have gotten it.
    I'm using the Sound VIs now instead of the Play Waveform VI. From what I read there's a buffer in there that helps smooth out the transition between loop iterations. It works as intended. Also, my last problem about samples not being read was also due to a sampling mismatch in my DAQ Assistant I believe. All is right with the world again

  • Dynamically change flex variables with JSON

    I am trying to take different variables from within each other, and use that to dynamically change variables within flex, and I am not sure how to write it. For example, the JSON code would be something like:
         "content" : [
                                  "panels" : [
                                                           "height" : "200",
                                                           "width" : "300"
    Now I am trying to take the height and width from that, into flex, and change the panels' dimensions. any ideas?

    DSpider wrote:
    https://wiki.archlinux.org/index.php/Be … oxy_server
    Speed differences could be because the company is throttling certain connections (some companies do this, to discourage Youtube, FarmVille and other distractions). Hmmm... But a 10% difference is probably something else. Maybe check your /etc/resolv.conf?
    This is actually concerning my other thread . But in answer, no, same resolv.conf used in both cases. As I said there, I simply export a different value in http_proxy (no reconnection of any sort) and speed suddenly jumps.
    DSpider wrote:
    Edit: And maybe see this: http://askubuntu.com/questions/3554/how … connect-to
    And this: http://marin.jb.free.fr/proxydriver/
    Just about all of those things I've mentioned above as tried, except the .pac file. The problem with that is that it doesn't work generally for all graphical applications, just ones that understand it (like firefox, I believe chromium as well) while things like dropbox would not work.
    Proxydriver seems very much gnome/kde linked, which isn't of much help when I'm running awesomewm.
    Thanks for your answers, really, but still looking for something else. Latest idea I have is to replace dropboxd, firefox, and all the other executables with my own script which first sets up http_proxy and then runs the original executable. So something like this:-
    #!/bin/sh
    export http_proxy=`cat /path/to/the/desired/proxy/server/as/set/up/by/netcfg/hooks`
    /usr/bin/firefox &
    Any disadvantages to this method? Then I can just forget about using tinyproxy (wouldn't mind that at all, its been a pain sometimes, just dying in the middle of a big transfer). I could possibly also do away with the netcfg hook and just implement the checking logic (based on the IP range) in the bash script itself.

  • If I completely fill my hard drive 500Gb how time machine will keep working having 1Tb of total space, I mean I have to delete mu hard drive but how I keep my previous information on time machine and keep using to with new information?

    If I completely fill my hard drive 500Gb how time machine will keep working having 1Tb of total space [externak hard drive], I mean I have to delete my hard drive but how I keep my previous information on time machine and keep using it with new information?

    Time Machine does not provide archival storage.
    If you delete a file from your disk it will eventually be deleted from your TM backup without any notice to you.
    You need a second external disk to use for archival storage.
    You also need a third disk for backups of the second disk.

  • SSRS 05 snapshot with dynamic date parameter

    I want to use snapshot for a SSRS 05 report due to high volume of report data. This report uses 2 date parameter which will keep changing every month ( mmyyyy) format. I read many blogs but it seems I can not have snapshot report in dynamic date situation.
    Can someone please suggest if there is any workaround to use snapshot with dynamic date parameter . The report server version is 2005.
    Gaur

    Hi Gaur,
    In Reporting Services, the snapshot is a report that contains layout information and data that is retrieved at a specific point in time. There’s a couple of requirements in order to use a snapshot:
    Stored credentials for the data source. 
    Defaults for all Parameters.
    Based on my research, we can use snapshot with dynamic date parameter. When we select 'Render this report from a report execution snapshot’ with a schedule and Apply in Execution tab, a snapshot is created and subsequently refreshed on a schedule. When we
    render the report at a time, the report would be rendered with the latest snapshot layout information and data, then use the current parameter value to filter the snapshot report data. In this way, the current data would be different from the snapshot report
    based on the current parameter values, but we can still use snapshot with dynamic date parameter.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • SprySuggest fails in IE with dynamic server data

    When using SprySuggest with dynamic server xml suggestions,
    the suggestions are never displayed in IE, if the XML response does
    not have the correct content-type. Code in SpryData.js attempts to
    handle this situation, but it did not work in my configuration,
    until I made the change shown below in bold.
    Spry.Data.XMLDataSet.prototype.xhRequestProcessor =
    function(xhRequest)
    // XMLDataSet uses the responseXML from the xhRequest
    var resp = xhRequest.responseXML;
    var manualParseRequired = false;
    if (xhRequest.status != 200)
    if (xhRequest.status == 0)
    // The page that is attempting to load data was probably
    loaded with
    // a file:// url. Mozilla based browsers will actually
    provide the complete DOM
    // tree for the data, but IE provides an empty document node
    so try to parse
    // the xml text manually to create a dom tree we can use.
    if (xhRequest.responseText && (!resp ||
    !resp.firstChild))
    manualParseRequired = true;
    else if ( (!resp) || (!resp.getElementById))
    // The server said it sent us data, but for some reason we
    don't have
    // an XML DOM document. Some browsers won't auto-create an
    XML DOM
    // unless the server used a content-type of "text/xml" or
    "application/xml".
    // Try to manually parse the XML string, just in case the
    server
    // gave us an unexpected Content-Type.
    manualParseRequired = true;
    if (manualParseRequired)
    resp = Spry.Utils.stringToXMLDoc(xhRequest.responseText);
    if (!resp || !resp.firstChild || resp.firstChild.nodeName ==
    "parsererror")
    return null;
    return resp;
    };

    Hi John,
    it is a known IE browser behavior for the files that don't
    have the content-type set on xml, that will not get be interpreted
    as text. So if you want to have your page working ok, you must
    assure that the server response contained an xml and not other
    content-type.
    Diana

  • Best approach -Tabs based ADF Tree left side navigation with Dynamic Regions with out UI Shell

    Hi,
    Somebody can help for the best approach to implement the following requirement.
    Req: When the user select the ADF Tree left side navigation menu, each menu will open as multiple tabs(Dynamic Tabs) in right side content area with out UI Shell Template.
    I completed the
    Step-1: From the Model project, I can able to render ADF Tree in the using view and view links. I can get the adf tree which is having 3 menu items. Each menu item having 2 sub menu's.
    I took each menu item as one(1) taskflow, each taskflow will have two(2) fragments.
    Total I have 3 task flows as Menu Items and 6 fragments for sub menu's.
    Step-2:  My question is How do I implement Tab based the ADF tree navigation (left side area to dynamic regions in content area) through dynamic regions? Please provide the steps in view layers.

    Than ks for your response.
    This is working fine for ADF Tree navigation with dynamic regions if the taskflow having only one fragment. if the taskflow having more than one fragments, this will not work. The following conditions are always satisfies one page fragment of either "employees" or "departments" task flow.  If the "employees" task flow have 2 page fragments, it's not work even you pass parameters through routers.
    public TaskFlowId getDynamicTaskFlowId() {
    if (currentTaskFlowID == null ||
    currentTaskFlowID.equalsIgnoreCase(“employees”)) {
    return TaskFlowId.parse(employeetaskFlowId);
    if (currentTaskFlowID != null &&
    currentTaskFlowID.equalsIgnoreCase(“departments”)) {
    return TaskFlowId.parse(departmetaskFlowId);
    return TaskFlowId.parse(employeetaskFlowId);
    My question is "Same use case with Dynamic Tabs" when the user click on any adf tree node.

  • FBL1N with dynamic selection WITHHOLDING TAX CODE is dropping rows

    Using FBL1N with dynamic selection field: WITHHOLDING TAX CODE and noticed that several vendors dropped off the report. Appears FBL1N's filter logic uses LFB1-QSSKZ and not LFBW-WT_WITHCD. Upon examination, I determined that the missing vendors didn't have a WTC assignment (column is BLANK) in table LFB1. Problem is I'm using transaction FK02's WITHHOLDING TAX ACCT tab to assign the WT codes but these rows are written to table LFBW (not LFB1). How is the LFB1-QSSKZ field populated? And why do some of the entries in LFB1-QSSKZ have values while others do not? Would ultimately like to populate the blank assignments with the correct WT code.

    Hi Steve,
    This is due to the limitation due to standard design.
    You can see that a vendor can be assigned to multiple WHT codes and can also have multiple WHT code for a single line item. Hence in FBL1N output it would not be possible to show the WHT code as there is no  one to one relationship.
    You can click on the line item and can then see the WHT information in WHT button. Or alternatively get the data in withholding tax information reports.
    Regards,
    SDNer

Maybe you are looking for

  • How can I insert text to the right of the right hand indent?

    I need to format data in a text box so that the data is separated into three columns defined by tab locations.  The data located at the second tab (column) has varying lengths so that at times it needs to wrap.  I need to have the data wrap before it

  • Turning OFF direct source (guitar) and hearing just plug in? How to?

    In Nuendo I think you just hit the monitor button or in my case open Mackie control panel and turn down the volume (if loaded) and then all I hear is the plug in and guitar sim and NO actual sound. Looking to do the same in Logic. Right now I hear bo

  • Multi Language support PDF Forms?

    I am trying to understand if I create form fields in Acrobat Pro (which we do often) will international users with differnet character set keyboards.(ie: asia, pac rim) be able to fill in the forms. When I create form fields now (English, Pro 9.2) I

  • WHOLE SYSTEM FREEZING UP!!!

    Firstly, I have the latest nod32 installed, fully upto date. Spybot is also installed and is latest version. All my drivers are also upto date. Ok, I'm really at a loss here. I even upgaded to the CS4 trial to see if it would fix it.(from CS3). (I un

  • Upgrade from 46C to ECC600 terminates in phase SHADOW_IMPORT_INC

    The upgrade of our develoment/test system terminates in phase SHADOW_IMPORT_INC. We got the message 27 errors detected and 3 activities have been aborted. Below you'll find the entries as they are in log file SHDALLIMP.ELG.   LIST OF ERRORS AND RETUR