28.01.2015 Views

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.Introductionto<strong>Hermes</strong>25<br />

1.6ASimpleServer <strong>Hermes</strong>datatypes<strong>and</strong><strong>Hermes</strong>statements. mesprograms.Theonlythingyoudonotknownowaresomeadditional FIGURE1.6.Aboundedbuerprocess<br />

allykeepanylocalstate,butinsteadpassedallrequeststhroughtoanother service. typicalserver,sinceitmadeonlyasingleoperationavailable,<strong>and</strong>didn'tre-<br />

Wehaveseenoneexampleofaserver,namelytheFilter.Thiswasn'ta<br />

operation,Quitwhichissimplyacomm<strong>and</strong>toterminate.Figure1.6shows theinterface. Ifthequeueisempty,callstoGetLinewillblockuntilthequeuebecomes orientedlanguages.Ourserverwillimplementabuer.Abuersupports rst-in,rst-outqueue;callstoGetLineremovethedatafromthequeue. theoperationsGetLine<strong>and</strong>PutLine.CallstoPutLineinsertdataintoa non-empty.Foraboundedbuer,callstoPutLinewillblockifthenumber oflinesinthequeueexceedssomecapacity.Wewillsupplyoneadditional Let'slookatamoretypicalserver|onemoreliketheobjectsofobject-<br />

Hereisthesourcemodule: Naturally,weimplementaboundedbuerin<strong>Hermes</strong>withaprocess. BoundedBuffer:using(St<strong>and</strong>ard,BBExternal,BBLocal,Quit) process(Init:BBIn) declare Put:PutLineIn;--PutLineservice Parms:BBInterface;--initializationcallmessage Get:GetLineIn;--GetLineservice Queue:Lines;--orderedsetoflines Quit:QuitIn;--Quitservice Capacity:integer;--maximumnumberofmessages<br />

PutLine<br />

Quit<br />

Buffer<br />

GetLine

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!