public class QuoteServer extends ReceiverAdapter
Any updates are multicast across the cluster
Constructor and Description |
---|
QuoteServer() |
Modifier and Type | Method and Description |
---|---|
Map<String,Float> |
getAllStocks() |
float |
getQuote(String stock_name) |
void |
getState(OutputStream ostream)
Allows an application to write a state through a provided OutputStream.
|
static void |
main(String[] args) |
void |
printAllStocks() |
void |
setQuote(String stock_name,
Float value) |
void |
setState(InputStream istream)
Allows an application to read a state through a provided InputStream.
|
void |
start() |
void |
viewAccepted(View new_view)
Called when a change in membership has occurred.
|
protected Log log
public void viewAccepted(View new_view)
MembershipListener
JChannel.connect(String)
returns.viewAccepted
in interface MembershipListener
viewAccepted
in class ReceiverAdapter
public void start()
public void printAllStocks()
public void getState(OutputStream ostream) throws Exception
StateListener
getState
in interface StateListener
getState
in class ReceiverAdapter
ostream
- the OutputStreamException
- if the streaming fails, any exceptions should be thrown so that the state requester
can re-throw them and let the caller know what happenedOutputStream.close()
public void setState(InputStream istream) throws Exception
StateListener
setState
in interface StateListener
setState
in class ReceiverAdapter
istream
- the InputStreamException
- if the streaming fails, any exceptions should be thrown so that the state requester
can catch them and thus know what happenedInputStream.close()
public static void main(String[] args)
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.