Class NotificationConnectorPool
- java.lang.Object
-
- org.apache.manifoldcf.crawler.notificationconnectorpool.NotificationConnectorPool
-
- All Implemented Interfaces:
INotificationConnectorPool
public class NotificationConnectorPool extends java.lang.Object implements INotificationConnectorPool
An implementation of INotificationConnectorPool. Coordination and allocation among cluster members is managed within. These objects are thread-local, so do not share them among threads.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
NotificationConnectorPool.LocalPool
Actual static mapping connector pool
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
_rcsid
protected static NotificationConnectorPool.LocalPool
localPool
Local connector poolprotected IThreadContext
threadContext
Thread context
-
Constructor Summary
Constructors Constructor Description NotificationConnectorPool(IThreadContext threadContext)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeAllConnectors()
Clean up all open repository connector handles.void
flushUnusedConnectors()
Flush only those connector handles that are currently unused.INotificationConnector
grab(INotificationConnection notificationConnection)
Get a notification connector.INotificationConnector[]
grabMultiple(java.lang.String[] orderingKeys, INotificationConnection[] notificationConnections)
Get multiple notification connectors, all at once.void
pollAllConnectors()
Idle notification for inactive repository connector handles.void
release(INotificationConnection connection, INotificationConnector connector)
Release a notification connector.void
releaseMultiple(INotificationConnection[] connections, INotificationConnector[] connectors)
Release multiple notification connectors.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
localPool
protected static final NotificationConnectorPool.LocalPool localPool
Local connector pool
-
threadContext
protected final IThreadContext threadContext
Thread context
-
-
Constructor Detail
-
NotificationConnectorPool
public NotificationConnectorPool(IThreadContext threadContext) throws ManifoldCFException
Constructor- Throws:
ManifoldCFException
-
-
Method Detail
-
grabMultiple
public INotificationConnector[] grabMultiple(java.lang.String[] orderingKeys, INotificationConnection[] notificationConnections) throws ManifoldCFException
Get multiple notification connectors, all at once. Do this in a particular order so that any connector exhaustion will not cause a deadlock.- Specified by:
grabMultiple
in interfaceINotificationConnectorPool
- Parameters:
orderingKeys
- are the keys which determine in what order the connectors are obtained.notificationConnections
- are the connections to use the build the connector instances.- Throws:
ManifoldCFException
-
grab
public INotificationConnector grab(INotificationConnection notificationConnection) throws ManifoldCFException
Get a notification connector. The connector is specified by a notification connection object.- Specified by:
grab
in interfaceINotificationConnectorPool
- Parameters:
notificationConnection
- is the notification connection to base the connector instance on.- Throws:
ManifoldCFException
-
releaseMultiple
public void releaseMultiple(INotificationConnection[] connections, INotificationConnector[] connectors) throws ManifoldCFException
Release multiple notification connectors.- Specified by:
releaseMultiple
in interfaceINotificationConnectorPool
- Parameters:
connections
- are the connections describing the instances to release.connectors
- are the connector instances to release.- Throws:
ManifoldCFException
-
release
public void release(INotificationConnection connection, INotificationConnector connector) throws ManifoldCFException
Release a notification connector.- Specified by:
release
in interfaceINotificationConnectorPool
- Parameters:
connection
- is the connection describing the instance to release.connector
- is the connector to release.- Throws:
ManifoldCFException
-
pollAllConnectors
public void pollAllConnectors() throws ManifoldCFException
Idle notification for inactive repository connector handles. This method polls all inactive handles.- Specified by:
pollAllConnectors
in interfaceINotificationConnectorPool
- Throws:
ManifoldCFException
-
flushUnusedConnectors
public void flushUnusedConnectors() throws ManifoldCFException
Flush only those connector handles that are currently unused.- Specified by:
flushUnusedConnectors
in interfaceINotificationConnectorPool
- Throws:
ManifoldCFException
-
closeAllConnectors
public void closeAllConnectors() throws ManifoldCFException
Clean up all open repository connector handles. This method is called when the connector pool needs to be flushed, to free resources.- Specified by:
closeAllConnectors
in interfaceINotificationConnectorPool
- Throws:
ManifoldCFException
-
-