A SENS Internal Presentation on Friday, October 3, 2003 TRAP Transparent Reflective Aspect...
-
Upload
brendan-hart -
Category
Documents
-
view
218 -
download
0
Transcript of A SENS Internal Presentation on Friday, October 3, 2003 TRAP Transparent Reflective Aspect...
A SENS Internal Presentation on Friday, October 3, 2003
TRAP TRAP Transparent Reflective Aspect Transparent Reflective Aspect
ProgrammingProgramming
SeyedMasoud Sadjadi
Supervised by Dr. McKinleyhttp://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/
A SENS Presentation on Oct. e, 2003 2Transparent Reflection by S. M. Sadjadi
AcknowledgementAcknowledgement
Dr. Cheng Dr. Stirewalt Eric Kasten Zhenxiao Yang Jesse Sowell Zhinan Zhou Farshad Samimi Peng Ge
A SENS Presentation on Oct. e, 2003 3Transparent Reflection by S. M. Sadjadi
AgendaAgenda
Motivation
Running Example
Architecture
Implementation
Related Work
Architecture
Running Example
Motivation
Implementation
OvervieOverview:w:
Related Work
Conclusion & Future Work
Conclusion
A SENS Presentation on Oct. e, 2003 4Transparent Reflection by S. M. Sadjadi
MotivationMotivation
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
Architecture
Running Example
Motivation
Implementation
OvervieOverview:w:
Related Work
Conclusion
A SENS Presentation on Oct. e, 2003 5Transparent Reflection by S. M. Sadjadi
AgendaAgenda
Running Example
Motivation
Architecture
Implementation
Transparent Reflection
Related Work
Architecture
Motivation
Running Example
Implementation
OvervieOverview:w:
Related Work
Conclusion & Future Work
Conclusion
A SENS Presentation on Oct. e, 2003 6Transparent Reflection by S. M. Sadjadi
Interactive Video MulticastInteractive Video Multicast
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
Wired receivers
Proxy
Sender
Wired receivers
Accesspoint
Wireless receivers
Architecture
Motivation
Running Example
Implementation
OvervieOverview:w:
Related Work
Conclusion
Ad-Hoc Network
Hori. vs. Vertical
Video Multicast
A SENS Presentation on Oct. e, 2003 7Transparent Reflection by S. M. Sadjadi
Ad-Hoc NetworkAd-Hoc Network
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.
Ad-Hoc Proxy1
Sender ReceiverWireless Ad-Hoc Network11 Mbps Ethernet
Ad-Hoc Proxy2
Low loss rate
High loss rate
Architecture
Motivation
Running Example
Implementation
OvervieOverview:w:
Related Work
Conclusion
Video Multicast
Hori. vs. Vertical
Ad-Hoc Network
Low
loss
rate
A SENS Presentation on Oct. e, 2003 8Transparent Reflection by S. M. Sadjadi
Ad-Hoc Proxy 2
Domain-Specific Services
Common Services
Distribution
Host-Infrastructure
OS and Protocols
Hardware Devices
Horizontal vs. Vertical Horizontal vs. Vertical AdaptationAdaptation
Horizontal Adaptation– Multi-Tier Adaptation
Vertical Adaptation– Multi-Layer (Cross-Layer) Adaptation
Architecture
Motivation
Running Example
Implementation
OvervieOverview:w:
Related Work
Conclusion
Ad-Hoc Network
Video Multicast
Hori. vs. Vertical
Mid
dlew
are
Laye
rs
Sender
Domain-Specific Services
Common Services
Distribution
Host-Infrastructure
OS and Protocols
Hardware Devices
Syst
emPl
atfo
rm
Ad-Hoc Proxy 1
Domain-Specific Services
Common Services
Distribution
Host-Infrastructure
OS and Protocols
Hardware Devices
Receiver
Domain-Specific Services
Common Services
Distribution
Host-Infrastructure
OS and Protocols
Hardware Devices
Layers defined by Schmidt [2]
A SENS Presentation on Oct. e, 2003 9Transparent Reflection by S. M. Sadjadi
AgendaAgenda
Architecture
Motivation
Running Example
Implementation
Related Work
Running Example
Motivation
Architecture
Implementation
OvervieOverview:w:
Related Work
Conclusion & Future Work
Conclusion
A SENS Presentation on Oct. e, 2003 10Transparent Reflection by S. M. Sadjadi
A Simple Generic Ad-Hoc ProxyA Simple Generic Ad-Hoc Proxy…public class relay { DatagramSocket rs; DatagramSocket ss; public void run() { … rs = new DatagramSocket(recv_port); ss = new DatagramSocket();
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
Running Example
Motivation
Architecture
Implementation
OvervieOverview:w:
Related Work
Conclusion
Run-Time Model
Layered Class Gr.
Ad-Hoc Proxy
A SENS Presentation on Oct. e, 2003 11Transparent Reflection by S. M. Sadjadi
Run-Time Class Graph ModelRun-Time Class Graph Model
Running Example
Motivation
Architecture
Implementation
OvervieOverview:w:
Related Work
Conclusion
Ad-Hoc Proxy
Layered Class Gr
Run-Time Model
…public class relay { DatagramSocket rs; DatagramSocket ss;
public void run() { … DatagramSocket rs = new DatagramSocket( recv_port); DatagramSocket ss = new DatagramSocket();
while (!EndOfStream) { rs.receive(packet); …
ss.send(packetToSend); } // end while … } …} // end relay
relay class
DatagraSocketclass
relay object
rs ss
Class LibraryClass Library HeapHeap
Simplified Run-Time Simplified Run-Time
Class GraphClass Graph
A SENS Presentation on Oct. e, 2003 12Transparent Reflection by S. M. Sadjadi
Layered Class GraphLayered Class Graph
Running Example
Motivation
Architecture
Implementation
OvervieOverview:w:
Related Work
Conclusion
Ad-Hoc Proxy
Run-Time Model
Layered Class Gr
ApplicationApplicationLevelLevel
BaseBaseLevelLevel
MetaMetaLevelLevel
DelegateDelegateLevelLevel
Class Library Heap
DatagramSocket relay rs & ss
relay
BaseLevel_DatagramSocketre & ss
MetaLevel_DatagramSocketrs & ss
Del 1
Del 2
Del 3
del 1
del 2
del 3
A SENS Presentation on Oct. e, 2003 13Transparent Reflection by S. M. Sadjadi
AgendaAgenda
Implementation
Motivation
Running Example
Architecture
Related Work
Running Example
Motivation
Implementation
Architecture
OvervieOverview:w:
Related Work
Conclusion & Future Work
Conclusion
A SENS Presentation on Oct. e, 2003 14Transparent Reflection by S. M. Sadjadi
Compiling StepsCompiling Steps
Running Example
Motivation
Implementation
Architecture
OvervieOverview:w:
Related Work
Conclusion
Admin. Consoles
Delegate Class
Gen. Aspect
Base-Level Class
Meta-Level Class
Compiling Steps
Generating Reflective Classes
Generating Aspect
BaseLevel_DatagramSocket
.java
“java.net.DatagramSocket”
MetaLevel_DatagramSocket
.java
Absorbing_DatagramSocket
.aj
relay.java
ApplicationSource inJava Files AspectJ Compiler (ajc)
relay.classExecutable
ApplicationClass Files
A SENS Presentation on Oct. e, 2003 15Transparent Reflection by S. M. Sadjadi
Generated AspectGenerated Aspect
Running Example
Motivation
Implementation
Architecture
OvervieOverview:w:
Related Work
Conclusion
Admin. Consoles
Delegate Class
Compiling Steps
Base-Level Class
Meta-Level Class
Gen. Aspect
public aspect Absorbing_DatagramSocket{ pointcut DatagramSocket() : call(java.net.DatagramSocket.new()) && …;
java.net.DatagramSocket around() throws java.net.SocketException : DatagramSocket() { return new 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) { return new BaseLevel_DatagramSocket(p0); } … // Pointcuts and advices around the static public methods … // Pointcuts and advices around the final public mehtods pointcut getClass(BaseLevel_DatagramSocket targetObj) : …;}
A SENS Presentation on Oct. e, 2003 16Transparent Reflection by S. M. Sadjadi
Generated Base-Level ClassGenerated Base-Level Class
Running Example
Motivation
Implementation
Architecture
OvervieOverview:w:
Related Work
Conclusion
Admin. Consoles
Delegate Class
Gen. Aspect
Compiling Steps
Meta-Level Class
Base-Level Class
public class BaseLevel_DatagramSocket extends DatagramSocket implements BaseLevel_Interface{ public BaseLevel_DatagramSocket() throws SocketException { super(); initMetaObject(); }
public BaseLevel_DatagramSocket(int p0)throws SocketException { super(p0); initMetaObject(); }
// Overriding the original methods. public void 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. public void Orig_send(java.net.DatagramPacket p0) throws IOException { super.send(p0); return; }}
A SENS Presentation on Oct. e, 2003 17Transparent Reflection by S. M. Sadjadi
Generated Meta-Level ClassGenerated Meta-Level Class
Running Example
Motivation
Implementation
Architecture
OvervieOverview:w:
Related Work
Conclusion
Admin. Consoles
Delegate Class
Gen. Aspect
Base-Level Class
Compiling Steps
Meta-Level Class
public class MetaLevel_DatagramSocket extends UnicastRemoteObject implements MetaLevel_Interface, DelegateManagement{ private Vector delegates = new Vector(); …
public synchronized Object invokeMetaMethod(Method method, Object[] args, ChangeableBoolean isReplyReady) throws Throwable { if (isReplyReady.value) return null; if (delegates.size() == 0) throw new 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 throw new MetaMethodIsNotAvailable(method.toString()); else return newMethod.invoke(delegates.get(i-1), tempArgs);}
A SENS Presentation on Oct. e, 2003 18Transparent Reflection by S. M. Sadjadi
Administrative ConsolesAdministrative Consoles
Running Example
Motivation
Implementation
Architecture
OvervieOverview:w:
Related Work
Conclusion
Compiling Steps
Delegate Class
Gen. Aspect
Base-Level Class
Meta-Level Class
Admin. Consoles
A SENS Presentation on Oct. e, 2003 19Transparent Reflection by S. M. Sadjadi
Delegate ClassDelegate Class
Running Example
Motivation
Implementation
Architecture
OvervieOverview:w:
Related Work
Conclusion
Admin. Consoles
Compiling Steps
Gen. Aspect
Base-Level Class
Meta-Level Class
Delegate Class
public class Delegate_DatagramSocket_send extends UnicastRemoteObject implements Delegate_Interface, FilterManagement{ private Vector filters = null; … public synchronized void send(DatagramPacket datagramPacket, ChangeableBoolean isReplyReady) throws IOException { if (isReplyReady.value) return;
Packet packet = new Packet(0, new byte[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; }}
A SENS Presentation on Oct. e, 2003 20Transparent Reflection by S. M. Sadjadi
AgendaAgenda
Related Work
Motivation
Running Example
Architecture
Implementation
Running Example
Motivation
Related Work
Architecture
Implementation
OvervieOverview:w:
Conclusion & Future Work
Conclusion
A SENS Presentation on Oct. e, 2003 21Transparent Reflection by S. M. Sadjadi
Related WorkRelated Work
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
Running Example
Motivation
Related Work
Architecture
Implementation
OvervieOverview:w:
Conclusion
A SENS Presentation on Oct. e, 2003 22Transparent Reflection by S. M. Sadjadi
ConclusionConclusion
On-Demand Overhead Selective Reflection Transparent Adaptation Legacy Application Promoting Separation of Concerns
Running Example
Motivation
Conclusion
Architecture
Implementation
OvervieOverview:w:
Related Work
Conclusion
Related Work
A SENS Presentation on Oct. e, 2003 23Transparent Reflection by S. M. Sadjadi
Future WorkFuture Work
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
Running Example
Motivation
Conclusion
Architecture
Implementation
OvervieOverview:w:
Related Work
Related Work
Conclusion
A SENS Presentation on Oct. e, 2003 24Transparent Reflection by S. M. Sadjadi
ReferencesReferences[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.
Running Example
Motivation
Architecture
Implementation
OvervieOverview:w:
Conclusion
Related Work
A SENS Presentation on Oct. e, 2003 25Transparent Reflection by S. M. Sadjadi
Questions?
Thank you!
Running Example
Motivation
Architecture
Implementation
OvervieOverview:w:
Conclusion
Related Work