com.objectwave.simpleSockets
Class MutexClient

java.lang.Object
  |
  +--com.objectwave.simpleSockets.WatchdogClient
        |
        +--com.objectwave.simpleSockets.MutexClient

public class MutexClient
extends com.objectwave.simpleSockets.WatchdogClient


Field Summary
protected  ClientSocket clientSock
           
protected  int port
           
protected  java.util.Random random
           
protected  java.net.Socket sock
           
 
Constructor Summary
MutexClient()
           
MutexClient(java.lang.String host)
           
MutexClient(java.lang.String host, int port)
           
 
Method Summary
protected  long genId()
          For now, just a randomly-generated number (always positive, though).
 long getId()
          Access the unique identifier that this client uses on the server side.
static MutexClient getStaticInstance()
           
 boolean goodbye()
          If this isn't called before the application ends, then the watchdog will consider that a client death.
 boolean isConnected()
          see if you're connected.
static void main(java.lang.String[] args)
           
 void release(java.lang.String string)
           
 void releaseAll()
           
 boolean request(java.lang.String string)
           
protected  boolean request(java.lang.String string, int strike)
           
static void setStaticInstance(MutexClient client)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

protected java.util.Random random

port

protected int port

sock

protected java.net.Socket sock

clientSock

protected ClientSocket clientSock
Constructor Detail

MutexClient

public MutexClient()
            throws java.io.IOException

MutexClient

public MutexClient(java.lang.String host)
            throws java.io.IOException

MutexClient

public MutexClient(java.lang.String host,
                   int port)
            throws java.io.IOException
Method Detail

getStaticInstance

public static MutexClient getStaticInstance()

goodbye

public boolean goodbye()
                throws java.io.IOException
Description copied from class: com.objectwave.simpleSockets.WatchdogClient
If this isn't called before the application ends, then the watchdog will consider that a client death. Always say goodbye before you leave!

Overrides:
goodbye in class com.objectwave.simpleSockets.WatchdogClient
java.io.IOException

main

public static void main(java.lang.String[] args)

release

public void release(java.lang.String string)
             throws java.io.IOException
java.io.IOException

releaseAll

public void releaseAll()
                throws java.io.IOException
java.io.IOException

request

public boolean request(java.lang.String string)
                throws java.io.IOException
java.io.IOException

request

protected boolean request(java.lang.String string,
                          int strike)
                   throws java.io.IOException
java.io.IOException

setStaticInstance

public static void setStaticInstance(MutexClient client)

genId

protected long genId()
For now, just a randomly-generated number (always positive, though).


getId

public long getId()
Access the unique identifier that this client uses on the server side.


isConnected

public boolean isConnected()
see if you're connected.