You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Ma...@equifax.com on 2006/10/09 16:46:45 UTC

Proposed changes in JCS cache to shutdown gracefully




Aaron, all,

Here is my proposal of what needs to be changed in JCS cache to gracefully
handle remote cache shutdown when using TCP lateral cache & UDP Discovery
mechanism.

Issue:
When shutting down one JVM, all other JVMs start reporting lateral cache
errors because they cannot connect to the cache that was just shut down.

Proposed solution:
- add a new message type to UDPDiscoveryMessage.java:
    /*
     * Added to handle graceful shutdowns of remote caches
     */
    public static final int SHUTDOWN_BROADCAST = 2;

- modify UDPDiscoveryService to send this message when instance is shutting
down (in the ShutdownObserver#shutdown() method)
- modify code to handle shutdown messages correctly (remove
LateralCacheNoWait from noWaits in the LateralCacheNoWaitFacade)

Attached is source code of all files that I had to modify to get this to
work:
(See attached file: LateralCacheNoWaitFacade.java)
(
added   public boolean removeNoWait( LateralCacheNoWait noWait ) method
)

(See attached file: LateralTCPCacheManager.java)
(
added   public static LateralTCPCacheManager removeInstance(
ITCPLateralCacheAttributes lca, ICompositeCacheManager cacheMgr ) method,
)

(See attached file: UDPDiscoveryMessage.java)
(
added new message type:
    /*
     * Added to handle graceful shutdowns of remote caches
     */
    public static final int SHUTDOWN_BROADCAST = 2;
)

(See attached file: UDPDiscoveryService.java)
(
modified the   public void shutdown() method,
added   protected void serviceShutdownBroadcast() method,
added   protected void removeNoWait( LateralCacheNoWait noWait )
)
(See attached file: UDPDiscoverySender.java)
(
added   public void shutdownBroadcast( String host, int port, ArrayList
cacheNames ) throws IOException method
)

(See attached file: UDPDiscoveryReceiver.java)
(
modified         public void run() method of MessageHandler
)

Is there any way I can get these changes incorporated into "official" JCS
cache source code?

Thanks,

Marek Cyzio
Equifax
(770)740-6610
Marek.Cyzio@equifax.com



This message contains information from Equifax Inc. which may be
confidential and privileged.  If you are not an intended recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited.  If you have
received this transmission in error, please notify by e-mail
postmaster@equifax.com.