|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.sgs.example.request.client.WandererClient
public class WandererClient
Defines a client that uses the RequestApp application to simulate a
game with wandering players.
Each WandererClient steps randomly around a board, sending messages
to the channel associated with its local neighborhood, and reading and
writing values associated with its current location. The resulting
application serves as a stress test for the channel and data services,
performing operations that each include a channel send, and twice as many
data service reads as writes.
Clients can handle disconnects, and the main method arranges
to run multiple clients.
This class supports the following properties:
com.sun.sgs.example.request.client.wanderer.host - The
application host name, defaults to localhost
com.sun.sgs.example.request.client.wanderer.port - The
application port; defaults to 11469, the default port for the
RequestApp application
com.sun.sgs.example.request.client.wanderer.clients - The
number of clients run by main, defaults to 10
com.sun.sgs.example.request.client.wanderer.backlog - The
maximum message backlog per client before the client throttles, or
-1 to do no throttling.
com.sun.sgs.example.request.client.wanderer.sleep - The number
of milliseconds to wait between steps, defaults to 200
com.sun.sgs.example.request.client.wanderer.size - The width
and height of the board, defaults to 1000
com.sun.sgs.example.request.client.wanderer.sector - The size
of the neighborhood to assign to a single channel for movement
notifications, defaults to 100
com.sun.sgs.example.request.client.wanderer.report - The number
of seconds between logging performance data, defaults to 20
com.sun.sgs.example.request.client.wanderer.average - The
number of values to include when printing averages, defaults to 5
This class uses the Logger named com.sun.sgs.example.request.client.wanderer to log at the following levels:
Level.INFO - Initialization, performance data
Level.FINE - Login, disconnect, reconnection
Level.FINER - Send and receive messages
Level.FINEST - Exceptions
| Constructor Summary | |
|---|---|
WandererClient()
Creates an instance, and starts a thread to login and perform actions. |
|
| Method Summary | |
|---|---|
void |
disconnected(boolean graceful,
String reason)
|
PasswordAuthentication |
getPasswordAuthentication()
|
com.sun.sgs.client.ClientChannelListener |
joinedChannel(com.sun.sgs.client.ClientChannel channel)
|
void |
leftChannel(com.sun.sgs.client.ClientChannel channel)
|
void |
loggedIn()
|
void |
loginFailed(String reason)
|
static void |
main(String[] args)
Starts up clients. |
void |
receivedMessage(ByteBuffer message)
|
void |
receivedMessage(com.sun.sgs.client.ClientChannel channel,
ByteBuffer message)
|
void |
reconnected()
|
void |
reconnecting()
|
void |
run()
Performs client actions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WandererClient()
| Method Detail |
|---|
public static void main(String[] args)
args - ignoredpublic void run()
run in interface Runnablepublic PasswordAuthentication getPasswordAuthentication()
This implementation returns password authentication for the current user.
getPasswordAuthentication in interface com.sun.sgs.client.simple.SimpleClientListenerpublic void loggedIn()
This implementation notifies the client thread that the client is active.
loggedIn in interface com.sun.sgs.client.simple.SimpleClientListenerpublic void loginFailed(String reason)
loginFailed in interface com.sun.sgs.client.simple.SimpleClientListenerpublic void receivedMessage(ByteBuffer message)
receivedMessage in interface com.sun.sgs.client.ServerSessionListenerpublic void reconnecting()
reconnecting in interface com.sun.sgs.client.ServerSessionListenerpublic void reconnected()
reconnected in interface com.sun.sgs.client.ServerSessionListener
public void disconnected(boolean graceful,
String reason)
disconnected in interface com.sun.sgs.client.ServerSessionListenerpublic com.sun.sgs.client.ClientChannelListener joinedChannel(com.sun.sgs.client.ClientChannel channel)
joinedChannel in interface com.sun.sgs.client.ServerSessionListenerpublic void leftChannel(com.sun.sgs.client.ClientChannel channel)
leftChannel in interface com.sun.sgs.client.ClientChannelListener
public void receivedMessage(com.sun.sgs.client.ClientChannel channel,
ByteBuffer message)
receivedMessage in interface com.sun.sgs.client.ClientChannelListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||