org.norther.tammi.spray.connector
Class DefaultExecutableConnector

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.spray.connector.DefaultConnector
          extended by org.norther.tammi.spray.connector.DefaultExecutableConnector
All Implemented Interfaces:
Serializable, Runnable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, Startable, Executable, Connector, ExecutableConnector
Direct Known Subclasses:
DefaultRMIConnector, DefaultTCPConnector

public class DefaultExecutableConnector
extends DefaultConnector
implements ExecutableConnector

A default implementation of ExecutableConnector. The run method must be implemented by subclasses.

Version:
$Id: DefaultExecutableConnector.java,v 1.7 2009/09/28 15:08:30 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.spray.connector.DefaultConnector
LOCALHOST
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Constructor Summary
  DefaultExecutableConnector()
          Constructs a new connector.
protected DefaultExecutableConnector(InetAddress addr)
          Constructs a connector with a host address.
 
Method Summary
protected  void execute(Connection connection)
          Executes the specified connection.
 int getConnectionCount()
          Gets a snapshot of the number of active and idle connections.
protected  MBeanReference<Executor> getExecutorMBean()
          Gets a reference to the executor MBean.
 ObjectName getExecutorName()
          Gets the the executor of this executable.
 ObjectName getRequestExecutorName()
          Gets the executor for requests.
 boolean isStarted()
          Checks whether the startable has been started.
 void premanaged(MBeanDelegate adapter)
          This method is called when the implementing adaptee is trying to be managed either during pre-registration of the corresponding adapter MBean or just before it is explicitly added to the adapter MBean during run-time.
 void run()
           
 void setExecutorName(ObjectName executor)
          Sets the executor of this executable.
 void setRequestExecutorName(ObjectName executor)
          Sets the executor for requests.
 void start()
          Starts the MBean.
 void stop()
          Stops the MBean.
 void unmanaged()
          This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.
 
Methods inherited from class org.norther.tammi.spray.connector.DefaultConnector
getAddress, getConnectionTimeout, getFilterMBean, getFilterName, getInetAddress, getKeyAlias, getLoggerMBean, getLoggerName, getMaxIdleConnections, getName, getPort, getProvider, getRedirectPort, getRequestTimeout, getTimeoutMBean, isKeepConnection, isLoggingDisabled, isSecure, keepConnection, postmanaged, setAddress, setConnectionTimeout, setFilterName, setInetAddress, setKeyAlias, setKeyPassword, setLoggerName, setLoggingDisabled, setMaxIdleConnections, setPort, setProvider, setRedirectPort, setRequestTimeout, setSecure
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.spray.connector.Connector
getAddress, getConnectionTimeout, getFilterName, getKeyAlias, getLoggerName, getMaxIdleConnections, getName, getPort, getProvider, getRedirectPort, getRequestTimeout, isKeepConnection, isLoggingDisabled, isSecure, keepConnection, setConnectionTimeout, setFilterName, setKeyAlias, setKeyPassword, setLoggerName, setLoggingDisabled, setMaxIdleConnections, setPort, setProvider, setRedirectPort, setRequestTimeout, setSecure
 

Constructor Detail

DefaultExecutableConnector

public DefaultExecutableConnector()
Constructs a new connector.


DefaultExecutableConnector

protected DefaultExecutableConnector(InetAddress addr)
Constructs a connector with a host address.

Parameters:
addr - the host address.
Method Detail

premanaged

public void premanaged(MBeanDelegate adapter)
                throws Exception
Description copied from interface: Manageable
This method is called when the implementing adaptee is trying to be managed either during pre-registration of the corresponding adapter MBean or just before it is explicitly added to the adapter MBean during run-time.

Specified by:
premanaged in interface Manageable
Overrides:
premanaged in class Adaptee
Parameters:
adapter - the managing adapter.
Throws:
Exception - if the adaptee refused to be managed.

unmanaged

public void unmanaged()
               throws Exception
Description copied from interface: Manageable
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.

Specified by:
unmanaged in interface Manageable
Overrides:
unmanaged in class DefaultConnector
Throws:
Exception - if the adaptee refused to be unmanaged.

getConnectionCount

public int getConnectionCount()
Description copied from interface: Connector
Gets a snapshot of the number of active and idle connections.

Note that the count is implementation dependent and its accuracy may vary.

Specified by:
getConnectionCount in interface Connector
Specified by:
getConnectionCount in interface ExecutableConnector
Overrides:
getConnectionCount in class DefaultConnector
Returns:
the number of connections.

getRequestExecutorName

public ObjectName getRequestExecutorName()
Description copied from interface: ExecutableConnector
Gets the executor for requests.

Specified by:
getRequestExecutorName in interface ExecutableConnector
Returns:
the name of the executor or a query.

setRequestExecutorName

public void setRequestExecutorName(ObjectName executor)
Description copied from interface: ExecutableConnector
Sets the executor for requests.

Specified by:
setRequestExecutorName in interface ExecutableConnector
Parameters:
executor - the name of the executor or a query.

getExecutorName

public ObjectName getExecutorName()
Description copied from interface: Executable
Gets the the executor of this executable.

Specified by:
getExecutorName in interface Executable
Returns:
the object name of the executor or a query.

setExecutorName

public void setExecutorName(ObjectName executor)
Description copied from interface: Executable
Sets the executor of this executable. If it is not set, the default one will be used.

Note that it will be taken into use after next start.

Specified by:
setExecutorName in interface Executable
Parameters:
executor - the object name of the executor or a query.

isStarted

public boolean isStarted()
Description copied from interface: Startable
Checks whether the startable has been started.

Specified by:
isStarted in interface Startable
Overrides:
isStarted in class DefaultConnector
Returns:
true if started, otherwise false.

start

public void start()
           throws Exception
Description copied from interface: Startable
Starts the MBean.

Specified by:
start in interface Startable
Overrides:
start in class DefaultConnector
Throws:
Exception - if start fails.

stop

public void stop()
Description copied from interface: Startable
Stops the MBean.

Specified by:
stop in interface Startable
Overrides:
stop in class DefaultConnector

run

public void run()
Specified by:
run in interface Runnable

getExecutorMBean

protected MBeanReference<Executor> getExecutorMBean()
Gets a reference to the executor MBean.

Returns:
a referenceto the executor MBean.

execute

protected void execute(Connection connection)
Executes the specified connection.

Parameters:
connection - the connection.


Copyright © 2004 The Norther Organization. All rights reserved.