org.sapia.ubik.net
Class SocketServer

java.lang.Object
  extended by org.sapia.ubik.net.SocketServer
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
MyServer, SocketRmiServer

public abstract class SocketServer
extends java.lang.Object
implements java.lang.Runnable

Implements a socket server.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Field Summary
protected  SocketConnectionFactory _fac
           
 
Constructor Summary
protected SocketServer(int port, SocketConnectionFactory fac, ThreadPool tp, UbikServerSocketFactory socketFactory)
           
protected SocketServer(int port, ThreadPool tp, UbikServerSocketFactory socketFactory)
           
protected SocketServer(SocketConnectionFactory fac, ThreadPool tp, java.net.ServerSocket server)
          Creates a new SocketServer instance.
protected SocketServer(java.lang.String bindAddr, int port, SocketConnectionFactory fac, ThreadPool tp, UbikServerSocketFactory socketFactory)
           
protected SocketServer(java.lang.String bindAddr, int port, ThreadPool tp, UbikServerSocketFactory socketFactory)
           
protected SocketServer(ThreadPool tp, java.net.ServerSocket server)
          Creates a new SocketServer instance
 
Method Summary
 void close()
           
 void disableStats()
           
 void enableStats()
           
 java.lang.String getAddress()
           
 int getPort()
           
 Statistic getRequestDurationStat()
           
 Statistic getRequestsPerSecondStat()
           
 int getThreadCount()
           
protected  boolean handleError(java.lang.Throwable t)
           
protected  void notifyStarted()
           
 void run()
           
 void waitStarted()
          Call to block on this instance until its internal socket server has been started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_fac

protected SocketConnectionFactory _fac
Constructor Detail

SocketServer

protected SocketServer(int port,
                       ThreadPool tp,
                       UbikServerSocketFactory socketFactory)
                throws java.io.IOException
Throws:
java.io.IOException

SocketServer

protected SocketServer(java.lang.String bindAddr,
                       int port,
                       ThreadPool tp,
                       UbikServerSocketFactory socketFactory)
                throws java.io.IOException
Throws:
java.io.IOException

SocketServer

protected SocketServer(int port,
                       SocketConnectionFactory fac,
                       ThreadPool tp,
                       UbikServerSocketFactory socketFactory)
                throws java.io.IOException
Throws:
java.io.IOException

SocketServer

protected SocketServer(java.lang.String bindAddr,
                       int port,
                       SocketConnectionFactory fac,
                       ThreadPool tp,
                       UbikServerSocketFactory socketFactory)
                throws java.io.IOException
Throws:
java.io.IOException

SocketServer

protected SocketServer(ThreadPool tp,
                       java.net.ServerSocket server)
                throws java.io.IOException
Creates a new SocketServer instance

Parameters:
tp -
server -
Throws:
java.io.IOException

SocketServer

protected SocketServer(SocketConnectionFactory fac,
                       ThreadPool tp,
                       java.net.ServerSocket server)
                throws java.io.IOException
Creates a new SocketServer instance.

Parameters:
fac -
tp -
server -
Throws:
java.io.IOException
Method Detail

getAddress

public java.lang.String getAddress()

enableStats

public void enableStats()

disableStats

public void disableStats()

getPort

public int getPort()

getRequestsPerSecondStat

public Statistic getRequestsPerSecondStat()

getRequestDurationStat

public Statistic getRequestDurationStat()

getThreadCount

public int getThreadCount()

close

public void close()

run

public void run()
Specified by:
run in interface java.lang.Runnable

waitStarted

public void waitStarted()
                 throws java.lang.InterruptedException,
                        java.net.SocketException
Call to block on this instance until its internal socket server has been started.

Throws:
java.lang.InterruptedException - if the calling thread is interrupted while waiting.
java.net.SocketException - if an exception occurs while internally performing startup.

notifyStarted

protected void notifyStarted()

handleError

protected boolean handleError(java.lang.Throwable t)


Copyright © 2010 Sapia OSS. All Rights Reserved.