PILLUTLAAVINASH / google-enterprise-connector-manager

Automatically exported from code.google.com/p/google-enterprise-connector-manager
0 stars 0 forks source link

Add a connector destruction method to the SPI #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It might be helpful to have a lifecycle method in the SPI that is invoked by 
the Connector Manager when 
a connector is deleted. This would allow the connector to cleanup resources, 
such as temporary files or 
state files in the configuration directory, or other temporary items in 
databases or directories. Perhaps 
it is possible for the Connector Manager to do some cleanup that causes Spring 
to call the destroy 
method of the Connector bean, but that's arguably an implementation detail.

A delete method might be a reasonable workaround for issue 87. It would still 
be shutting down the 
connector from another thread, but in this case the connector itself would be 
informed, so it might be 
able to shutdown even open files and the like more gracefully than the 
Connector Manager can.

Other lifecycle methods could be imagined. Informing the connector of a pause 
in the traversal, either 
by running out of items or an explicit pause in the schedule, would allow it to 
free cached data. This 
seems nice, but we would at the moment be inventing methods in advance of 
needing them.

Original issue reported on code.google.com by jl1615@gmail.com on 7 May 2008 at 10:47

GoogleCodeExporter commented 8 years ago
When this gets implemented, consider calling it from ConnectorInstanceFactory to
clean up connector instances that were created from the ConnectorFactory, but 
are not
in the InstanceMap.

Original comment by Brett.Mi...@gmail.com on 13 Jul 2008 at 10:28

GoogleCodeExporter commented 8 years ago
Add a new ConnectorLifecycle mixin interface with a destroy method. Do we want 
to
think about other lifecycle methods? Check similar lifecycle interfaces, like 
servlets.

Original comment by jl1615@gmail.com on 8 Dec 2008 at 11:29

GoogleCodeExporter commented 8 years ago
SPI change for the next release.

Original comment by jl1615@gmail.com on 9 Dec 2008 at 1:27

GoogleCodeExporter commented 8 years ago

Original comment by Brett.Mi...@gmail.com on 26 Feb 2009 at 11:26

GoogleCodeExporter commented 8 years ago
Fixed in Connector Manager revision r1569

I added SPI ConnectorShutdownAware Interface which may
be implemented by Connectors.

The ConnectorShutdownAware Interface adds 2 new methods:

public void shutdown() throws RepositoryException;
is called when the connector is being shutdown,
which can happen as the webapp is being shutdown,
or as the connector is being reconfigured, or as
the connector is being deleted.  This allows the
connector the opportunity to release resources,
close connections to the ECM, etc.

public void delete() throws RepositoryException;
is called as the connector instance is being
deleted.  The allows the connector the opportunity
to remove persistent store files, preferences, etc.

Change Log:
----------
A 
projects/connector-manager/source/java/com/google/enterprise/connector/spi/Conne
ctorShutdownAware.java
   - Added new shutdown() and delete() methods to enhance Connector Interface

M 
projects/connector-manager/source/java/com/google/enterprise/connector/instantia
tor/Instantiator.java
M 
projects/connector-manager/source/java/com/google/enterprise/connector/instantia
tor/SpringInstantiator.java
M 
projects/connector-manager/source/javatests/com/google/enterprise/connector/inst
antiator/MockInstantiator.java
   - Added shutdown() method to propagate system shutdown to connector instances

M 
projects/connector-manager/source/java/com/google/enterprise/connector/instantia
tor/InstanceMap.java
   - Added shutdown() method to propagate system shutdown to connector instances
   - Call shutdown() method on connectors created by the ConnectorFactory
   - Call shutdown() method on connector instances being replaced with new configuration
   - Call shutdown() and delete() methods on connector instances being deleted

M 
projects/connector-manager/source/java/com/google/enterprise/connector/scheduler
/TraversalScheduler.java
   - Shutdown the Instantiator during system shutdown

M 
projects/connector-manager/source/javatests/com/google/enterprise/connector/inst
antiator/CustomProtoTestConnector.java
M 
projects/connector-manager/source/javatests/com/google/enterprise/connector/jcr/
JcrConnector.java
   - Implement new shutdown() and delete() ConnectorShutdownAware interfaces

Original comment by Brett.Mi...@gmail.com on 17 Mar 2009 at 10:17

GoogleCodeExporter commented 8 years ago

Original comment by Brett.Mi...@gmail.com on 17 Mar 2009 at 10:18

GoogleCodeExporter commented 8 years ago

Original comment by Brett.Mi...@gmail.com on 16 May 2009 at 8:39

GoogleCodeExporter commented 8 years ago

Original comment by jl1615@gmail.com on 27 Oct 2009 at 11:05