com.cafesoft.core.message
Class MessageSocketPoolableObjectFactory

java.lang.Object
  |
  +--com.cafesoft.core.message.MessageSocketPoolableObjectFactory
All Implemented Interfaces:
PoolableObjectFactory, Recyclable

public class MessageSocketPoolableObjectFactory
extends Object
implements PoolableObjectFactory, Recyclable

KRJ - doc

Since:
3/22/02

Constructor Summary
MessageSocketPoolableObjectFactory(Logger logger)
          Create a MessageSocketPoolableObjectFactory.
 
Method Summary
 Object createObject()
          Create a new object for the ObjectPool.
 void destroyObject(Object object)
          Destroy an object that can no longer needed by the ObjectPool.
 Connection getConnection()
          Get the Factory's Connection object.
 void recycle()
          Recycle the resources of this object.
 void setConnection(Connection connection)
          Set the Connection within the Factory.
 void setReceiverContentType(String contentType)
          Set the Receiver's Content Type of the Factory.
 void setSenderContentType(String contentType)
          Set the Sender's Content Type of the Factory.
 boolean validateObject(Object object)
          Ensures that the Object is safe to be returned by the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageSocketPoolableObjectFactory

public MessageSocketPoolableObjectFactory(Logger logger)
Create a MessageSocketPoolableObjectFactory.

Method Detail

recycle

public void recycle()
Recycle the resources of this object.

Specified by:
recycle in interface Recyclable

setConnection

public void setConnection(Connection connection)
Set the Connection within the Factory.

Parameters:
connection - the new Connection object

getConnection

public Connection getConnection()
Get the Factory's Connection object.

Returns:
the Connection object within the Factory

setSenderContentType

public void setSenderContentType(String contentType)
Set the Sender's Content Type of the Factory.

Parameters:
contentType - the new contentType of the Factory

setReceiverContentType

public void setReceiverContentType(String contentType)
Set the Receiver's Content Type of the Factory.

Parameters:
contentType - the new contentType of the Factory

createObject

public Object createObject()
                    throws Exception
Create a new object for the ObjectPool.

Specified by:
createObject in interface PoolableObjectFactory
Returns:
a newly create object for insertion into the ObjectPool
Throws:
Exception - throws an Exception if an error occurred while trying to create a new object

destroyObject

public void destroyObject(Object object)
Destroy an object that can no longer needed by the ObjectPool. All object resources should be released here.

Specified by:
destroyObject in interface PoolableObjectFactory
Parameters:
object - The object to be destroyed.

validateObject

public boolean validateObject(Object object)
Ensures that the Object is safe to be returned by the pool. Returns false if this object should be destroyed.

Specified by:
validateObject in interface PoolableObjectFactory
Parameters:
object - the object to be validated.
Returns:
false if this object is not valid and should be dropped from the pool, true otherwise.


Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.