org.garret.jipc.server
Class JIPCServer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.garret.jipc.server.JIPCServer
All Implemented Interfaces:
JIPCFactory, java.lang.Runnable

public class JIPCServer
extends java.lang.Thread
implements JIPCFactory

Factory for local session. These session can be used to provide synchornization and communitcation between threads in the same process. It is possible to share tghe single session between all threads. Also this class is used as server for remove sessions. Server should be launched by "java org.garret.jipc.server.JIPCServer [-d] PORT" command. The following system proiperties can be soecified:

jipc.debug
specifies debugging level:
jipc.linger
linger time in seconds (default 10)


Field Summary
static int DEBUG_EXCEPTIONS
           
static int DEBUG_NONE
          Debug levels
static int DEBUG_REQUESTS
           
static int DEBUG_SESSIONS
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JIPCServer(int port)
          Constructor server for remote connections.
 
Method Summary
 org.garret.jipc.JIPCSession create(java.lang.String address, int port)
          Create session instance.
 void dump(java.io.PrintStream out)
          Dump information about state of the server: all active sessions and all primitives opened by these sessions
static org.garret.jipc.JIPCFactory getInstance()
          Get instance of the server
static void main(java.lang.String[] args)
          Server main function.
 void run()
          This method is executed by thread accepting client connections
 void shutdown()
          Shutdown the server
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG_EXCEPTIONS

public static final int DEBUG_EXCEPTIONS
See Also:
Constant Field Values

DEBUG_NONE

public static final int DEBUG_NONE
Debug levels

See Also:
Constant Field Values

DEBUG_REQUESTS

public static final int DEBUG_REQUESTS
See Also:
Constant Field Values

DEBUG_SESSIONS

public static final int DEBUG_SESSIONS
See Also:
Constant Field Values
Constructor Detail

JIPCServer

public JIPCServer(int port)
           throws java.io.IOException
Constructor server for remote connections. This constructor creates server socket at which client connections will be accepted

Parameters:
port - port number at which client connections will be accepted
Method Detail

create

public org.garret.jipc.JIPCSession create(java.lang.String address,
                                          int port)
Description copied from interface: JIPCFactory
Create session instance. For client session, connection with server is established.

Specified by:
create in interface JIPCFactory
Parameters:
address - server host address (ignored for local sessions)
port - server port (ignored for local sessions)
Returns:
session object

dump

public void dump(java.io.PrintStream out)
          throws JIPCException
Dump information about state of the server: all active sessions and all primitives opened by these sessions

Parameters:
out - output stream
JIPCException

getInstance

public static org.garret.jipc.JIPCFactory getInstance()
Get instance of the server


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Server main function.
    Command syntax: 
        java org.garret.jipc.server.JIPCServer [-d] PORT
    Options:
        -d         start program in daemon mode without interactive dialog
    Parameters:
        PORT       port at which server will accept client connections
 
Whithout "-d" option this functions starts interactive dialog. The following commands are supported:
info
Dump information about all sessions and all primitives
exit
Shutdown server
help
Print list of accepted commands

When server is started in daemon mode, commands to the server can be sent using org.garret.jipc.client.JIPCServerMonitor utility

java.lang.Exception
See Also:
JIPCServerMonitor

run

public void run()
This method is executed by thread accepting client connections

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

shutdown

public void shutdown()
Shutdown the server