|
JMS Conector demo (OC4J 10g R3) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPlayer
| Field Summary | |
private static long |
delay
|
private static boolean |
gameOver
|
private static boolean |
human
|
private static java.util.HashMap |
map
|
private static java.lang.String |
player
|
private static boolean |
tookMyTurn
|
| Constructor Summary | |
Player()
|
|
| Method Summary | |
static void |
main(java.lang.String[] argv)
main method for app-client |
private static int |
myScore()
Returns this player's score. |
static void |
play()
This is the top-level game-play method (called by main). |
private static boolean |
playerIsWinning()
Indicates if this player is winning. |
private static void |
primeCommunications(MyChannel command,
MyChannel response)
Handle pub/sub latency -- reach a 'steady state'. |
private static void |
processTurn(GameEvent event)
Process TURN_NOTIFICATION events (decide what to do on this player's turn). |
private static void |
processValue(GameEvent event)
Process PLAYER_GOT_VALUE events (update local game state and detect end of game). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static java.lang.String player
private static long delay
private static boolean human
private static java.util.HashMap map
private static boolean tookMyTurn
private static boolean gameOver
| Constructor Detail |
public Player()
| Method Detail |
public static void main(java.lang.String[] argv)
private static int myScore()
private static boolean playerIsWinning()
private static void processValue(GameEvent event)
event - the PLAYER_GOT_VALUE eventprivate static void processTurn(GameEvent event)
event - the TURN_NOTIFICATION event
private static void primeCommunications(MyChannel command,
MyChannel response)
throws JMSException
JMS does not guarantee ordering between two different destinations. It also does not guarantee any ordering between subscriber creation and the first message received. The following sequence represents a perfectly legal JMS 1.1 scenario:
One solution is to "ping" the dealer until the ResponseDestination topic has been "primed". Once the player has seen a ping response (or any other message) from the ResponseDestination topic, JMS message ordering guarantees that later messages from that same topic (from the same producing session, with the same delivery mode, and with the same or lower priority) will be seen.
Other solutions are possible (such as allowing a player to
repeatedly send until a response is seen) but tend
to be more complicated due to the modification and transference
of game state.PLAYER_JOIN_REQUEST
JMSExceptionpublic static void play()
|
JMS Conector demo (OC4J 10g R3) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||