an adaptive programming model for fault-tolerant distributed computing_datamining
TRANSCRIPT
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
1/68
An Adaptive Programming Model for Fault-Tolerant
Distributed Computing
CONTENTS
1. INTRODUCTION
1.1About Fault Tolerance
1.2Benefits of Fault Tolerance
2. ORGANIZATION PROFI!
". #$#T!% ANA$#I#
".1 !&istin' #(ste)
".2 i)itations
"." Pro*ose+ #(ste)
"., A+-anta'es of *ro*ose+ s(ste)
,. PROB!% FOR%UATION
,.1 Obecti-es
,.2 /ar+0are #*ecification
,." #oft0are #*ecification
,., #oft0are Descri*tions
. #$#T!% D!#IGN
.1 Desi'n O-er-ie0
.2 Conte&t Anal(sis Dia'ra)
." Data Flo0 Dia'ra)
., Arcitecture Desi'n 3.
#$#T!% T!#TING
3.1 Unit Testin'
3.2 Inte'ration Testin'
3." Acce*tance Testin'
1
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
2/68
4. #$#T!% I%P%!NTATION
5. CONCU#ION
6. FUTUR! !NC/ANC!%!NT#
17. BIBIOGRAP/$11. APP!NDIC!#
APP!NDI8 A9 #A%P! #CR!!N#
1 !NT"OD#CT!ON
11 About Fault Toleran$e%
DI#TRIBUT!D s(ste)s are co)*ose+ of *rocesses: locate+ on one or )ore sites tat
co))unicate 0it one anoter to offer ser-ices to u**er;la(er a**lications. A )aor
+ifficult( a s(ste) +esi'ner as to co*e 0it in tese s(ste)s lies in te ca*ture of
consistent 'lobal states fro) 0ic safe +ecisions can be ta. In contrast: te as(ncronous )o+el is
caracterie+ b( te absence of ti)e boun+s =tat is 0( tis )o+el is so)eti)es
calle+ te ti)e;free )o+el>. In tese s(ste)s: a s(ste) +esi'ner can onl( assu)e an
u**er boun+ on te nu)ber of *rocesses tat can cras =usuall( +enote+ as f> an+:
conse?uentl(: +esi'n *rotocols rel(in' on te assu)*tion tat at least =n f> *rocesses
are ali-e =n bein' te total nu)ber of *rocesses>. Te *rotocol as no )eans to .
2
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
3/68
#(ncronous s(ste)s are attracti-e because te( allo0 s(ste) +esi'ners to sol-e
)an( *roble)s. Te *rice tat as to be *ai+ is te a *riori
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
4/68
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
5/68
client #er-er Tecnolo'ies in Ka-a:=K2!!LK2%!LK2#!L!KB>:B M CJJ:
Oracle an+ o*eratin' s(ste) conce*ts 0it INU8.
Our ision
@Drea)in' a -ision is *ossible an+ realiin' it is our 'oal.
Our Mission
e a-e acie-e+ tis b( creatin' an+ *erfectin' *rocesses tat are in
*ar 0it te 'lobal stan+ar+s an+ 0e +eli-er i' ?ualit(: i' -alue ser-ices:
reliable an+ cost effecti-e IT *ro+ucts to clients aroun+ te 0orl+.
Clientele
Aray InfoTech
Inquirre consultancy (U.S.A)
K square consultancy pvt Ltd (U.S.A)
Opal solutions
Texla Solutions
!ertex "usiness #achines
$# InfoTech
E.isting S/stem9
Te s(ncronous +istribute+ co)*utin' )o+el *ro-i+es *rocesses 0it boun+s
on *rocessin' ti)e an+ )essa'e transfer +ela(. Tese boun+s: e&*licitl( . In contrast: te as(ncronous )o+el is
caracterie+ b( te absence of ti)e boun+s =tat is 0( tis )o+el is so)eti)es
calle+ te ti)e;free )o+el>. In tese s(ste)s: a s(ste) +esi'ner can onl( assu)e an
u**er boun+ on te nu)ber of *rocesses tat can cras =usuall( +enote+ as f> an+:
conse?uentl(: +esi'n *rotocols rel(in' on te assu)*tion tat at least =n f> *rocesses
are ali-e =n bein' te total nu)ber of *rocesses>. Te *rotocol as no )eans to .
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
6/68
Proposed S/stem%
Our *ro'ra))in' )o+el *ro-i+es te u**er;la(er a**lications 0it sufficient
*rocess state infor)ation =te sets> tat can be use+ in or+er to a+a*t to te a-ailable
s(ste) s(ncron( or o# =in ter)s of ti)el( an+ unti)el( cannels>: *ro-i+in' )ore
efficient solutions to fault tolerant *roble)s 0en *ossible.
I)*le)entin' our (bri+ *ro'ra))in' )o+el re?uires so)e basic facilities
suc as te *ro-ision an+ )onitorin' of o# co))unications 0it bot boun+e+ an+
unboun+e+ +eli-er( ti)es: an+ also a )ecanis) to a+a*t te s(ste) 0en ti)el(
cannels can no lon'er be 'uarantee+: +ue to failures. Our *ro'ra))in' )o+el buil+s
on facilities t(*icall( encountere+ in o# arcitectures: suc as O)e'a: o#;A:
uart: an+ Differentiate+ #er-ices. In *articular: 0e assu)e tat te un+erl(in'
s(ste) is ca*able of *ro-i+in' ti)el( co))unication cannels =ali. #i)ilarl(: 0e assu)e te e&istence of
best;effort cannels 0ere )essa'es are trans)itte+ 0itout 'uarantee+ boun+e+ ti)e
+ela(s. e call tese cannels unti)el(. o# )onitorin' an+ fail;a0areness a-e
been i)*le)ente+ b( te o# Pro-i+er =o#P>: failure an+ state +etectors
)ecanis)s: briefl( *resente+ belo0. It 0as a +esi'n +ecision to buil+ our )o+el on
to* of a o#;base+ s(ste). /o0e-er: 0e coul+ also a-e i)*le)ente+ our
*ro'ra))in' )o+el base+ on facilities encountere+ in e&istin' (bri+ arcitectures9
For instance: ti)el( cannels coul+ be i)*le)ente+ usin' RTD cannels b( settin'
te *robabilities P+ =+ea+line *robabilit(> an+ Pr =reliabilit( *robabilit(> close to one:
an+ unti)el( cannels coul+ be i)*le)ente+ 0it a basic cannel 0itout an(
'uarantees 16E. Te ti)in' failure +etection ser-ice of TCB ,E coul+ ten
co)*le)ent te re?uire+ functionalit(.
Modules%
I+entif( te status of No+e
%essa'e Trans)ission
Can'e status
U*+ate status
I+entif( te #tatus No+e9
In tis %o+ule 0e i+entif( te No+e is 0eater li-e or not. In tis *rocess 0e
easil( i+entif( te status of te no+e an+ also easil( i+entif( te *at failure.
%essa'e Trans)ission9
3
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
7/68
In te )o+ule 0e ust transfer te )essa'e to te +estination or inter)e+iate
no+es.
Te inter)e+iate no+e ust for0ar+s te )essa'e to +estination.
Te recei-er recei-es te )essa'e an+ sen+s te Ac.
0& 2A"D3A"E SPEC!F!CAT!ON
Pro$essor 9 An( Processor abo-e 77 %.
"am 9 125%b.
2ard Dis4 9 17 Gb.
Compa$t Dis4 9 37 %b.
!nput devi$e 9 #tan+ar+ e(boar+ an+ %ouse.
4
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
8/68
Output devi$e 9 GA an+ /i' Resolution %onitor.
05 SOFT3A"E SPEC!F!CAT!ON
Operating S/stem 9 in+o0s 2777 ser-er Fa)il(.
Te$,ni6ues 9 KD 1.
Data 'ases 9 %icrosoft #?l #er-er
Front End % Ka-a #0in'
Bac< !n+ 9 #?l #er-er
00 Soft7are Environment
8ava Te$,nolog/
Ka-a tecnolo'( is bot a *ro'ra))in' lan'ua'e an+ a *latfor).
T,e 8ava Programming *anguage
Te Ka-a *ro'ra))in' lan'ua'e is a i';le-el lan'ua'e tat can be
caracterie+ b( all of te follo0in' bu0or+s9
#i)*le
Arcitecture neutral
Obect oriente+
Portable
Distribute+
/i' *erfor)ance
Inter*rete+
%ultitrea+e+
Robust
D(na)ic
#ecure
it )ost *ro'ra))in' lan'ua'es: (ou eiter co)*ile or inter*ret a *ro'ra)
so tat (ou can run it on (our co)*uter. Te Ka-a *ro'ra))in' lan'ua'e is unusual
in tat a *ro'ra) is bot co)*ile+ an+ inter*rete+. it te co)*iler: first (ou
translate a *ro'ra) into an inter)e+iate lan'ua'e calle+ $ava yte codes te
*latfor);in+e*en+ent co+es inter*rete+ b( te inter*reter on te Ka-a *latfor). Te
inter*reter *arses an+ runs eac Ka-a b(te co+e instruction on te co)*uter.
5
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
9/68
Co)*ilation a**ens ust onceQ inter*retation occurs eac ti)e te *ro'ra) is
e&ecute+. Te follo0in' fi'ure illustrates o0 tis 0or. !-er( Ka-a inter*reter: 0eter itHs a +e-elo*)ent tool
or a eb bro0ser tat can run a**lets: is an i)*le)entation of te Ka-a %. Ka-ab(teco+es el* )a
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
10/68
Te Ka-a *latfor) as t0o co)*onents9
Te$ava !irtual #achine=Ka-a %>
Te$ava Application &ro'ra%%in' Interface=Ka-a API>
$ouH-e alrea+( been intro+uce+ to te Ka-a %. ItHs te base for te Ka-a
*latfor) an+ is *orte+ onto -arious ar+0are;base+ *latfor)s.
Te Ka-a API is a lar'e collection of rea+(;)a+e soft0are co)*onents tat
*ro-i+e )an( useful ca*abilities: suc as 'ra*ical user interface =GUI>
0i+'ets. Te Ka-a API is 'rou*e+ into libraries of relate+ classes an+
interfacesQ tese libraries are
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
11/68
An a**lication is a stan+alone *ro'ra) tat runs +irectl( on te Ka-a *latfor).
A s*ecial soc a++resses.
!nternationali9ation9 /el* for 0ritin' *ro'ra)s tat can be localie+
for users 0orl+0i+e. Pro'ra)s can auto)aticall( a+a*t to s*ecific
locales an+ be +is*la(e+ in te a**ro*riate lan'ua'e.
Se$urit/9 Bot lo0 le-el an+ i' le-el: inclu+in' electronic
si'natures: *ublic an+ *ri-ate
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
12/68
How Will Java Technology Change My Life?
e canHt *ro)ise (ou fa)e: fortune: or e-en a ob if (ou learn te Ka-a
*ro'ra))in' lan'ua'e. #till: it is li su''est tat a *ro'ra) 0ritten in te Ka-a
*ro'ra))in' lan'ua'e can be four ti)es s)aller tan te sa)e
*ro'ra) in CJJ.
3rite better $ode9 Te Ka-a *ro'ra))in' lan'ua'e encoura'es 'oo+
co+in' *ractices: an+ its 'arba'e collection el*s (ou a-oi+ )e)or(
lea
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
13/68
Avoid platform dependen$ies 7it, 1 is a stan+ar+ *ro'ra))in'
interface for a**lication +e-elo*ers an+ +atabase s(ste)s *ro-i+ers. Before ODBC
beca)e a de factostan+ar+ for in+o0s *ro'ra)s to interface 0it +atabase s(ste)s:
*ro'ra))ers a+ to use *ro*rietar( lan'ua'es for eac +atabase te( 0ante+ to
connect to. No0: ODBC as )a+e te coice of te +atabase s(ste) al)ost irrele-ant
fro) a co+in' *ers*ecti-e: 0ic is as it soul+ be. A**lication +e-elo*ers a-e
)uc )ore i)*ortant tin's to 0orr( about tan te s(nta& tat is nee+e+ to *ort teir
*ro'ra) fro) one +atabase to anoter 0en business nee+s su++enl( can'e.
Trou' te ODBC A+)inistrator in Control Panel: (ou can s*ecif( te
*articular +atabase tat is associate+ 0it a +ata source tat an ODBC a**lication
*ro'ra) is 0ritten to use. Tin< of an ODBC +ata source as a +oor 0it a na)e on it.
!ac +oor 0ill lea+ (ou to a *articular +atabase. For e&a)*le: te +ata source na)e+
#ales Fi'ures )i't be a # #er-er +atabase: 0ereas te Accounts Pa(able +ata
source coul+ refer to an Access +atabase. Te *(sical +atabase referre+ to b( a +ata
source can resi+e an(0ere on te AN.
Te ODBC s(ste) files are not installe+ on (our s(ste) b( in+o0s 6.
Rater: te( are installe+ 0en (ou setu* a se*arate +atabase a**lication: suc as
# #er-er Client or isual Basic ,.7. en te ODBC icon is installe+ in Control
Panel: it uses a file calle+ ODBCIN#T.D. It is also *ossible to a+)inister (our
ODBC +ata sources trou' a stan+;alone *ro'ra) calle+ ODBCAD%.!8!. Tere isa 13;bit an+ a "2;bit -ersion of tis *ro'ra): an+ eac )aintains a se*arate list of
1"
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
14/68
ODBC +ata sources.
Fro) a *ro'ra))in' *ers*ecti-e: te beaut( of ODBC is tat te a**lication
can be 0ritten to use te sa)e set of function calls to interface 0it an( +ata source:
re'ar+less of te +atabase -en+or. Te source co+e of te a**lication +oesnHt can'e
0eter it tal. Te loa+in' of te ODBC +ri-ers is trans*arent to
te ODBC a**lication *ro'ra). In a clientser-er en-iron)ent: te ODBC API e-en
an+les )an( of te net0or< issues for te a**lication *ro'ra))er.
Te a+-anta'es of tis sce)e are so nu)erous tat (ou are *robabl( tin
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
15/68
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
16/68
te connecti-it( )o+ule to an+le non;stan+ar+ functionalit( in a )anner tat is
suitable for its users.
". JD#C "$%t &e i"'le"ental on to' of co""on (ata&a%e
inte!face%
Te KDBC # API )ust @sit on to* of oter co))on # le-el APIs.
Tis 'oal allo0s KDBC to use e&istin' ODBC le-el +ri-ers b( te use of a
soft0are interface. Tis interface 0oul+ translate KDBC calls to ODBC an+
-ice -ersa.
). P!ovi(e a Java inte!face that i% con%i%tent with the !e%t of the
Java %y%te"
Because of Ka-aHs acce*tance in te user co))unit( tus far: te +esi'ners
feel tat te( soul+ not stra( fro) te current +esi'n of te core Ka-a s(ste).
*. +ee' it %i"'le
Tis 'oal *robabl( a**ears in all soft0are +esi'n 'oal listin's. KDBC is no
e&ce*tion. #un felt tat te +esi'n of KDBC soul+ be -er( si)*le: allo0in' for
onl( one )eto+ of co)*letin' a tas< *er )ecanis). Allo0in' +u*licate
functionalit( onl( ser-es to confuse te users of te API.
,. -%e %t!ong %tatic ty'ing whe!eve! 'o%%i&le
#tron' t(*in' allo0s for )ore error cec
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
17/68
Architecture-neutral
Object-oriented
Portable
Distributed
High-performance
Interpreted
multithreaded
Robust
Dynamic
Secure
Jaa is also unusual in that each Jaa program is both
compiled and interpreted! "ith a compile you translate a Jaa program
into an intermediate language called Jaa byte codes the platform-
independent code instruction is passed and run on the computer!
#ompilation happens just once$ interpretation occurs each time the
program is e%ecuted! &he figure illustrates ho' this 'or(s!
)o
u can thin( of Jaa byte codes as the machine code instructions for the
Jaa *irtual +achine ,Jaa *+! .ery Jaa interpreter/ 'hether it0s a
Jaa deelopment tool or a "eb bro'ser that can run Jaa applets/ is an
implementation of the Jaa *+! &he Jaa *+ can also be implemented in
hard'are!
Jaa byte codes help ma(e 1'rite once/ run any'here2 possible!
)ou can compile your Jaa program into byte codes on my platform that
8ava
Program
Compilers
!nterpreter
M/ Program
14
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
18/68
has a Jaa compiler! &he byte codes can then be run any implementation
of the Jaa *+! 3or e%ample/ the same Jaa program can run "indo's
4&/ Solaris/ and +acintosh!
Networking
TCP/IP stack
Te TCPIP stac< is sorter tan te O#I one9
TCP is a connection;oriente+ *rotocolQ UDP =User Data'ra) Protocol>
is a connectionless *rotocol.
!P datagram?s
Te IP la(er *ro-i+es a connectionless an+ unreliable +eli-er( s(ste). It
consi+ers eac +ata'ra) in+e*en+entl( of te oters. An( association bet0een
+ata'ra) )ust be su**lie+ b( te i'er la(ers. Te IP la(er su**lies a cec
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
19/68
UDP
UDP is also connectionless an+ unreliable. at it a++s to IP is a cec
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
20/68
Te "2 bit a++ress is usuall( 0ritten as , inte'ers se*arate+ b( +ots.
Port addresses
A ser-ice e&ists on a ost: an+ is i+entifie+ b( its *ort. Tis is a 13 bit
nu)ber. To sen+ a )essa'e to a ser-er: (ou sen+ it to te *ort for tat ser-ice
of te ost tat it is runnin' on. Tis is not location trans*arenc( Certain of
tese *orts are V0ell
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
21/68
a fle&ible +esi'n tat is eas( to e&ten+: an+ tar'ets bot ser-er;si+e an+ client;
si+e a**licationsQ
su**ort for )an( out*ut t(*es: inclu+in' #0in' co)*onents: i)a'e files
=inclu+in' PNG an+ KP!G>: an+ -ector 'ra*ics file for)ats =inclu+in' PDF:
!P# an+ #G>Q
KFreeCart is Vo*en sourceV or: )ore s*ecificall(: free soft0are. It is
+istribute+ un+er te ter)s of te GNU esser General Public icence
=GP>: 0ic *er)its use in *ro*rietar( a**lications.
1. Ma' 0i%$aliation%
Carts so0in' -alues tat relate to 'eo'ra*ical areas. #o)e e&a)*les inclu+e9 =a>
*o*ulation +ensit( in eac state of te Unite+ #tates: =b> inco)e *er ca*ita for eac
countr( in !uro*e: =c> life e&*ectanc( in eac countr( of te 0orl+. Te tas: a
ren+ere+: an+ inte'ratin' tis 0it te e&istin' 8$Plot class in KFreeCartQ
Testin': +ocu)entin': testin' so)e )ore: +ocu)entin' so)e )ore.
. Ti"e Se!ie% Cha!t Inte!activity
I)*le)ent a ne0 =to KFreeCart> feature for interacti-e ti)e series carts ;;; to
+is*la( a se*arate control tat so0s a s)all -ersion of A te ti)e series +ata: 0it
a sli+in' V-ie0V rectan'le tat allo0s (ou to select te subset of te ti)e series +ata to
+is*la( in te )ain cart.
2. Da%h&oa!(%
Tere is currentl( a lot of interest in +asboar+ +is*la(s. Create a fle&ible +asboar+
)ecanis) tat su**orts a subset of KFreeCart cart t(*es =+ials: *ies: ter)o)eters:
bars: an+ linesti)e series> tat can be +eli-ere+ easil( -ia bot Ka-a eb #tart an+ ana**let.
21
http://www.gnu.org/philosophy/free-sw.htmlhttp://www.gnu.org/licenses/lgpl.htmlhttp://www.gnu.org/philosophy/free-sw.htmlhttp://www.gnu.org/licenses/lgpl.html -
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
22/68
). P!o'e!ty 3(ito!%
Te *ro*ert( e+itor )ecanis) in KFreeCart onl( an+les a s)all subset of te
*ro*erties tat can be set for carts. !&ten+ =or rei)*le)ent> tis )ecanis) to
*ro-i+e 'reater en+;user control o-er te a**earance of te carts.
Data Flo7 Diagram
22
No+e Infor)ation
Cec< testatus ofNo+e
#en+er
i-e Uncertain Do0n
U*+ate#en+For0ar+
For0ar+Recei-e
Failure
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
23/68
fi' 9#tatus of te no+eFi' %essa'e Trans)ission
If +o0n uncertian
#ource
Cec< te#tatus
Return te #tatus
#elect teDestination no+e Acti-e
no+e
2"
#ource
#elect teDestination no+e
Cec< testatus of
+es
#en+ te )essa'e
Destination
#en+ te )s'
#tore in te)*
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
24/68
If i-e
Fi' Can'e te #tatus
#ource
Cec< te#tatus
U*+ate te #tatus
#elect teDestination no+e Acti-e
no+e
2,
#to*
#pdate
Find
Fin+ #tatus of no+e =>Recei-e ac< =>
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
25/68
Can'e
i-e =>Uncertain =>Do0n =>
Fin+ #tatus =>%essa'e Transfer = >Can'e =>U*+ate = >
Node
Recei-e %essa'e = >U*+ate Pac#en+ Ac< =>For0ar+ %essa'e = >
Message
2
Recei-e #tatus = >U*+ate Table = >For0ar+ #tatus = >
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
26/68
Fin+status ofno+e
#en+%essa'e
Can'estatus
U*+atestatus
23
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
27/68
Use case +ia'ra)
24
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
28/68
se6uen$e diagram
S+STEM DES!(N
No+e1 #tatus No+e2 No+e"
Cec< #ts
i-e )eans sen+te )s' i-e )eans
sen+ te )s'
#en+ Ac
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
29/68
@1 Design Overvie7
Desi'n in-ol-es i+entification of classes: teir relationsi*s as 0ell as teir collaboration. In obector(
:classes 0ere +i-i+e+ into !ntit( classes :interface classes an+ te control classes. Te Co)*uter Ai+e+
#oft0are !n'ineerin' tools tat are a-ailable co))erciall( +o not *ro-i+e an( assistance in tis transition.
!-en researc CA#! tools ta:ClassRes*onsibilit(Collaborator=CRC> an+ Obector(:use+ te ter) A'ents to re*resent
so)e of te ar+0are an+ soft0are s(ste)s .In Fusion )eto+: tere 0as no re?uire)ent *ase :0ere in a user
0ill su**l( te initial re?uire)ent +ocu)ent. An( soft0are *roect is 0or
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
30/68
!ntegration testing
Inte'ration tests are +esi'ne+ to test inte'rate+ soft0are co)*onents to +eter)ine if
te( actuall( run as one *ro'ra). Testin' is e-ent +ri-en an+ is )ore concerne+ 0it te
basic outco)e of screens or fiel+s. Inte'ration tests +e)onstrate tat altou' te co)*onents
0ere in+i-i+uall( satisfaction: as so0n b( successfull( unit testin': te co)bination of
co)*onents is correct an+ consistent. Inte'ration testin' is s*ecificall( ai)e+ at e&*osin'
te *roble)s tat arise fro) te co)bination of co)*onents.
Fun$tional test
Functional tests *ro-i+e a s(ste)atic +e)onstrations tat functions teste+ are
a-ailable as s*ecifie+ b( te business an+ tecnical re?uire)ents: s(ste) +ocu)entation : an+
user )anuals.
Functional testin' is centere+ on te follo0in' ite)s9
ali+ In*ut 9 i+entifie+ classes of -ali+ in*ut )ust be acce*te+.
In-ali+ In*ut 9 i+entifie+ classes of in-ali+ in*ut )ust be reecte+.
Functions 9 i+entifie+ functions )ust be e&ercise+.
Out*ut 9 i+entifie+ classes of a**lication out*uts )ust be e&ercise+.
#(ste)sProce+ures 9 interfacin' s(ste)s or *roce+ures )ust be in-o
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
31/68
'la$4 'o. Testing
Blac< Bo& Testin' is testin' te soft0are 0itout an(
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
32/68
User Acce*tance Testin' is a critical *ase of an( *roect an+ re?uires si'nificant
*artici*ation b( te en+ user. It also ensures tat te s(ste) )eets te functional
re?uire)ents.
Test "esults%
All te test cases )entione+ abo-e *asse+ successfull(. No +efects encountere+.
B !MP*EMENTAT!ON
I)*le)entation is te sta'e of te *roect 0en te teoretical +esi'n is turne+
out into a 0or
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
33/68
Te *ro'ra))in' )o+el is 'i-en b( tree sets =*rocesses *ercei-e eac oterHs states
b( accessin' te contents of teir local nonintersectin' setsuncertain: li-e: an+
+o0n> an+ te rules R7;R3 tat re'ulate )o+ifications on te sets. %oreo-er: 0e
so0e+ o0 tose rules an+ te sets can be i)*le)ente+ in real s(ste)s.
To illustrate te a+a*ti-e ness of our )o+el: 0e +e-elo*e+ a consensus al'orit) tat
)a
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
34/68
http://www.jfree.org/
http://www.networkcomputing.com/
Sample S$reen%
#creen 19
",
http://www.jfree.org/http://www.networkcomputing.com/http://www.jfree.org/http://www.networkcomputing.com/ -
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
35/68
"
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
36/68
"3
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
37/68
"4
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
38/68
Sample Code%
FaultClient1
i)*ort a-a.a0t.Q
i)*ort a-a.a0t.e-ent.Q
i)*ort a-a&.s0in'.Q
i)*ort a-a&.s0in'.e-ent.Q
i)*ort a-a.net.Q
i)*ort a-a.util.Q
i)*ort a-a.io.Q
i)*ort a-a.s?l.Q
i)*ort a-a.a0t.Tool
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
39/68
#u))ar( +escri*tion for FaultClient1
*ublic class FaultClient e&ten+s KFra)e i)*le)ents Ite)istener
[
ariables +eclaration
*ri-ate KTabbe+Pane Tabbe+Pane1Q
*ri-ate KPanel contentPaneQ
;;;;;
*ri-ate KTe&tFiel+ Te&tFiel+1Q
*ri-ate Kist ist1Q
*ri-ate K#crollPane #crollPane2Q
*ri-ate KTe&tArea Te&tArea2Q
*ri-ate K#crollPane #crollPane"Q
*ri-ate KPanel Panel1Q
;;;;;
*ri-ate KTe&tArea Te&tArea1Q
*ri-ate K#crollPane #crollPane1Q
*ri-ate KPanel Panel2Q*ri-ate KRa+ioButton Ra+ioButton1Q
*ri-ate KRa+ioButton Ra+ioButton2Q
*ri-ate KRa+ioButton Ra+ioButton"Q
*ri-ate KTe&tFiel+ Te&tFiel+2Q
*ri-ate KButton Button1Q
*ri-ate KButton Button2Q
*ri-ate KButton Button"Q*ri-ate ButtonGrou* btnGrou*1Q
*ri-ate Kabel abel1Q
*ri-ate Kabel abel2Q
*ri-ate Kabel abel"Q
*ri-ate Kabel abel,Q
*ri-ate Kabel abelQ
*ri-ate Kabel abel3Q
*ri-ate Kabel abel4Q
"6
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
40/68
ToolQ
#tate)ent st1Q
;;;;;
!n+ of -ariables +eclaration
*ublic FaultClient=>
[
su*er=>Q
initialieCo)*onent=>Q
TODO9 A++ an( constructor co+e after initialieCo)*onent call
tis.setisible=true>Q
if=Ra+ioButton1.is#electe+= > >
[
#trin' sr1 \ =Ra+ioButton1.'etTe&t=>>Q
#(ste).out.*rintln=VTe #electe+ button isVJsr1 >Q
u*+ateDb=sr1>Q
]
lo'in=>Q
,7
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
41/68
recie-e%essa'e=>Q
tr(
[
ss \ ne0 #er-er#oc
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
42/68
Connection
con1\Dri-er%ana'er.'etConnection=V+bc9o+bc9faultV:VsaV:VV>Q
#tate)ent
st1\con1.create#tate)ent=>Q
#trin' a**\V#!!CT FRO% userlistVQ
Result#et rs\st1.e&ecuteuer(=a**>Q
InetA++ress inet\InetA++ress.'etocal/ost=>Q
#trin' sna)e\inet.'et/ostNa)e=>Qf.toU**erCase=>Q
0ile=rs.ne&t=>>
[
if=rs.'et#trin'=1>.e?uals=sna)e>>
[
KO*tionPane.so0%essa'eDialo'=Fault1.tis:V Alrea+( #ource is runnin' ... V:
VInfor)ation 9 Clic< O< Button To
!&it...V:KO*tionPane.INFOR%ATION%!##AG!>Q
Trea+.slee*=1777>Q
#(ste).e&it=7>Q
]]
#trin' ?uer( \ Vinsert into userlist -alues=WVJsna)eJVW:Wli-eW>VQ
st1.e&ecuteU*+ate=?uer(>Q
]catc =!&ce*tion eee>
[
#(ste).out.*rintln=eee>Q
]
]
,2
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
43/68
/ere te ti)er tas< function
class Re)in+Tas< e&ten+s Ti)erTas
[
0ile =true>
[
sss\trueQ
0ile =sss>
[
if =nu)arnin'Bee*s 7>
[
lon' ti)e \ #(ste).currentTi)e%illis=>Q
if =ti)e ; sce+ule+!&ecutionTi)e=> >
[
returnQ
] If itWs not too late: bee*.
toolQ
#(ste).out.*rintln=VU*+atin' te source DetailsVJnu) arnin' Bee*s>Q
useru*+ate=>Q
recie-e%essa'e=>Q
nu)arnin'Bee*s;;Q ]
else
[
toolQ
#(ste).out.*rintln=VTi)eWs u*V>Q
sss\falseQ
nu)arnin'Bee*s \ 2Q
useru*+ate=>Q
,"
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
44/68
recie-e%essa'e=>Q
breaQ Not necessar( because 0e call #(ste).e&it
#(ste).e&it=7>Q #to*s te AT trea+ =an+ e-er(tin' else>
]
] if close+
] run=> close+
]
]
*ublic -oi+ useru*+ate=>
[
ector ft\ne0 ector=>Q
tr(
[#(ste).out.*rintln=V Insi+e te user u*+ate .....V>Q
Connection con1\nullQ
Class.forNa)e=Vsun.+bc.o+bc.K+bcO+bcDri-erV>Q
con1\Dri-er%ana'er.'etConnection=V+bc9o+bc9faultV:VsaV:VV>Q
#tate)ent st1\con1.create#tate)ent=>Q
#trin' cou\V#!!CT count=> FRO% userlistVQ
Result#et rs\st1.e&ecuteuer(=cou>Qint count\7Q
0ile=rs.ne&t=>>
[
count\rs.'etInt=1>Q
]
#(ste).out.*rintln=VLnLnLn count 9 VJcount>Q
#trin' a**\V#!!CT FRO% userlistVQ
rs\st1.e&ecuteuer(=a**>Q
,,
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
45/68
0ile=rs.ne&t=>>
[
#(ste).out.*rintln=V Insi+e te TAB!.....V>Q
#trin' na)e\rs.'et#trin'=1>Q
ft.a++=na)e>Q
#(ste).out.*rintln=ft>Q
]
Trea+.slee*=17777>Q
]
catc =!&ce*tion eee>
[#(ste).out.*rintln=V Coul+ not 'et Te table -alues....VJeee>Q
]
ist1.setistData=ft>Q
]
*ri-ate -oi+ initialieCo)*onent=>
[f+\ne0 FileDialo'=tis:V #elect te FileV:FileDialo'.OAD>Q
f+.setFile=V.t&tV>Q
Tabbe+Pane1 \ ne0 KTabbe+Pane=>Q
contentPane \ =KPanel>tis.'etContentPane=>Q
;;;;;
Te&tFiel+1 \ ne0 KTe&tFiel+=>Q
ist1 \ ne0 Kist=>Q
#crollPane2 \ ne0 K#crollPane=>Q
,
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
46/68
Te&tArea2 \ ne0 KTe&tArea=>Q
#crollPane" \ ne0 K#crollPane=>Q
Panel1 \ ne0 KPanel=>Q
;;;;;
Te&tArea1 \ ne0 KTe&tArea=>Q
#crollPane1 \ ne0 K#crollPane=>Q
Ra+ioButton1 \ ne0 KRa+ioButton=>Q
Ra+ioButton2 \ ne0 KRa+ioButton=>Q
Ra+ioButton" \ ne0 KRa+ioButton=>Q
Te&tFiel+2 \ ne0 KTe&tFiel+=>Q
Button1 \ ne0 KButton=>Q
Button2 \ ne0 KButton=>Q
Button" \ ne0 KButton=>Q
btnGrou*1 \ ne0 ButtonGrou*=>Q
abel1 \ ne0 Kabel=>Q
abel2 \ ne0 Kabel=>Q
abel" \ ne0 Kabel=>Q
abel, \ ne0 Kabel=>Q
abel \ ne0 Kabel=>Qabel3 \ ne0 Kabel=>Q
abel4 \ ne0 Kabel=ne0 I)a'eIcon=VOCGRR.*'V>>Q
Panel2 \ ne0 KPanel=>Q
setDefaultCloseO*eration=!8ITONCO#!>Q
;;;;; Tabbe+Pane1
Tabbe+Pane1.a++Tab=V #en+ V: Panel1>QTabbe+Pane1.a++Tab=V Recie-e V: Panel2>Q
Tabbe+Pane1.a++Can'eistener=ne0 Can'eistener=> [
*ublic -oi+ stateCan'e+=Can'e!-ent e>
[
Tabbe+Pane1stateCan'e+=e>Q
]
]>Q
,3
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
47/68
contentPane
contentPane.seta(out=null>Q
a++Co)*onent=content Pane Tabbe+Pane1:
1"::,5:,7>Q1"::,5:"61Q
Te&tFiel+1
abel1.setTe&t=V#electe+ Destination9V>Q
abel2.setTe&t=V!nter te Te&t9V>Q
abel".setTe&t=V=or>V>Q
abel,.setTe&t=V#electe+ File9V>Q
abel.setTe&t=VDestinationsV>Q
abel3.setTe&t=V#tatus9V>Q
Te&tFiel+1.setTe&t=VV>Q
Te&tFiel+1.a++Actionistener=ne0 Actionistener=> [*ublic -oi+ actionPerfor)e+=Action!-ent e>
[
Te&tFiel+1actionPerfor)e+=e>Q
]
]>Q
ist1
ist1.a++ist#electionistener=ne0 ist#electionistener=> [
*ublic -oi+ -alueCan'e+=ist#election!-ent e>
[
ist1-alueCan'e+=e>Q
]
,4
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
48/68
]>Q
#crollPane2
#crollPane2.setie0*ortie0=ist1>Q
Te&tArea2
Te&tArea2.setTe&t=VV>Q
#crollPane"
#crollPane".setie0*ortie0=Te&tArea2>Q
Ra+ioButton1.setTe&t=V i-eV>Q
Ra+ioButton1.set#electe+=true>Q
Ra+ioButton1.a++Ite)istener=ne0 Ite)istener=> [
*ublic -oi+ ite)#tateCan'e+=Ite)!-ent e>
[Ra+ioButton1ite)#tateCan'e+=e>Q
]
]>Q
Ra+ioButton2
Ra+ioButton2.setTe&t=V UncertainV>Q
Ra+ioButton2.a++Ite)istener=ne0 Ite)istener=> [
*ublic -oi+ ite)#tateCan'e+=Ite)!-ent e>
[
Ra+ioButton2ite)#tateCan'e+=e>Q
]
,5
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
49/68
]>Q
Ra+ioButton"
Ra+ioButton".setTe&t=V Do0nV>Q
Ra+ioButton".a++Ite)istener=ne0 Ite)istener=> [
*ublic -oi+ ite)#tateCan'e+=Ite)!-ent e>
[
tr(
[
Ra+ioButton"ite)#tateCan'e+=e>Q
#oc
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
50/68
]
]>Q
Te&tFiel+2
Te&tFiel+2.a++Actionistener=ne0 Actionistener=> [
*ublic -oi+ actionPerfor)e+=Action!-ent e>
[
Te&tFiel+2actionPerfor)e+=e>Q
]
]>Q
Button1
Button1.setTe&t=V Bro0seV>Q
Button1.a++Actionistener=ne0 Actionistener=> [*ublic -oi+ actionPerfor)e+=Action!-ent e>
[
f+.setisible=true>Q
#trin' filena)e \ f+.'etDirector(=>Jf+.'etFile=>Q
if=filena)e.e?uals=VnullnullnullV>>
[
Te&tFiel+2.setTe&t=VV>Q]
else if=filena)e.e?uals=VnullnullV>>
[
Te&tFiel+2.setTe&t=VV>Q
]
else if=filena)e.e?uals=VnullV>>
[
Te&tFiel+2.setTe&t=VV>Q
7
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
51/68
]
else
[
Te&tFiel+2.setTe&t=filena)e>Q
]
#(ste).out.*rintln=V file 9 VJfilena)e>Q
]
]>Q
Button2
Button2.setTe&t=V #en+V>Q
Button2.a++Actionistener=ne0 Actionistener=> [
*ublic -oi+ actionPerfor)e+=Action!-ent e>
[
tr(
[
Class.forNa)e=Vsun.+bc.o+bc.K+bcO+bcDri-erV>Q
Connection
con1\Dri-er%ana'er.'etConnection=V+bc9o+bc9faultV:VsaV:VV>Q
st1\con1.create#tate)ent=>Q
InetA++ress inet\InetA++ress.'etocal/ost=>Q
ost\inet.'et/ostNa)e=>Q
#trin' a**\V#!!CT state FRO% userlist0ere userna)e liQ
0ile=rs.ne&t=>>
[
user#tatus \ rs.'et#trin'=1>Q
]
user#tatus\user#tatus.tri)=>Q
1
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
52/68
#(ste).out.*rintln=V;;;;^ #(ste)
#tatus 9VJa**>Q
#(ste).out.*rintln=V;;;;^ #(ste)
#tatus 9VJuser#tatus>Q
]
catc =!&ce*tion e&ce*>
[
#(ste).out.*rintln=e&ce*>Q
]
Button2actionPerfor)e+=e>Q
int u(\Te&tFiel+2.'etTe&t=>.len't=>Q
#trin' cc+ \ VDestination is Do0n state.Please tr( after
so)e ti)eVQ
if=u(\\7>
[
if=user#tatus.e?uals=Vi-eV>>
[
sen+%essa'e=>Q
]
else if=user#tatus.e?uals=VUncertainV>>
[#trin' +est \ Te&tFiel+1.'etTe&t=>.tri)=>Q
#(ste).out.*rintln=VTe +estination isV J +est>Q
#trin' s12 \ Te&tArea2.'etTe&t=>Q
#(ste).out.*rintln=VTe Te&t %essa'e isV J s12>Q
InetA++ress inet\InetA++ress.'etocal/ost=>Q
#trin' ost\inet.'et/ostNa)e=>Q
#trin' )essa'e \ ostJV`VJ+estJV`VJs12Q
uncertain.a++=)essa'e>Q
2
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
53/68
]
else if =user#tatus.e?uals=VDo0nV>>
[
KO*tionPane.so0%essa'eDialo'=FaultClient.tis:cc+:
V%essa'e ...V:KO*tionPane.INFOR%ATION%!##AG!>Q
]
#(ste).out.*rintln=V Uncertain ector
alues 9 VJuncertain>Q
#(ste).out.*rintln=VInsi+e Te Directl(
%s' #en+..Not Bro0se #election..V>Q
]
else
[
Te&tArea2.setTe&t=VV>Q
#trin' filen\Te&tFiel+2.'etTe&t=>Q
tr(
[
Buffere+Rea+er in\ne0 Buffere+Rea+er=ne0 FileRea+er=filen>>Q
#trin' s:s1\ne0 #trin'=>Q
if=Te&tArea2.'etTe&t=>.len't=>\\7>
[
e)*\1Q
]
0ile==s\in.rea+ine=>>\null>[
if=e)*\\7>
[
Te&tArea2.setTe&t=Te&tArea2.'etTe&t=>JVLnVJs>Q
e)*\1Q
]
else
"
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
54/68
[
Te&tArea2.setTe&t=s>Q
e)*\7Q
]
]
if=user#tatus.e?uals=Vi-eV>>
[
sen+%essa'e=>Q
]
else if=user#tatus.e?uals=VUncertainV>>
[
#trin' +est \ Te&tFiel+1.'etTe&t=>.tri)=>Q
#(ste).out.*rintln=VTe +estination isV J +est>Q
#trin' s12 \ Te&tArea2.'etTe&t=>Q
#(ste).out.*rintln=VTe Te&t %essa'e isV J s12>Q
InetA++ressinet\InetA++ress.'etocal/ost=>Q
#trin'
ost\inet.'et/ostNa)e=>Q
#trin' )essa'e \ ostJV`VJ+estJV`VJs12Q
uncertain.a++=)essa'e>Q
]
else if=user#tatus.e?uals=VDo0nV>>
KO*tionPane.so0%essa'eDialo'=FaultClient.tis:cc+:
V%essa'e ...V:KO*tionPane.INFOR%ATION%!##AG!>Q
]
Te&tFiel+1.setTe&t=VV>Q
]
,
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
55/68
catc =!&ce*tion er>
[
#(ste).out.*rintln=er>Q
]
#(ste).out.*rintln=VNoooooooooooooooooooo
ooo..V>Q
]
]
]>Q
Button"
Button".setTe&t=V o'outV>QButton".a++Actionistener=ne0 Actionistener=> [
*ublic -oi+ actionPerfor)e+=Action!-ent e>
[
Button"actionPerfor)e+=e>Q
]
]>Q
Panel1
Panel1
Panel1.seta(out=null>Q
Panel1.setBor+er=Bor+erFactor(.create!tce+Bor+er=>>Q
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
56/68
a++Co)*onent=contentPane: Te&tFiel+1: 14":1"7:1"2:25>Q
a++Co)*onent=contentPane: #crollPane2: "37:1,7:177:123>Q
a++Co)*onent=contentPane: #crollPane": 1:167:142:34>Q
a++Co)*onent=contentPane: Ra+ioButton1: 15:"7:3:2,>Q
a++Co)*onent=contentPane: Ra+ioButton2: 217:"7:5,:2,>Q
a++Co)*onent=contentPane: Ra+ioButton": 265:"7:3:2,>Q
a++Co)*onent=contentPane: Te&tFiel+2: 1,:"77:142:2>Q
a++Co)*onent=contentPane: Button1: "":"77:5":25>Q
a++Co)*onent=contentPane: Button2: 15:"6:5":25>Q
a++Co)*onent=contentPane: Button": 2,:"6:5":25>Q
a++Co)*onent=contentPane: abel1: 2:1"7:122:25>Q
a++Co)*onent=contentPane: abel2: 31:276:5,:"2>Q
a++Co)*onent=contentPane: abel": 21:235:42:27>Q
a++Co)*onent=contentPane: abel,: 34:"77:5,:27>Q
a++Co)*onent=contentPane: abel: "36:117:5,:27>Q
a++Co)*onent=contentPane: abel3: 54:"7:5,:27>Q
a++Co)*onent=contentPane: abel4: 7:7:,67:177>Q
Panel2
Panel2.seta(out=null>Q
Panel2.setBor+er=Bor+erFactor(.create!tce+Bor+er=>>Q
btnGrou*1
btnGrou*1.a++=Ra+ioButton1>QbtnGrou*1.a++=Ra+ioButton2>Q
btnGrou*1.a++=Ra+ioButton">Q
Te&tArea1
Te&tArea1.setTe&t=VLnV>Q
3
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
57/68
#crollPane1
#crollPane1.setie0*ortie0=Te&tArea1>Q
Panel2
Panel2.seta(out=null>Q
Panel2.setBor+er=Bor+erFactor(.create!tce+Bor+er=>>Q
a++Co)*onent=Panel2: #crollPane1: ;1:7:,5:"3">Q
%ouseistener )ouseistener \ ne0 %ouseA+a*ter=>
[
*ublic -oi+ )ouseClic
[
Kist ist1 \ =Kist> )ouse!-ent.'et#ource=>Q
if =)ouse!-ent.'etClic \\ 2>
[
int in+e& \ ist1.locationToIn+e&=)ouse!-ent.'etPoint=>>Q
if =in+e& ^\ 7>
[Obect o \ ist1.'et%o+el=>.'et!le)entAt=in+e&>Q
#(ste).out.*rintl
n=V^^V J ==o\\null> VnullV 9 o.to#trin'=>> J V is selecte+.V>Q
#trin' tate&t\Te&tArea1.'etTe&t=>Q
Te&tFiel+1.setTe&t=o.to#trin'=>>Q
-ie0 -1\ne0 -ie0=o.to#trin'=>>Q
#(ste).out.*rintln=VDouble;clic
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
58/68
tis.setTitle=VFaultClient1 ; e&ten+s KFra)eV>Q
tis.setocation=ne0 Point=7: 7>>Q
tis.set#ie=ne0 Di)ension=,5: ,5>>Q 57:73
]
*ri-ate -oi+ Ra+ioButton1ite)#tateCan'e+=Ite)!-ent e>
[
if=Ra+ioButton1.is#electe+=>>
[
#trin' sr1 \ =Ra+ioButton1.'etTe&t=>>Q
#(ste).out.*rintln=VTe #electe+ button isVJsr1 >Q
u*+ateDb=sr1>Q
]
]
*ri-ate -oi+ Ra+ioButton2ite)#tateCan'e+=Ite)!-ent e>
[
if=Ra+ioButton2.is#electe+=>>
[
#trin' sr1 \ =Ra+ioButton2.'etTe&t=>>Q
#(ste).out.*rintln=VTe #electe+ button isVJsr1 >Q
u*+ateDb=sr1>Q]
]
*ri-ate -oi+ Ra+ioButton"ite)#tateCan'e+=Ite)!-ent e>
[
if=Ra+ioButton".is#electe+=>>
[
5
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
59/68
#trin' sr1 \ =Ra+ioButton".'etTe&t=>>Q
#(ste).out.*rintln=VTe #electe+ button isVJsr1 >Q
u*+ateDb=sr1>Q
]
]
*ublic -oi+ ite)#tateCan'e+=Ite)!-ent ie>
[
if=r2.is#electe+= > >
[
#(ste).out.*rintln=VUncertainV>Q
#trin' sr1 \ =r2.'etTe&t=>>Q
u*+ateDb=sr1>Q
]
else if=r".is#electe+= >>
[#(ste).out.*rintln=VDo0nV>Q
#trin' sr1 \ =r".'etTe&t=>>Q
u*+ateDb=sr1>Q
]
else if= r1.is#electe+= > >
[#(ste).out.*rintln=Vi-eV >Q
#trin' sr1 \ =r1.'etTe&t=>>Q
u*+ateDb=sr1>Q
]
6
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
60/68
]
A++ Co)*onent itout a a(out %ana'er =Absolute Positionin'>
*ri-ate -oi+ a++Co)*onent=Container container:Co)*onent c:int &:int (:int
0i+t:int ei't>
[
c.setBoun+s=&:(:0i+t:ei't>Q
container.a++=c>Q
]
TODO9 A++ an( a**ro*riate co+e in te follo0in' !-ent /an+lin' %eto+s
*ri-ate -oi+ Tabbe+Pane1stateCan'e+=Can'e!-ent e>
[
#(ste).out.*rintln=VLnTabbe+Pane1stateCan'e+=Can'e!-ent e>
calle+.V>Q
TODO9 A++ an( an+lin' co+e ere
]
*ri-ate -oi+ Te&tFiel+1actionPerfor)e+=Action!-ent e>
[
#(ste).out.*rintln=VLnTe&tFiel+1actionPerfor)e+=Action!-ent e>
calle+.V>Q TODO9 A++ an( an+lin' co+e ere
]
*ri-ate -oi+ ist1-alueCan'e+=ist#election!-ent e>
[
#(ste).out.*rintln=VLnist1-alueCan'e+=ist#election!-ent e>
calle+.V>Q
37
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
61/68
if=e.'etalueIsA+ustin'=>>
[
Obect o \ ist1.'et#electe+alue=>Q
#(ste).out.*rintln=V^^V J ==o\\null> VnullV 9 o.to#trin'=>> J V
is selecte+.V>Q
Te&tFiel+1.setTe&t=o.to#trin'=>>Q
TODO9 A++ an( an+lin' co+e ere for te *articular obect
bein' selecte+
]
]
TODO9 A++ an( )eto+ co+e to )eet (our nee+s in te follo0in' area
*ublic -oi+ u*+ateDb=#trin' sr1>
[#trin' sr \ sr1Q
#(ste).out.*rintln=VTe #electe+ Ra+io button isVJsr>Q
tr(
[
InetA++ress inet\InetA++ress.'etocal/ost=>Q
#trin' sna)e\inet.'et/ostNa)e=>Q#(ste).out.*rintln=V Insi+e te user u*+ate .....V>Q
Connection con1\nullQ
Class.forNa)e=Vsun.+bc.o+bc.K+bcO+bcDri-erV>Q
con1\Dri-er%ana'er.'etConnection=V+bc9o+bc9faultV:VsaV:VV>Q
#tate)ent st1\con1.create#tate)ent=>Q
#trin' ?uer( \ Vu*+ate userlist set state \ WVJsrJVW 0ere
userna)e li
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
62/68
st1.e&ecuteU*+ate=?uer(>Q
]
catc=!&ce*tion e>
[
e.*rint#tacQ
]
]
*ri-ate -oi+ Button2actionPerfor)e+=Action!-ent e>
[
sen+%essa'e=>Q
]
*ublic -oi+ sen+%essa'e=>
[
#oc
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
63/68
#(ste).out.*rintln=V;;^ Unceratin sie 9 VJuncertain.sie=>>Q
if=uncertain.sie=>^7>
[
for=int count\7Qcount_uncertain.sie=>QcountJJ>
[
#trin' -al1\=#trin'>uncertain.ele)entAt=count>Q
#(ste).out.*rintln=V -alue VJcount JV 9 VJ-al1>Q
tr(
[
soc< \ne0 #oc
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
64/68
uncertain.re)o-eAll!le)ents=>Q
]
]
catc =!&ce*tion e&c>
[
]
else
[
#trin' +est \ Te&tFiel+1.'etTe&t=>.tri)=>Q
#(ste).out.*rintln=VTe +estination isV J +est>Q
#trin' s \ Te&tArea2.'etTe&t=>Q
#(ste).out.*rintln=VTe Te&t %essa'e isV J s>Q
tr(
[
InetA++ress
inet\InetA++ress.'etocal/ost=>Q
#trin' ost\inet.'et/ostNa)e=>Q
#trin' )essa'e \ ostJV`VJ+estJV`VJsQsoc< \ne0
#oc
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
65/68
KO*tionPane.so0%essa'eDialo'=FaultClient.tis:cc+:
V%essa'e ...V:KO*tionPane.INFOR%ATION%!##AG!>Q
]
]
catc =!&ce*tion e>
[
e.*rint#tacQ
]
]
]
*ublic -oi+ recie-e%essa'e=>[
tr(
[ss \ ne0 #er-er#oc
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
66/68
]
catc =!&ce*tion e>
[
e.*rint#tacQ
]
]
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Testin'
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ \
33
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
67/68
\ Te follo0in' )ain )eto+ is ust for testin' tis class (ou built.\
\ After testin':(ou )a( si)*l( +elete it. \
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\
*ublic static -oi+ )ain=#trin'E ar's>
[
KFra)e.setDefaultooQ
KDialo'.setDefaultooQ
tr(
[
UI%ana'er.setooQ
#(ste).out.*rintln=e&>Q
]
ne0 FaultClient=>Q
]
\ !n+ of Testin' \
]
34
-
8/13/2019 An Adaptive Programming Model for Fault-Tolerant Distributed Computing_datamining
68/68