Replace dynamic proxies and reflection with invokedynamic

I have an application that extensively uses reflection and dynamic proxies. It was built on Java 6. Now, I rebuilt it on Java 7, and I am thinking of replacing all reflection and proxies with new invokedynamic.
Can anybody tell me if it's worth the trouble? I mean, will I get any significant performance boost, and will it complicate or simplify my source code?
Also, can you recommend some good tutorials or articles to get me started? I found some, but they confuse me more then they help :-). I think I have an idea how to replace reflection calls, but can't really figure out how to replace dynamic proxies (is there a replacement for InvocationHandler, or something like that?).
Thanks for any help.

the MethodHandle javadocs have pretty straightforward examples on usage http://docs.oracle.com/javase/7/docs/api/java/lang/invoke/MethodHandle.html . It looks like you can use Lookup.unreflect to convert a Method to a MethodHandle (this seems like the most straightforward conversion for existing code): http://docs.oracle.com/javase/7/docs/api/java/lang/invoke/MethodHandles.Lookup.html#unreflect(java.lang.reflect.Method) .

Similar Messages

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates.
    My requirement is :
    create table xxinv_item_pei_taginfo(item_id number,
    Organization_id number,
    item varchar2(4000),
    record_type varchar2(4000),
    record_value CLOB,
    State varchar2(4000));
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'USES','fever','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'HOW TO USE','one tablet daily','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'SIDE EFFECTS','XYZ','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'DRUG INTERACTION','ABC','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'OVERDOSE','Go and see doctor','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'NOTES','Take after meal','TX');
    select * from xxinv_item_pei_taginfo;
    Item id Org Id Item Record_type Record_value State
    493991     224     1265-D30     USES     fever     TX
    493991     224     1265-D30     HOW TO USE     one tablet daily     TX
    493991     224     1265-D30     SIDE EFFECTS     XYZ     TX
    493991     224     1265-D30     DRUG INTERACTION     ABC     TX
    493991     224     1265-D30     OVERDOSE      Go and see doctor     TX
    493991     224     1265-D30     NOTES     Take after meal     TX
    Above is my data
    I have to fetch the record_type from a lookup where I can have any of the record type, sometime USES, HOW TO USE, SIDE EFFECTS and sometimes some other set of record types
    In my report I have to get these record typpes as field name dynamically whichever is available in that lookup and record values against them.
    its a BI Publisher report.
    please suggest

    if you have data in db then you can create xml with needed structure
    and so you can create bip report
    do you have errors or .... ?

  • I have purchased an Apple TV from a friend. How do I replace his username and password with mine?

    I have purchase an Apple TV from a friend.  How do I replace his username and password with mine.

    Sign out and sign in with your own Apple ID.

  • Dynamic SQL and Data with Single Quotes in it.

    Hi There,
    I have a problem in that I am using dynamic SQL and it happens that one of the columns does contain single quotes (') in it as part of the data. This causes the resultant dynamic SQL to get confused as the single quote that is part of the data is taken to mean end of sting, when in fact its part of the data. This leaves out a dangling single quote that was meant to enclose the string. Here is my dynamic SQL and the result of the parsed SQL that I have captured:
    ****Dynamic SQL*****
    l_sql:='select NOTE_TEMPLATE_ID '||
    'FROM TMP_NOTE_TEMPLATE_VALUES '||
    'where TRIM(LEGACY_NOTE_CODE)='''||trim(fp_note_code)||''' '||
    'and TRIM(DISPLAY_VALUE)='''||trim(fp_note_text)||''' ';
    execute immediate l_sql INTO l_note_template_id;
    Because the column DISPLAY_VALUE contains data with single quotes, the resultant SQL is:
    ******PARSED SQL************
    select NOTE_TEMPLATE_ID
    FROM TMP_NOTE_TEMPLATE_VALUES
    where TRIM(LEGACY_NOTE_CODE)='INQ' and TRIM(DISPLAY_VALUE)='Cont'd'
    And the problem lies with the single quote between teh characters t and d in the data field for DISPLAY_ITEM. How can I handle this?
    Many thanks,

    I have been reliably informed that if one doesn't enclose char/varchar2 data items in quotes, the right indices may not be usedI am into oracle for past 4 years and for the first time i am hearing this.
    Your reliable source is just wrong. Bind variables are variables that store your value and which are used in SQL. They are the proper way to use values in your SQL. By default all variables in PL/SQL is bind variable.
    When you can do some thing in just straight SQL just do it. Dynamic SQL does not make any sense to me here.
    Thanks,
    Karthick.

  • Dynamic proxies and RMI

    Hi -
    We are having a problem with JDK 1.3.1. We are trying to use dynamic proxies on an object that is bound to an RMI registry.
    We find that the proxy works when the object is called from within the same JVM.
    When RMI method invocations come in from outside the JVM, the dynamic proxy does not get called.
    This seems like a bug. Is it? Is it going to be fixed?
    I suppose a way around it for now is to have the RMI implementation simply delegate to another object that has a dynamic proxy attached to it, but that seems ugly.
    Thanks
    Peter Mularien
    Deploy Solutions, Inc.

    The problem is, that the java runtime environment currently does not supply stubs for dynamic proxy classes. As far as I know this will not be addressed in 1.4. So you cannot create remote objects as dynamic proxies for now.

  • Java and Reflection with java 1.5.06b

    My java programs no longer run after i upgraded to Java 1.5.06b.
    They rely heavily on java reflection, since the classes are loaded and instanced dynamically at runtime.
    I have set my classpath in my .tcshrc and it works on my linux/solaris boxes, but my intel mac book pro can't seem to do reflection. It can't find any of the classes dynamically.
    Is the Apple Java not completly compliant?, did the java 1.5.06 security fix screw up reflection ?
    MacBook Pro   Mac OS X (10.4.6)  

    Sorry it ran fine on my older 12 inch powerbook.
    The one i used before i switched over to the intel macbook pro

  • Bionic to Razr, replace first Razr and sim, with new Razr and Sim.  All service loss.

    I would like to say that the era of smartphones has been both fun and expensive.  Having computers in our pockets is an amazing breakthough in technology.  I used to have both the Droid, and I also got the Droid 2 when it came out, my next purchase was the Bionic, and that's where my problems started.  The 4g would drop all the time, and it wasn't much of an inconvenience because usually it would come back on if I waited a little bit.  I'm patient most of the time unless I need directions somewhere and then I get a bit angry.  So I researched on the web and I tried all the tips and tricks and other things you can do to see if you can fix the problem to no avail.  I would check in from time to time and found out that it was a known issue, so I called up and just like I heard I could get a free replacement phone the Droid Razr which had come out directly after the Bionic.  I got it in the mail and it worked for about 20 minutes before losing all service(not just the 4g), and this happened every 5 to 10 minutes for the next couple days, so I got drunk and planned on yelling at some poor verizon person, but she was so nice and offered to send me out a new phone, so I decided to be nice back.  She said I should make sure to send in my Bionic so I didn't get charged, but I said how about I send in the ****** that you sent me instead and keep my original.  I got the new one a couple days later, and it seemed to be ok for the first few days, maybe I was just lucky not to notice.  It does the same thing as the other one, and I am about to lose my patience.  I want a solution to my problem.  Is there anyone out there in Verizonland that can give me a solution that doesn't involve (because I have already done all these things multiple times) resetting the phone to factory default, clearing the cache, the motorola reconnect app, power cycling the phone by holding the power and volume down keys, or as i mentioned above getting a new (used and probably sent back in because of the same problem) phone and sim card?

    Same as before, the service drops to zero, has the universal no sign over the bars.  The screen kicks on and it starts to build up to 4 bars, then white 4g, blue 4g, and it does that oh I would say every 10-30 minutes or so when I have had it sitting there while on my computer.  If I am on Netflix watching stuff it doesn't drop, like once I have engaged the 4g and am using it I don't have problems with it.  I have had a couple of calls drop, and in a text conversation it has just dropped to zero while I was typing a response.  I am not sure about maps, it's usually off when I want to try to find something so I have to wait for it to kick in to give me a route, which is by far the most irritating thing in the world when you are in unfamiliar territory.

  • Replaced my IPOD and registering with ITUNES

    I had to replace my IPOD when the old one broke. When I go to ITUNES it won't let me register the new IPOD because I arleady have an account. How do I eliminate the old IPOD and register the new one?

    You don't need to create a new iTunes account to register a product.
    You can also register your new purchase here -> https://register.apple.com/cgi-bin/WebObjects/GlobaliReg.woa

  • Dynamic display and interaction with UI components...Need help!!

    hi
    I want to create forms which asks users to enter data in some fields/GUI components. If i call these field one "group" then i have to display this group of components as many times as may be required (based on some other calculation). How can i do this.. and even if i do this how would i write the code for interaction.. Can i do this??
    plz reply
    thanks

    hi
    I want to create forms which asks users to enter data in some fields/GUI components. If i call these field one "group" then i have to display this group of components as many times as may be required (based on some other calculation). How can i do this.. and even if i do this how would i write the code for interaction.. Can i do this??
    plz reply
    thanks

  • A Listener solution based on Generics and Dynamic Proxies

    Listeners are common in the java world, espacially in swing. It is easy to implement a listener, and it is easy to call an existing method that notifies all registered listeners, but it's laborious to implement this notification code itself.
    I present a small, typesafe solution called GenericListeners based on Dynamic Proxies and Generics that reduces the notification code to just a single line of code:
    IGenericListeners<FooListener> fooListeners = GenericListeners.create(FooListener.class);If FooListener looks like
    public interface FooListener {
      public onEnter(int id);
      public onExit();
    }then you can register and call Listeners with
    fooListeners.addListener(foo);
    fooListeners.call().onEnter(1);If you are interested, please have a look at
    http://www.sebastian-baltes.de/SebWiki/Wiki.jsp?page=GenericListeners
    What do you think about this?
    Message was edited by:
    Sebastian_Baltes

    Interesting point, and so I've done some tests:
    0:00:01.391 - plainest implementation
    0:00:02.469 - GenericListeners
    0:00:03.422 - javax.swing.event.EventListenerListI used a test that registers a listener and calls it 10,000,000 times in a for loop on Java 6, AMD Athlon 3000.
    I would say that GenericListeners performs well, especially compared to the EventListenerList that is used in all swing components. The problem with EventListenerList is that it stores different classes of listeners at once and has to find the right ones every time you raise an event. For my tests, I only stored one single listener into the list.
    You can imagine how bad the performance of the swing implementation would be if you have a real life example with a lot of different listener classes.

  • Replace each 0 and 1 in an array with n number of 0s and 1s

    Hi , could you please help me with this. Lets say I have this array
    01001
    and I want to replace each 1 and 0 with 2  ( might be 10000)  number of0s and 1s. so the result is
    0011000011
    Could you please help me to implement this in LV . As mentioend I should be able to repeat the bits as many time as specified . 2 times or 100000 times
    Thanks

    I would use Initialize Array.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Upsample.png ‏13 KB

  • Combining LVOOP DVR with Asynchronous Dynamic Dispatch and Preserve Run-Time Class

    OK, the title sounds like a cornucopia of LVOOP terms.  But there's a reason.  This is in a way an extension of THIS thread.
    What I'm doing recently is creating a LVOOP approach to loading Completely Asynchronous UI elements into subpanels.  This I have combined with a global repository for the objects (which are essentially singletons with a UI functionality) which are shared via DVR, thus eliminating a lot of synchronisation headaches).
    This means that I can ahve a universal framework for launching the UI elements into a subpanel.  The changes made on the Object there are automatically reflected in the global repository.
    So far so good.
    What I don't like too much is a combination of two seemingly awkward code constructs I need in order to keep things running.
    Weird construct 1:
    I have defined a "Launch UI" function in my parent class which is Dynamic Dispatch (Allowing each object to take care of launching its own UI).  This takes a parent object DVR as a second input which I make sure is of the exact same type as the object type being invoked by using the code shown below.  The ACTUAL Type of both inputs to the launch VI within the IPE are identical.  This is guaranteed because I require each new class to override this function.
    Here I pass the DVR from outside the IPE to the "Launch" VI but the Object obtained within the IPE retains information required for DD thus ensuring that the VI called for launching the UI is identical to the ACTUAL object type in the DVR.  This works OK and by placing this weird construct WITHIN the parent class, abuse is minimised, it works fine and seems to have no major side-effects.
    So now we have a VI running asynchronously in the background which belongs to a specific object but has a DVR which it *thinks* is of a Parent Type but, because of the steps taken earlier, is actually of the same type as the object itself.
    In order to make use of the functionality defined in this actual object type, I need to continuously re-interpret the Object within the IPE as shown below.  Otherwise only the Parent functionality is available.
    If I am accessing only methods of the parent class, then the Preserve functionality is not needed.
    Is there a more elegant way to do this?  I find the net result of this code and type-juggling to be really useful and much easier to manage than the non-DVR route since the synchronisation issues disappear.  By making the IPE usage near-atomic we remove the chances of deadlock.
    All editing done in the UI of the asynchronous VI is reflected automatically in any subsequent usage of the DVR.  Even if the DVRs are not shared between VIs, this makes (for me) the headache of synchronisation easier.  If you start expanding this beyond the limits of a single VI, the benefits in Synchronisation become really huge.  You can even have multiple UI objects operating on the same data in the background without extra synchronisation needs.  The only synchronisation required is a global "Data updated" for the object in question whereby the UI elements simply update their indicators and controls from the DVR again.  This is trivial.
    Thus I am convinced that the net result of this is very beneficial.
    My question is if there's a better, safer or more "official" way to do this?
    I was about to start a new Idea for combining the "Preserve Run time Class" and the DVR Terminal of the IPE so that the casting is done automatically.  We could then have a double input to the IPE, the DVR (of base type) plus the ACTUAL Type of the object but of course returning an error if the types are incompatible.  It would be like an "Imposter" DVR input for the IPE which allows a re-interpretation of the object type.
    Would all of this go away if we allowed Dynamic Dispatch to work with DVRs?  Probably.
    Shane
    Say hello to my little friend.
    RFC 2323 FHE-Compliant
    Solved!
    Go to Solution.

    You guys rock!
    I didn't even think of casting the DVR like that.  Kinds stupid of me but I never would have thought it would work.  Cool.
    Also, Yeah, the limitation of no IPE in the Launch VI was one I spotted quite early on.  this is why my Launch VI also doesn't accept more data than is absolutely neccessara because a DVR access in that VI will of course cause a lockup.  I have the system so far now that I can have a SINGLE Launch VI (Which is NOT overridden, so the limitation refers to only a single VI now which is certainly better.
    So again guys, thanks for helping out an old newbie.  I've been around for quite a while, have made many posts but I love the way I just keep learning from others in the Forum.  This is just why I absolutely LOVE it here. 
    Shane.
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • My brand new Macbook PRO crashed completely after it went through the iOS 10.7.4 update, I lost everything and Apple just wants to replace the HD and let me deal with the hassle.

    Last Thursday May 10th I received a prompt from the Automatic Update to update the iOS to Ver. 10.7.4, set the start and was watching the progress when it stopped with an error message saying that it was not able to update, right below there was a buttom "RESTART", pressed the buttom and waited to re-boot.....That was the end of my computer, somehow the update crashed my HD beyond recover, it would only show the gray screen with Apple logo in the center and kept beeping, BEEP BEEP BEEP.....PAUSE.....BEEP BEEP BEEP.....PAUSE.....on and on and on and it never past that.
    Friday May 11 I took it to a retailer where I received the bad news that the HD was crashed and the teck couldn't even try to copy anything from it as it couldn't locate it. I checked iCloud on a hope that all my stuff would be there but new surprise, iCloud didn't kept all of my stuff as it was programmed to.
    Now here is the funny part, the tech from the retailer informed me that the only thing they could do was to order a new HD for my 4 months old Macbook and that the time to have my computer back will be at least 15 days, now that is the funny part, I fail to understand why do I have to suffer the hassle of loosing all my data plus wait at least 15th days to have my computer back (meanwhile loose work) on a problem caused by Apple, PROBLEM, not machine defect, clearly my computer had no problem untill I followed the procedure to update.
    On Saturday May 12 I contacted Local Apple Support (I have failed to mention that I live in Brasil) and they informed me that what the dealer said was the only thing that could be done, too bad for me if I lost everything, going to loose several days of work and whenever I receive my computer back will have to re-construct all my life and deal with the forever lost data.....DEAL WITH IT
    After a couple of discussion with Apple Support and the Dealer, I made my decision to take the Macbook to the dealer today for repair and meanwhile I'm opening a case with the Brazilian Justice to have Apple honor with all the trouble and hassle that it is causing me, it's said that I have to take this type of action as I'm a very fan of Apple and it's products, have had several iPods, iPhones, Macbooks, Keyboards, Mouses, Apple TV, etc.....This i the first time I have a problem with a Apple product and got a taste of the "Apple Care", it seems like Apple is more concerned on seeling products then keeping long time customers happy.
    One last thing, today when I was at the dealer to drop my computer for repair, the Technician informed me that he also had a computer crashed and the HD erase on Sunday May 13th in the same way of mine, after the update everything was gone, also he said that we were not the only ones, iPads and iPhones were going trough the same situation, update causing complete breakdown.
    WORD OF ADVISE, BE 1000% SURE THAT YOU HAVE EVRYTHING BACKED UP BEFORE YOU GO THROUGH AN UPDATE.

    rvalezin wrote:
    If I need to back-up every hour of my life in order to be able to save everything from something like this I won´t do anything else.....at least we should be able to trust that Apple tests this updates so situations like this won´t happen.
    That's exactly what Time Machine does for you.  It backs up every hour, so you don't have to.  While it is backing up, you keep on working.  Time Macvhine came with your Mac and you chose not to use it.
    The 10.7.4 update did not cause your hard disk to fail.  Hard disk fail due to mechanical causes.  They are extremely reliable, but that doesn't mean every hard disk will last a long time.  Your mileage WILL vary!
    If you are dependent on your computer and the data stored on it, then you should make sure you have AT LEAST two copies of all data and probably three or four.  You should use at least two means of backing up in case the backup software has a problem.  And you should consider having a backup computer if you live in an area where replacement takes too long (whatever too long is for your business).
    Apple hardware and software is very, very good.  You have documented your experience of this.  But NO hardware or software is perfect.  You also have experience of this.
    It is YOUR responsibility to ensure that your system is set up to protect your data and availability of computing resources.

  • Spry Tabbed panels + Progressive Enhancement and Dynamic Loading of Content With Spry

    Is there any way to combine tabbed panels together with "Progressive Enhancement and Dynamic Loading of Content With Spry"?
    Visit: http://labs.adobe.com/technologies/spry/articles/best_practices/progressive_enhancement.ht ml#updatecontent
    And click on the "Using Spry.Utils.updateContent()"
    The 3rd example shows how to use a fade transition whenever the content changes.
    I already have tabbed panels. My menu contains buttons (on tabs) and my Content div contains the panels.
    Tabs code;
    <ul class="TabbedPanelsTabGroup">
              <li class="TabbedPanelsTab">
                   <table class="Button"  >
                        <tr>
                        <td style="padding-right:0px" title ="Home">
                        <a href="javascript:TabbedPanels1.showPanel(1);" title="Home" style="background-image:url(/Buttons/Home.png);width:172px;height:75px;display:block;"><br/></a>
                        </td>
                        </tr>
                   </table>
              </li>
    etc
    etc
    etc
    and the panel code:
    <div class="TabbedPanelsContent" id="Home">
         CONTENT
    </div>
    I hoped i can use the example code from the link into my tabbed panels.
    I thought this code:
    onclick="FadeAndUpdateContent('event', 'data/AquoThonFrag.html'); return false;"
    could be added to the tab code like this:
    <a href="javascript:TabbedPanels1.showPanel(1);" onclick="FadeAndUpdateContent('event', 'data/AquoThonFrag.html'); return false;" title="Home" style="background-image:url(/Buttons/Home.png);width:172px;height:75px;display:block;"><br/></a>
    But the content doesnt fade...
    I know i need to change the header etc.
    The following is from the link:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Aquo Events</title>
    <script src="../../../includes/SpryEffects.js" type="text/javascript"></script>
    <script src="../../../includes/SpryData.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function FadeAndUpdateContent(ele, url)
    try {
         Spry.Effect.DoFade(ele,{ duration: 500, from: 100, to: 0, finish: function() {
              Spry.Utils.updateContent(ele, url, function() {
                        Spry.Effect.DoFade(ele,{ duration: 500, from: 0, to: 100 });
    }catch(e){ alert(e); }
    -->
    </script>
    <style type="text/css">
    /* IE HACK to prevent bad rendering when fading. */
    #event { background-color: white; }
    </style>
    </head>
    So i changed my header etc, put the SpryEffects.js and SpryData.js into position and nothing changed...
    Is there a way to keep my tabbed panel (or change as less as possible) and let
    A. The fade work
    B. The loading work.
    The problem now is that it loads all pages instead of only the home. Therefore i wanted this Progressive Enhancement.
    And the fading part is just because its nice...

    It doesnt show in the post but off course i changed this link;
    "data/AquoThonFrag.html"
    into;
    "javascript:TabbedPanels1.showPanel(1);"
    I must say i dont know if this even works...

  • Apple recently replaced my broken iPhone 5 with a new one. I backed up all my stuff in iCloud. When I set up the new phone I apparently used a back up from an earlier date. Now I am missing some of my stuff. How do I go back and use the most current I cln

    Apple recently replaced my broken iPhone 5 with a new one. I backed up the contents of my phone with iCloud.
    When setting up my new phone I used an iCloud back up from an earlier date. Now I am missing some of my most recent stuff. How
    Do I go back to use the proper iCloud back up to set up my new phone?

    Tap settings> general> reset> erase all content and settings...then you'll have a chance to setuo your phone again

Maybe you are looking for

  • 5.1 update

    After updating my iPad to 5.1, I cannot open any books in iBooks. I have reset it several times; I've deleted the app and reinstalled it. The book titles are there and it looks like the books are downloading bc the blue "loading" line is at the botto

  • Licensing of Crystal Reports for Eclipse

    Hi, i have a question about the licensing of Crystal Reports for Eclipse. We want to use the Crystal Reports runtime in our application. The application uses a client/server architecture with a smart/rich client. The crystal runtime runs on the serve

  • How to copy a table from one text frame to another...

    Is there a way to copy a table from one text frame to another? I'm using JavaScript. The following will move a table from one text frame to another, but I need to copy. var srcFrame = document.textFrames.item("section-template"); var dstFrame = docum

  • Mountain lion too long download

    Mountain Lion has been downloading on my computer for nearly 5 hours. Is this typical?

  • Workflow in FNM1 or FNM1S

    Hello alls, Does anyone know say what are the business object to the transaction FNM1 or FNM1S? It started as a workflow in these transactions for release of payment before the document be counted? The document will count only if the approver release