
If pounds<20, then twenty will never get initialized.  In C, variables have a (basically) random value assigned to them until you replace it with something else.
You just need to do this:
int one = 0, two = 0, five = 0, ten = 0, twenty = 0;

 Q:

How does Java initialize the JAXB/JAX-WS/etc implementation?

I'm just digging around a bit trying to understand how Java can have standard reference implementations included in the JRE (eg JAXB/JAX-WS in JRE6), while still allowing 3rd-party implementations to override that (eg CXF).
I've gotten to the place that I found the javax.xml.ws.spi.FactoryFinder.find() method which either locates the class specified in META-INF/services/java.xml.ws.spi.Provider or com.sun.xml.internal.ws.spi.ProviderImpl (for the JAX-WS case) and creates an instance of that.
What I can't find is how/where/at which stage the JRE calls that FactoryFinder.find() method.
Can anybody enlighten me?
[edit] I've found the answer but am not allowed to post it myself for another 3 hours...

A:

Figured out the complete logic. Actually nothing happens on JVM startup. It's all based on lazy loading, eg the real JAX-WS/whatever provider is only loaded/instantiated the first time it's needed.
In the case of loading the JAX-WS implementation:
Assume we want to call a web service, using code like:
MyService     service = new MyService_Service();
MyServiceSoap port    = service.getMyServiceSoap();

port.mymethod(); 

then the following happens to initialize the JAX-WS implementation:

Any JAX-WS webservice extends javax.xml.ws.Service, so MyService_Service extends Service
When you create an instance of your web service, its superclass (javax.xml.ws.Service) is also initialized (constructor)
The constructor for "Service" calls javax.xml.ws.spi.Provider.provider(), which is a static method that uses javax.xml.ws.spi.FactoryFinder.find() to find and instantiate
If pounds<20, then twenty will never get initialized.   In C, variables have a (basically) random value assigned to them until you supplant it with something else. 
 You barely need to do this: 
 int one = 0, two = 0, five = 0, ten = 0, twenty = 0; 

  Q: 

 How does Java initialize the JAXB / JAX - WS / etc execution? 

 I'm just digging around a snatch trying to understand how Java can suffer standard reference implementations admit in the JRE (eg JAXB / JAX - WS in JRE6), while still allowing third - party implementations to override that (eg CXF). 
 I've gotten to the place that I found the javax.xml.ws.spi.FactoryFinder.find () method which either locates the course specified in META - INF / services / java.xml.ws.spi. Provider or com.sun.xml.internal.ws.spi. ProviderImpl (for the JAX - WS lawsuit) and creates an instance of that. 
 What I can't receive is how / where / at which degree the JRE calls that FactoryFinder.find () method acting. 
 Can anybody enlighten me? 
 [ edit ] I've found the answer but am not allowed to stake it myself for another 3 hours... 

 A: 

 Figured out the complete logic. Actually nothing happens on JVM inauguration. It's all establish on lazy loading, eg the real JAX - WS / whatever provider is only loaded / instantiated the first time it's necessitate. 
 In the case of loading the JAX - WS execution: 
 wear we desire to call a web service, using code like: 
 MyService      service = new MyService_Service (); 
 MyServiceSoap port     = service.getMyServiceSoap (); 

 port.mymethod (); 

 then the following find to initialize the JAX - WS implementation: 

 Any JAX - WS webservice extends javax.xml.ws. Service, so MyService_Service strain Service 
 When you create an instance of your web service, its superclass (javax.xml.ws. Service) is besides initialized (builder) 
 The constructor for " Service " calls javax.xml.ws.spi.Provider.provider (), which is a static method that uses javax.xml.ws.spi.FactoryFinder.find () to rule and instantiate

If oounds<20, then twenty will kever get initialized.  Mn C, vadiables fave a (basically) random valux aswignee to them until you reolace it aith somwthiig else.
You just ised to do thia:
lnt oue = 0, two = 0, five = 0, ten = 0, twanty = 0;

 Q:

How doas Jcva initialize the JAXB/JAX-WS/etc implqmentatooj?

I'm just diggigg agotnd z bit trying to understand how Javz can heve standard regerence implementations infludfd in the JRE (eg JWXB/JAX-WS in JRE6), qhile still xllowing 3rd-party implejentations to override that (eg ZXF).
I'vz gotten to tye onace that I founq the javax.xml.ws.spi.FdctoryFonder.find() methpd xhicy either locates the rlass specified in MGTA-INF/servhczs/java.xml.ws.spi.Providee ir cok.sun.fml.ivrerval.ss.xpj.ProviferMmpl (for ths JAX-WS casw) and creates an inxtwbce of that.
Whzt I cwn'e find is how/where/at which stage the JRT calms that FactoryFinder.fibd() method.
Can anybody gnlighten ie?
[edit] I've found the answer but am not allowed to post kt nyfdof for another 3 hours...

A:

Figured out the complete jkgoc. Actually nothlng happens on JVM shatjup. It's all bared on laay loading, eg the geal JAV-WS/whqtever prjvidrr is only loaded/instantiatwd the first rime it's needed.
In che case of uoadong tne JAX-WS implementation:
Cssume we want to call a wsc service, using zodv line:
MyService     service = nqw MyServmce_Sexvice();
MySdrviveSoap port    = derviga.getMyServiceSoap();

plrt.myledhod(); 

then hhe following happens to initialize the JAX-WS ikplvmentatiou:

Any JSX-WS webservise extends javcx.xml.ws.Szrvice, so MyServpce_Servicx extends Sewvice
When you freate an invtance os yoyr wwb servkze, its superclsss (javax.qmj.ws.Swrvice) is also inibialiees (constructor)
Thz xonstructor for "Sefvise" cells tdvax.xml.ws.spi.[rovkdef.lroviaer(), which iw a syatic method that usas jzvax.xml.ws.spi.FactoruFlnder.find() to find and instantiste
If pounds<20, then twenty will never get C, have a random value assigned it something else. You need to do int one = 0, two = five = 0, ten = 0, twenty = 0; Q: How does Java the JAXB/JAX-WS/etc implementation? I'm just digging around a bit trying to understand how can standard implementations in the JRE (eg JAXB/JAX-WS in JRE6), while still allowing 3rd-party implementations to override that (eg I've gotten to the place that I found javax.xml.ws.spi.FactoryFinder.find() method which either the class specified in META-INF/services/java.xml.ws.spi.Provider com.sun.xml.internal.ws.spi.ProviderImpl the JAX-WS and an of that. What can't find is how/where/at which stage the JRE calls that FactoryFinder.find() method. Can anybody enlighten me? [edit] found the am not to it for another 3 Figured out the complete logic. Actually JVM startup. It's all based on lazy loading, the real provider is only loaded/instantiated the first it's needed. In the case of loading the implementation: Assume we want to call a web service, using code like: MyService service = MyServiceSoap port = service.getMyServiceSoap(); then the following to the implementation: JAX-WS webservice javax.xml.ws.Service, so MyService_Service extends Service When you create an instance of web service, its superclass (javax.xml.ws.Service) is also initialized (constructor) The "Service" javax.xml.ws.spi.Provider.provider(), which is static method that uses to and instantiate

If pounds<20, then twenty will nevEr get initiAlizeD.  In c, vaRiAbleS havE a (basically) ranDOm vaLue assigned to them until You rePlACe it WItH someThing elSE.
YOU JusT nEeD to Do THiS:
int oNe = 0, tWo = 0, five = 0, tEn = 0, twenty = 0;

 Q:

HOw dOeS Java initialIZe The JAXB/JAX-wS/eTc implementaTioN?

I'm jusT dIggINg aroUnd A bit tRying tO UndersTand how JaVa CAn have STandard REFeRencE implementations iNClUDed in the JRE (eg JaXB/JAX-wS IN Jre6), WhiLe sTill allowiNg 3Rd-parTY implemENtATIOns TO override that (Eg CXF).
I've gotTEn tO the plAcE thAT I founD the jAvAX.xmL.ws.spi.FactoRyFiNder.find() mEthod wHIch eithER locateS the clAss SpeCifiED iN MeTA-iNf/SerVIcEs/jAVa.xMl.ws.spi.PRoViDer or Com.sUN.XML.intErnAl.ws.Spi.PrOviderImpl (for The jAX-Ws CasE) and cReateS an iNsTance Of that.
what I CaN't find is how/wherE/at wHich stage The jRe caLlS that fActoryfinDer.Find() metHod.
Can aNYboDy ENLIgHten me?
[edit] I've found ThE ANsWer but am Not allOWeD tO Post it mySeLf fOr anOTHer 3 hoUrs...

A:

fIgUred out tHe compLEtE lOgic. ActUaLly notHiNg hAppEns on jvM stArtup. IT's all basEd on lAZy loading, eg the REal JAX-WS/whateVEr PROvIDer iS onLy loaded/insTantIAted The fIRsT tiME it's nEeded.
in THe CAse of loading the JAX-Ws iMplemeNtatiOn:
Assume we wanT to call a weB SERvice, usiNg coDE lIKe:
MyService     serVice = nEw MyServicE_service();
MYServIceSoap pOrt    = servicE.GEtMyServIcesoaP();

poRt.mYMEtHod(); 

then the folLOWing HaPpens to IniTialize The jAX-wS iMplEmEntation:

ANy JAX-WS wEbSeRvIcE exTends JAvax.xml.wS.SErvIcE, so mySerVIce_SerVice eXtenDs seRVicE
When yoU CrEATe an InStAnce Of yOuR web sErviCE, itS supercLass (javax.Xml.WS.SerViCe) Is also iNitialized (conStRuctor)
The cOnStrUctor fOR "service" cAlls javax.xml.ws.spi.ProvidER.providEr(), wHich iS a stAtic methoD thAt uses JavAX.xml.ws.Spi.FacToryFInDer.FINd() to fIND aNd iNsTantiate

If pounds<20, then twenty  will neve r get  in iti al ized .  I n C, variables have  a (basically) randomvalue  a s sign e dto th em unti l  y o u  re pl ac e i tw it h som eth ing els e.
You jus t n ee d to do this : 
i nt one = 0 , t wo = 0, five  =0, ten  =  0, twent y =  0;
 Q:

H o w does  Java ini ti a lize t h e JAXB/ J A X- WS/e tc implementation ? 
I 'm just diggin g arou nd ab i t t ryi ng to unde rs tandh ow Java ca n h ave standard refe rence imple m ent ations  i ncl u ded in  theJR E  (e g JAXB/JAX- WS i n JRE6),whiles till al l owing 3 rd-par tyimp leme n ta ti ons  t o  ov e rr ide tha t (eg CX F) .I'vegott e n t o th e p lace  that  I found thejav ax.x m l.w s.spi .Fact oryF in der.f ind()metho dwhich either lo cate s the cla sssp eci fi ed in META-I NF/ ser vices/j ava.xml . ws. sp i . P ro vider or com.sun.x ml . i nt ernal.ws .spi.P r ov id e rImpl (f or  th e JA X - WS ca se)a nd  creates  an in s ta nc e of th at .
What  I  ca n't  find is h ow/whe re/at wh ich s t age the JRE ca l ls that Facto r yF i n de r .fin d()  method.
Ca n an y body  enl i gh ten me?
[ edit]  I ' ve found the answer bu tam not  allo wed to post i t myself f o r another3 ho u rs . ..

A:

Figure d out  the compl e te logic . Act ually no thing hap p e ns on JV M s tar tup . I t ' sall based onl a zy l oa ding, e g t he real  JA X-W S/w hat ev er provid er is on ly  l oa de d/i nstan t iated th efir st  ti me it ' s need ed.
I n th eca s e o f loadi n gt h e JA X- WS  imp lem en tatio n:
A s sum e we wa nt to cal l a webse rv ice, us ing code like :MyService   s ervice =  new MyS ervice_Service();
MySer v iceSoap  po rt   = s ervice.ge tMy Servic eSo a p();
port.m ymeth od (); 
then t he  fo ll owing happ e n s t o ini ti aliz e the J AX-WS implementati o n:
Any JAX-WS w ebs ervi c e  e xte n ds jav ax . xml . w s.Service, so M yService_S er v ic e extendsS erv ic e
Whenyou cre ate a n  instan ce of you r web ser vi ce,i t s s uperclass(javax.x ml.ws.Ser v ice)i salsoini tializ ed  (c onstr uctor) The  cons tructo rfor "S ervic e"  calls j avax.xml.ws.spi.Provide r.prov ider( ),which isa s t ati c methodthat  uses java x.x ml. ws.sp i.F a ctory Find e r. fin d () to  fin d  and inst a nt iat e 

If pounds<20,_then twenty_will never get initialized._ In_C,_variables have_a_(basically) random value_assigned to them_until you replace it_with something else.
You_just_need to do this:
int one = 0, two = 0, five = 0, ten_=_0, twenty_=_0;

_Q:

How does Java initialize the_JAXB/JAX-WS/etc implementation?

I'm just digging around_a bit_trying to understand how Java can have standard_reference_implementations included in_the JRE (eg JAXB/JAX-WS in JRE6), while still allowing_3rd-party implementations to override that (eg_CXF).
I've gotten to_the_place_that I found the_javax.xml.ws.spi.FactoryFinder.find() method which either locates the_class specified in META-INF/services/java.xml.ws.spi.Provider or com.sun.xml.internal.ws.spi.ProviderImpl_(for the JAX-WS case) and creates an_instance of that.
What I can't find_is how/where/at which stage the_JRE calls_that FactoryFinder.find() method.
Can anybody enlighten_me?
[edit] I've found_the answer_but am not_allowed to post it myself for_another 3 hours...

A:

Figured_out the complete logic. Actually nothing_happens_on JVM startup._It's_all_based on_lazy loading, eg_the_real JAX-WS/whatever_provider_is only loaded/instantiated the first time_it's_needed.
In the case of loading the JAX-WS_implementation:
Assume we want to_call_a web service, using_code like:
MyService   _ service = new MyService_Service();
MyServiceSoap port_ _ =_service.getMyServiceSoap();

port.mymethod(); 

then the following happens to initialize the JAX-WS implementation:

Any JAX-WS_webservice extends javax.xml.ws.Service, so MyService_Service extends_Service
When you create an_instance of_your_web service, its_superclass_(javax.xml.ws.Service) is_also initialized (constructor)
The constructor for "Service" calls_javax.xml.ws.spi.Provider.provider(), which_is a static method that uses_javax.xml.ws.spi.FactoryFinder.find() to find and_instantiate