org.sapia.ubik.rmi.server.transport.socket
Class SocketRmiServer

java.lang.Object
  extended by org.sapia.ubik.net.SocketServer
      extended by org.sapia.ubik.rmi.server.transport.socket.SocketRmiServer
All Implemented Interfaces:
java.lang.Runnable, MBeanFactory, Server, SocketRmiServerMBean

public class SocketRmiServer
extends SocketServer
implements Server, SocketRmiServerMBean, MBeanFactory

A standard socket server that listens on a given port for incoming RMICommand instances.

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
 
Fields inherited from class org.sapia.ubik.net.SocketServer
_fac
 
Constructor Summary
protected SocketRmiServer(int maxThreads, java.net.ServerSocket server, long resetInterval)
          Creates a new SocketRmiServer instance
protected SocketRmiServer(SocketConnectionFactory fac, ThreadPool tp, java.net.ServerSocket server)
          Creates a new SocketRmiServer instance.
  SocketRmiServer(java.lang.String bindAddr, int port, int maxThreads, long resetInterval)
           
  SocketRmiServer(java.lang.String bindAddr, int port, int maxThreads, long resetInterval, UbikServerSocketFactory factory)
           
protected SocketRmiServer(ThreadPool tp, java.net.ServerSocket server, long resetInterval)
          Creates a new SocketRmiServer instance
 
Method Summary
 MBeanContainer createMBean()
          Internally creates a MBean and its ObjectName, that are returned in a MBeanContainer.
 double getRequestDurationSeconds()
           
 double getRequestsPerSecond()
           
 ServerAddress getServerAddress()
          Returns this instance's address.
 int getThreadCount()
           
protected  boolean handleError(java.lang.Throwable t)
           
 void start()
          Starts this server - this method should not block infinitely.
 
Methods inherited from class org.sapia.ubik.net.SocketServer
close, disableStats, enableStats, getAddress, getPort, getRequestDurationStat, getRequestsPerSecondStat, notifyStarted, run, waitStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sapia.ubik.rmi.server.Server
close
 
Methods inherited from interface org.sapia.ubik.rmi.server.transport.socket.SocketRmiServerMBean
disableStats, enableStats, getAddress, getPort
 

Constructor Detail

SocketRmiServer

public SocketRmiServer(java.lang.String bindAddr,
                       int port,
                       int maxThreads,
                       long resetInterval)
                throws java.io.IOException
Throws:
java.io.IOException

SocketRmiServer

public SocketRmiServer(java.lang.String bindAddr,
                       int port,
                       int maxThreads,
                       long resetInterval,
                       UbikServerSocketFactory factory)
                throws java.io.IOException
Throws:
java.io.IOException

SocketRmiServer

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

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

SocketRmiServer

protected SocketRmiServer(int maxThreads,
                          java.net.ServerSocket server,
                          long resetInterval)
                   throws java.io.IOException
Creates a new SocketRmiServer instance

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

SocketRmiServer

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

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

getServerAddress

public ServerAddress getServerAddress()
Description copied from interface: Server
Returns this instance's address. a ServerAddress.

Specified by:
getServerAddress in interface Server
See Also:
Server.getServerAddress()()

start

public void start()
           throws java.rmi.RemoteException
Description copied from interface: Server
Starts this server - this method should not block infinitely.

Specified by:
start in interface Server
Throws:
java.rmi.RemoteException - if a problem occurs while starting up.
See Also:
Server.start()

getThreadCount

public int getThreadCount()
Specified by:
getThreadCount in interface SocketRmiServerMBean
Overrides:
getThreadCount in class SocketServer
Returns:
the number of request processing threads.

getRequestDurationSeconds

public double getRequestDurationSeconds()
Specified by:
getRequestDurationSeconds in interface SocketRmiServerMBean
Returns:
the current transaction duration stat of the server (in seconds)

getRequestsPerSecond

public double getRequestsPerSecond()
Specified by:
getRequestsPerSecond in interface SocketRmiServerMBean
Returns:
the current RPS stat of the server.

createMBean

public MBeanContainer createMBean()
                           throws java.lang.Exception
Description copied from interface: MBeanFactory
Internally creates a MBean and its ObjectName, that are returned in a MBeanContainer.

Specified by:
createMBean in interface MBeanFactory
Returns:
a MBeanContainer
Throws:
java.lang.Exception - if a problem occurs while creating the MBean or its object name.

handleError

protected boolean handleError(java.lang.Throwable t)
Overrides:
handleError in class SocketServer
See Also:
SocketServer.handleError(Throwable)


Copyright © 2010 Sapia OSS. All Rights Reserved.