Vous êtes sur la page 1sur 17

2002 IBM Corporation Confidential | Date | Other Information, if necessary

2009 by Marks !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
Best Practices for Distributed OSGi
Services
Markus Alexander Kuppe
Scott Lewis
http!!www"eclipse"or#!ecf
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
$Isn't D-OSGi... just repeating the
mistake of every other RPC-
base system in the !ast "#
years$ Dis%uss...%
http!!twitter"co&!n'bartlett
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
$Isn't D-OSGi... just repeating the
mistake of every other RPC-
base system in the !ast "#
years$
(O)*
*+t,s our 'ob to &ake sure of this"""and the 'ob,s not finished
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
D-OSGi re.uire&ents / assu&ptions
.
Keep the current 0OSGi1 pro#ra&&in# &odel where possible
. Abstraction fro& protocol2 co&&unication2 data i&ple&entation
.
Allow interop with non-OSGi s3ste&s in hetero#eneous
environ&ents
. Allow clients runnin# outside of OSGi to discover services
/ But use of or#"os#i"service"discover3"Discover3 is optional
.
Brin# service oriented pro#ra&&in# &odel to distributed
co&putin#
.
Much of the proble&s of distributed s3ste&s are alread3 covered
b3 the d3na&ic nature of OSGi services
/ Service4xception has new t3pe $54MO64%
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
(etwork 6ransparenc3

Do 3ou hide the network,s aspects fro& the pro#ra&&er7

Perfor&ance!6i&in#

5eliabilit3!Partial 8ailure

Not a #ood idea


/
A (ote on Distributed 9o&putin#
/ Lots of failed atte&pts at doin# so - See (eil,s tweet
One conclusion 4ventuall3"""pro#ra&&ers of distributed service clients
want to know and react to what,s happenin#
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
4nter OSGi Services
(ow have OSGi Service 5e#istr3!Service5eference!Service5e#istration
/
6he fra&ework &ana#es service re#istration!lookup!and cleanup
.
bundle9ontext"re#isterService0"""1
.
bundle9ontext"#etService5eferences0"""1
. bundle9ontext"stop01
Makes 5e#istration2 Lookup2 9lean-up work
589 ::; provide transparent re&ote service re#istration2 lookup2 and
clean-up
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
6his is GOOD 6ransparenc3

Makes it ver3 eas3 for pro#ra&&ers to use - GOOD

Providers 0i&ple&entations1 take care of the hard stuff 0distribution2


seriali<ation2 etc1

8ra&ework handles d3na&ic services already so network services are


acco&odated alread3
/ 9aveat 4&ptor Service pro#ra&&ers must &ake their
bundles!services d3na&ic-aware
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
But there is also Usage 6ransparenc3

Public M35esult foo0M3Para&eter1=

9lients will expect it to work when the3 call it

+t,s #oin# to fail with 5unti&e4xception"""or worse2 block

6his will be &uch &ore fre.uent than local services

>hat are clients to do7


Usage 6ransparenc3"""Still a problem for those that design service
interface
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
6ransparent Usage 0cont1
'C0

4xposes +5e&oteService via service propert3 os#i"re&ote

Gives prox3 A(D additional callin# patterns to service consu&er

As3nc4xec2 8uture2 One->a3


.
1emote"er&ice2racker

Sa&e 8unctionalit3 as Service6racker

+5e&oteService rather than Ob'ect


2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
So >hat are >e Sa3in#7
Separate (at bundle level) interface and implementation
Define your service interface 'carefully'
/
9an 3our clients depend upon 3our contract7
/
9o&plex ob'ects"""seriali<ed7 Pass B3 5eference7
Same local/remote service interface
!hink about clients (at runtime)
?ow can!will the3 respond to failure2 blockin#2 etc
"onsider #eing $ore %synchronous
498 +5e&oteService """or write 3our own
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
Discover3 best practice 0b"p"1
Subnet
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
Discover3 best practice for
service consu&ers
(O(4)*
*+t,s our 'ob to &ake sure of this"""and it,s done -1
9annot run discover3 s3nchronousl3 upon
getServi%eReferen%es01 as it violates the
non-blockin# nature of OSGi
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
Discover3 best practice for
service providers
(O(4)*
*+t,s our 'ob to &ake sure of this"""and it,s nearl3 done -1
?owever2 what,s with non ::; relevant
service props7
"""securit32 &arshallin#
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
8or service providers or consu&er in
non-OSGi based s3ste&s and deplo3ers
.
@ou i#nore discover3 entirel3 0'ust static confi#uration1 -1
.
8ind a wa3 to +nte#rate with existin# solutions
/ SLP2 &D(S2 D(S-SD2 ADD+2 B+(+2 C proprietar3
.
9hose a protocol that best fits 3our re.uire&ents
.
Deal with all the protocol2 network""" details
/ ?ave network specialist!ad&inistrators on the tea&
.
Do not trust service discover3 events 0unless 3ou secured it1
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
589 ::;vD outlook
.
Different DS> in one runti&e all handle a service re#istered
event7
/ >hat is the discover3 provider supposed to do7 Onl3 handle
service publication for its &atchin# DS>7 8or all7
.
?ow to do authentication7
/ Make services available that won,t be consu&able because of
access restrictions
.
Bein# &ore as3nchronous in distributed OSGi as well as the
fra&ework itself7
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
'clipse 'C0 (ro3ect
Thanks spec writers
Thanks Scott Rosenbaum for making this talk happen
Questions?
http455$$$*eclipse*or65ecf
http455$iki*eclipse*or65'C0
2009 by Marks ,le-ander !ppe, "cott #e$is% made a&ailable nder the '(# &)*0 | March 2+, 2009
Le#al (otices

4clipseSource lo#o and trade&arks are re#istered

+BM and the +BM lo#o are trade&arks or re#istered trade&arks of +BM
9orporation2 in the Anited States2 other countries or both"

Bava and all Bava-based &arks2 a&on# others2 are trade&arks or re#istered
trade&arks of Sun Micros3ste&s in the Anited States2 other countries or both"

OSGi is a trade&ark or re#istered trade&ark of the OSGi Alliance in the Anited


States and other countries"

4clipse and the 4clipse lo#o are trade&arks of 4clipse 8oundation2 +nc"

Other co&pan32 product and service na&es &a3 be trade&arks or service &arks
of others"

Vous aimerez peut-être aussi