asmuts 2005/06/10 17:29:43
Modified: src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery
UDPDiscoveryService.java UDPDiscoverySender.java
UDPDiscoveryReceiver.java
Log:
We need to wait a bit longer before ending support for 1.3.
I removed the isClosed check that made this 1.4 dependent.
The jars will be 1.3 compatible again.
Revision Changes Path
1.4 +19 -3
jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java
Index: UDPDiscoveryService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- UDPDiscoveryService.java 6 Jun 2005 14:10:27 -0000 1.3
+++ UDPDiscoveryService.java 11 Jun 2005 00:29:43 -0000 1.4
@@ -61,7 +61,7 @@
//LateralCacheNoWaitFacade facade,
//this.facade = facade;
- this.lca = lca;
+ this.setLca( lca );
try
{
@@ -185,9 +185,9 @@
{
// create this connection each time.
// more robust
- sender = new UDPDiscoverySender( lca.getUdpDiscoveryAddr(),
lca.getUdpDiscoveryPort() );
+ sender = new UDPDiscoverySender( getLca().getUdpDiscoveryAddr(),
getLca().getUdpDiscoveryPort() );
- sender.passiveBroadcast( hostAddress, lca.getTcpListenerPort(),
this.getCacheNames() );
+ sender.passiveBroadcast( hostAddress,
getLca().getTcpListenerPort(), this.getCacheNames() );
// todo we should consider sending a request broadcast every so
// often.
@@ -237,6 +237,22 @@
}
/**
+ * @param lca The lca to set.
+ */
+ public void setLca( LateralCacheAttributes lca )
+ {
+ this.lca = lca;
+ }
+
+ /**
+ * @return Returns the lca.
+ */
+ public LateralCacheAttributes getLca()
+ {
+ return lca;
+ }
+
+ /**
* Allows us to set the daemon status on the clockdaemon
*
* @author aaronsm
1.3 +8 -5
jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java
Index: UDPDiscoverySender.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoverySender.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UDPDiscoverySender.java 6 Jun 2005 14:10:35 -0000 1.2
+++ UDPDiscoverySender.java 11 Jun 2005 00:29:43 -0000 1.3
@@ -85,7 +85,9 @@
{
try
{
- if ( this.m_localSocket != null &&
!this.m_localSocket.isClosed() )
+ // TODO when we move to jdk 1.4 reinstate the isClosed check
+ if ( this.m_localSocket != null )
+ //&& !this.m_localSocket.isClosed() )
{
this.m_localSocket.close();
}
@@ -120,10 +122,11 @@
throw new IOException( "Socket is null, cannot send message." );
}
- if (this.m_localSocket.isClosed() )
- {
- throw new IOException( "Socket is closed, cannot send message."
);
- }
+ // TODO when we move to jdk 1.4 reinstate the isClosed check
+ //if (this.m_localSocket.isClosed() )
+ //{
+ // throw new IOException( "Socket is closed, cannot send
message." );
+ //}
if ( log.isDebugEnabled() )
{
1.3 +13 -4
jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java
Index: UDPDiscoveryReceiver.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryReceiver.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UDPDiscoveryReceiver.java 4 Jun 2005 02:01:53 -0000 1.2
+++ UDPDiscoveryReceiver.java 11 Jun 2005 00:29:43 -0000 1.3
@@ -284,10 +284,19 @@
{
// get a cache and add it to the no waits
// the add method should not add the same.
- LateralCacheAttributes lac = new
LateralCacheAttributes();
- lac.setTransmissionType( LateralCacheAttributes.TCP );
- lac.setTcpServer( message.getHost() + ":" +
message.getPort() );
- LateralCacheManager lcm =
LateralCacheManager.getInstance( lac );
+ // we need the listener port from the original config.
+ LateralCacheAttributes lca = null;
+ if ( service.getLca() != null )
+ {
+ lca = (LateralCacheAttributes)
service.getLca().copy();
+ }
+ else
+ {
+ lca = new LateralCacheAttributes();
+ }
+ lca.setTransmissionType( LateralCacheAttributes.TCP );
+ lca.setTcpServer( message.getHost() + ":" +
message.getPort() );
+ LateralCacheManager lcm =
LateralCacheManager.getInstance( lca );
ArrayList regions = message.getCacheNames();
if ( regions != null )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]