1 / 25

TRAP Transparent Reflective Aspect Programming

TRAP Transparent Reflective Aspect Programming. SeyedMasoud Sadjadi Supervised by Dr. McKinley http://www.cse.msu.edu/~{sadjadis,mckinley}/ Software Engineering and Networking Systems Laboratory Department of Computer Science and Engineering Michigan State University

liming
Download Presentation

TRAP Transparent Reflective Aspect Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TRAP Transparent Reflective Aspect Programming SeyedMasoud Sadjadi Supervised by Dr. McKinley http://www.cse.msu.edu/~{sadjadis,mckinley}/ Software Engineering and Networking Systems Laboratory Department of Computer Science and Engineering Michigan State University http://www.cse.msu.edu/sens/

  2. Acknowledgement • Dr. Cheng • Dr. Stirewalt • Eric Kasten • Zhenxiao Yang • Jesse Sowell • Zhinan Zhou • Farshad Samimi • Peng Ge

  3. Agenda Overview: Motivation Motivation Running Example Running Example Architecture Implementation Related Work Architecture Conclusion Implementation Related Work Conclusion & Future Work

  4. Motivation Overview: • Separation of Concerns • Development • Maintenance • Dynamic adaptation • Selective Reflection • On demand overhead • Supporting Legacy Applications • Change of requirement • Adding Security • Change of execution environment • Wired to wireless • Dynamic Adaptation • Long running and critical applications (availability) • Promoting Assurance Analysis • A systematic (principled) approach to adaptation Motivation Running Example Architecture Implementation Related Work Conclusion

  5. Agenda Overview: Motivation Motivation Running Example Running Example Architecture Implementation Related Work Architecture Conclusion Implementation Transparent Reflection Related Work Conclusion & Future Work

  6. Wired receivers Wireless receivers Sender Access point Proxy Wired receivers Interactive Video Multicast Overview: • Interactive Video Multicast in Wireless LANs by Peng Ge • Proxy-based solution • The proxy serves a subgroup of wireless system • Extra processing power • Localize error correction Motivation Running Example Video Multicast Ad-Hoc Network Hori. vs. Vertical Architecture Implementation Related Work Conclusion

  7. Ad-Hoc Network Overview: • Original Execution Environment • One hop wireless network using access point. • specified by Peng. • New Execution Environment • Multi-hop ad-hoc wireless network • Specified by Farshad. Motivation Running Example Video Multicast Ad-Hoc Network Hori. vs. Vertical Architecture Implementation Related Work Sender Wireless Ad-Hoc Network 11 Mbps Ethernet Receiver Conclusion Ad-Hoc Proxy1 Ad-Hoc Proxy2 Low loss rate Low loss rate High loss rate

  8. Ad-Hoc Proxy 2 Receiver Ad-Hoc Proxy 1 Sender Domain-Specific Services Domain-Specific Services Domain-Specific Services Domain-Specific Services Common Services Common Services Common Services Common Services Distribution Distribution Distribution Distribution Host-Infrastructure Host-Infrastructure Host-Infrastructure Host-Infrastructure OS and Protocols OS and Protocols OS and Protocols OS and Protocols Hardware Devices Hardware Devices Hardware Devices Hardware Devices Horizontal vs. Vertical Adaptation Overview: • Horizontal Adaptation • Multi-Tier Adaptation • Vertical Adaptation • Multi-Layer (Cross-Layer) Adaptation Motivation Running Example Video Multicast Ad-Hoc Network Hori. vs. Vertical Architecture Implementation Related Work Conclusion Middleware Layers System Platform Layers defined by Schmidt [2]

  9. Agenda Overview: Motivation Motivation Running Example Running Example Architecture Implementation Related Work Architecture Conclusion Implementation Related Work Conclusion & Future Work

  10. publicclass relay { DatagramSocket rs; DatagramSocket ss; publicvoid run() { … rs = newDatagramSocket(recv_port); ss = newDatagramSocket(); while (!EndOfStream) { rs.receive(packet); byte[] buf = Bytes.copy(packet.getData(), 0, packet.getLength()); DatagramPacket packetToSend = new DatagramPacket(buf, buf.length, target_address, target_port); ss.send(packetToSend); } // end while … } … } // end relay A Simple Generic Ad-Hoc Proxy Overview: Motivation Running Example Architecture Ad-Hoc Proxy Run-Time Model Layered Class Gr. Implementation Related Work Conclusion

  11. Run-Time Class Graph Model Overview: … publicclass relay { DatagramSocket rs; DatagramSocket ss; publicvoid run() { … DatagramSocket rs = newDatagramSocket( recv_port); DatagramSocket ss = newDatagramSocket(); while (!EndOfStream) { rs.receive(packet); … ss.send(packetToSend); } // end while … } … } // end relay Simplified Run-Time Class Graph Motivation Running Example Architecture Heap Class Library Ad-Hoc Proxy Run-Time Model Layered Class Gr relay class relay object Implementation Related Work Conclusion DatagraSocket class rs ss

  12. Layered Class Graph Overview: Motivation del 1 Del 1 Delegate Level del 3 Running Example Del 3 Del 2 del 2 Architecture Ad-Hoc Proxy Run-Time Model rs & ss MetaLevel_DatagramSocket Meta Level Layered Class Gr Implementation Related Work Conclusion re & ss BaseLevel_DatagramSocket Base Level rs & ss DatagramSocket relay relay Application Level Heap Class Library

  13. Agenda Overview: Motivation Motivation Running Example Running Example Architecture Implementation Related Work Architecture Conclusion Implementation Related Work Conclusion & Future Work

  14. relay .class Absorbing_ DatagramSocket .aj relay .java MetaLevel_ DatagramSocket .java BaseLevel_ DatagramSocket .java Compiling Steps Overview: Motivation Generating Reflective Classes Running Example “java.net. DatagramSocket” Architecture Generating Aspect Implementation Compiling Steps Gen. Aspect Base-Level Class Meta-Level Class Application Source in Java Files Admin. Consoles Delegate Class AspectJ Compiler (ajc) Related Work Conclusion Executable Application Class Files

  15. Generated Aspect publicaspect Absorbing_DatagramSocket { pointcut DatagramSocket() : call(java.net.DatagramSocket.new()) && …; java.net.DatagramSocket around() throws java.net.SocketException : DatagramSocket() { returnnew BaseLevel_DatagramSocket(); } pointcut DatagramSocket_int(int p0) : call(java.net.DatagramSocket.new(int)) && args(p0) && …; java.net.DatagramSocket around(int p0) throws java.net.SocketException : DatagramSocket_int(p0) { returnnew BaseLevel_DatagramSocket(p0); } … // Pointcuts and advices around the static public methods … // Pointcuts and advices around the final public mehtods pointcut getClass(BaseLevel_DatagramSocket targetObj) : …; } Overview: Motivation Running Example Architecture Implementation Compiling Steps Gen. Aspect Base-Level Class Meta-Level Class Admin. Consoles Delegate Class Related Work Conclusion

  16. Generated Base-Level Class Overview: publicclass BaseLevel_DatagramSocket extends DatagramSocket implements BaseLevel_Interface { publicBaseLevel_DatagramSocket() throws SocketException { super(); initMetaObject(); } publicBaseLevel_DatagramSocket(int p0)throws SocketException { super(p0); initMetaObject(); } // Overriding the original methods. publicvoid send(java.net.DatagramPacket p0) throws IOException { if(metaObject == null) { super.send(p0); return; } … Class[] paramType = new Class[1]; paramType[0] = java.net.DatagramPacket.class; Method method = BaseLevel_DatagramSocket.class.getDeclaredMethod( "send", paramType); ChangeableBoolean isReplyReady = new ChangeableBoolean(false); metaObject.invokeMetaMethod(method, tempArgs, isReplyReady); if(!isReplyReady.booleanValue()) super.send(p0); } // Original methods, but with "__Orig" appended to their names. publicvoidOrig_send(java.net.DatagramPacket p0) throws IOException { super.send(p0); return; } } Motivation Running Example Architecture Implementation Compiling Steps Gen. Aspect Base-Level Class Meta-Level Class Admin. Consoles Delegate Class Related Work Conclusion

  17. Generated Meta-Level Class Overview: publicclass MetaLevel_DatagramSocket extends UnicastRemoteObject implements MetaLevel_Interface, DelegateManagement { private Vector delegates = new Vector(); … publicsynchronized Object invokeMetaMethod(Method method, Object[] args, ChangeableBoolean isReplyReady) throws Throwable { if (isReplyReady.value) returnnull; if (delegates.size() == 0) thrownew MetaMethodIsNotAvailable(method.toString()); Class[] paramType = method.getParameterTypes(); Class[] newParamType = new Class[paramType.length + 1]; for (int i = 0; i < paramType.length; i++) newParamType[i] = paramType[i]; newParamType[paramType.length] = ChangeableBoolean.class; Object[] tempArgs = new Object[args.length + 1]; for(int i=0; i<args.length; i++) tempArgs[i] = args[i]; tempArgs[args.length] = isReplyReady; … if(!delegateFound) // No meta-level method available thrownew MetaMethodIsNotAvailable(method.toString()); else return newMethod.invoke(delegates.get(i-1), tempArgs); } Motivation Running Example Architecture Implementation Compiling Steps Gen. Aspect Base-Level Class Meta-Level Class Admin. Consoles Delegate Class Related Work Conclusion

  18. Administrative Consoles Overview: Motivation Running Example Architecture Implementation Compiling Steps Gen. Aspect Base-Level Class Meta-Level Class Admin. Consoles Delegate Class Related Work Conclusion

  19. Delegate Class Overview: publicclass Delegate_DatagramSocket_send extends UnicastRemoteObject implements Delegate_Interface, FilterManagement { private Vector filters = null; … publicsynchronizedvoid send(DatagramPacket datagramPacket, ChangeableBoolean isReplyReady) throws IOException { if (isReplyReady.value) return; Packet packet = new Packet(0, newbyte[0], datagramPacket.getData()); Packet[] packetList = new Packet[1]; packetList[0] = packet; int filterCounter = 0; while (filterCounter < filters.size()) { Filter filter = (Filter)filters.get(filterCounter); try { packetList = filter.process(packetList); } catch (FilterMismatchException e) { EventMediator.instance().notify(new FilterMismatchEvent(this, e)); filterCounter--; } filterCounter++; } … isReplyReady.value = true; } } Motivation Running Example Architecture Implementation Compiling Steps Gen. Aspect Base-Level Class Meta-Level Class Admin. Consoles Delegate Class Related Work Conclusion

  20. Agenda Overview: Motivation Motivation Running Example Running Example Architecture Implementation Related Work Architecture Conclusion Implementation Related Work Conclusion & Future Work

  21. Related Work Overview: • Our Previous Work in SENS • Adaptive Java & MetaSockets • An Aspect-Oriented Approach to Dynamic Adaptation • SpartanJ • Other Work • Meta Java • Behavioral reflection • Java RMI • Iguana/J • Modifying the JVM • Reflective Java Motivation Running Example Architecture Implementation Related Work Conclusion

  22. Conclusion Overview: • On-Demand Overhead • Selective Reflection • Transparent Adaptation • Legacy Application • Promoting Separation of Concerns Motivation Running Example Architecture Implementation Related Work Conclusion Conclusion Related Work

  23. Future Work Overview: • Finishing Remaining Parts • Supporting fields • Test “static” • Test “final” • Applying to “Java RMI” • Dynamic Adaptation of Java Reflection • Toward Multi-Tier and Multi-Layer Adaptation Motivation Running Example Architecture Implementation Related Work Conclusion Conclusion Related Work

  24. References Overview: [1] E. Kasten, P. K. McKinley, S. Sadjadi, and R. Stirewalt. Separating introspection and intercession in metamorphic distributed systems. In Proceedings of the IEEE Workshop on Aspect-Oriented Programming for Distributed Computing (with ICDCS'02), Vienna, Austia, July 2002. [2] Z. Yang, B. Cheng, R. Stirewalt, J. Sowell, S. Sadjadi, and P. McKinley. An aspect-oriented approach to dynamic adaptation. In Proceedings of Workshop On Self-healing Software, Nov. 2002. [3] S. M. Sadjadi, P. K. McKinley, and E. P. Kasten. Architecture and operation of an adaptable communication substrate. In The 9th International Workshop on Future Trends of Distributed Computing Systems (FTDCS '03), May 2003. [4] Douglas C. Schmidt. Middleware for real-time and embedded systems. Communications of the ACM, 45(6), June 2002. Motivation Running Example Architecture Implementation Related Work Conclusion

  25. Overview: Questions? Motivation Running Example Architecture Implementation Related Work Conclusion Thank you!

More Related