⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overview-7.html.svn-base

📁 网络模拟器
💻 SVN-BASE
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
 <TITLE>A quick overview of JNS: How tracing works</TITLE>
 <LINK HREF="Overview-8.html" REL=next>
 <LINK HREF="Overview-6.html" REL=previous>
 <LINK HREF="Overview.html#toc7" REL=contents>
</HEAD>
<BODY>
<A HREF="Overview-8.html">Next</A>
<A HREF="Overview-6.html">Previous</A>
<A HREF="Overview.html#toc7">Contents</A>
<HR>
<H2><A NAME="s7">7. How tracing works</A></H2>

<P>
<P><I>Tracing</I> is the process by which someone looks at what is actually
going on in a network. In JNS terms, the thing that looks is a "Trace" and
the things that are being looked are "traceable". Not surprisingly, there
are the following two rules:
<UL>
<LI>If you want to receive information from the network, you have to 
subclass the <CODE>Trace</CODE> class.</LI>
<LI>If you want to implement an element that provides information to someone
who is listening, subclass the <CODE>Traceable</CODE> class.</LI>
</UL>
<P>
<P>So all elements in the network that provide tracing information have to be
subclasses of <CODE>Traceable</CODE>. Notice that those elements always provide
the information, even when no one is listening. If someone wants to listen,
they have to "attach" themselves to a traceable object. A subclass of trace
will normally call the <B>attach()</B> method of a traceable element to 
add itself to that element's list of listeners.
<P>
<P>If something of significance happens, the traceable object will generate an
event, which is actually an instance of the class <CODE>Event</CODE>. Every event
has a name and list of parameters (you are referred to the "Event" 
documentation enclosed in this package for a rather precise documentation of
event classes). This event is then propagated to all the subclasses of
<CODE>Trace</CODE> that have attached themselves to the generating element.
<P>
<P>If your custom protocol wants to generate an event, notice that all the 
handling of attaching new <CODE>Trace</CODE> objects to your object (which, as
you know, must be a subclass of <CODE>Traceable</CODE>) is actually handled by
the superclass. You do not need to take care of anything. All you need to do
is call the <B>sendEvent(event)</B> function as soon as you have set up
your event. The superclass will send the event to everyone who wants it - or
maybe nobody if nobody's listening.
<P>
<P>We hope that the tracing process is reasonably straight-forward. For a 
different view on the subject read the "ExtendJavis" document that covers the
topic of writing event handlers that generate a Javis/NAM trace-file and the
"Event" document, which will give you good insight into events themselves.
<P>
<P>
<HR>
<A HREF="Overview-8.html">Next</A>
<A HREF="Overview-6.html">Previous</A>
<A HREF="Overview.html#toc7">Contents</A>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -