Interesting. I was just about to create a config
option, where you can specify a port range. I run
multiple different Tomcat instances on the same boxes,
each running different sets of services. I have to
keep it clear which application will be using which
lateral ports. If I could specify a range of ports,
the cache could just figure it out for itself. . .
--- [EMAIL PROTECTED] wrote:
>
>
>
>
> > You still need to define a TCPListenerPort. If
> both
> > of your servers are on the same machine, then this
> > port must be different on each
>
> I did something like that:
>
> int listenerPort = props.get( Integer.parseInt(
>
"jcs.auxiliary.TCPIPCACHE.attributes.TcpListenerPort"
> ) );
> for( int i = 0; i < MAX_JVMS; i++ )
> {
> int offset = new Random().nextInt( MAX_JVMS );
> try
> {
> ServerSocket socket = new ServerSocket(
> listenerPort + offset );
> socket.close();
> listenerPort += offset;
> LOGGER.debug( "JCS TCP Lateral cache will
> use listening socket " +
> listenerPort );
> break;
> }
> catch( BindException e )
> {
> LOGGER.debug( "Socket " + ( listenerPort +
> offset ) + " is in use,
> will try another one" );
> Thread.yield();
> }
> catch( IOException e )
> {
> LOGGER.fatal( "Cannot bind on socket " + (
> listenerPort + offset ),
> e );
> }
> }
>
> props.put(
>
"jcs.auxiliary.TCPIPCACHE.attributes.TcpListenerPort",
> new
> Integer( listenerPort ).toString() );
>
> It is not perfect (has racing and starvation
> issues), but if you start one
> JVM at the time, it works pretty well...
>
> P.S. That explains why I use CompositeCacheManager
> and CacheAccess instead
> of JSC cache directly :)
>
> Marek Cyzio
> Equifax
> (770)740-6610
> [EMAIL PROTECTED]
>
>
>
>
> Aaron Smuts
>
> <[EMAIL PROTECTED]
>
> >
> To
> JCS Users
> List
> 06/27/2006 08:35
> <[email protected]>
> AM
> cc
>
>
>
> Subject
> Please respond to Re: Lateral
> TCP Cache - UDP
> "JCS Users List" discovery
> configuration
> <[EMAIL PROTECTED]
>
> a.apache.org>
>
>
>
>
>
>
>
>
>
>
>
>
>
> UDP discovery is documented here:
>
http://jakarta.apache.org/jcs/LateralUDPDiscovery.html
>
> With UDP discovery you don't have to specify the
> servers to connect to; instead, they find each other
> using the udp discovery port and address. All
> servers
> that you want to be able to find ech other should be
> configured to use the same discovery address and
> port.
>
> You still need to define a TCPListenerPort. If both
> of your servers are on the same machine, then this
> port must be different on each.
>
> Basically, they learn about each other by UDP. Then
> when they find each other they connect to each other
> on the tcp listener port.
>
> Aaron
>
>
> --- emily chen <[EMAIL PROTECTED]> wrote:
>
> > Hi Aaron,
> >
> > I found an example that you post in the mail
> list:
> >
>
http://mail-archives.apache.org/mod_mbox/jakarta-jcs-users/200606.mbox/[EMAIL
PROTECTED]
>
> >
> > But I don't know how do I config the following
> > attributes of Lateral UDP Discovery if I have two
> > Tomcat servers runing in my PC:
> >
> >
> >
>
jcs.auxiliary.LTCPAIR.attributes.TcpListenerPort=1118
> >
>
jcs.auxiliary.LTCPAIR.attributes.UdpDiscoveryAddr=228.5.6.1
> >
>
jcs.auxiliary.LTCPAIR.attributes.UdpDiscoveryPort=6773
> >
>
jcs.auxiliary.LTCPAIR.attributes.UdpDiscoveryEnabled=true
> > jcs.auxiliary.LTCPAIR.attributes.Receive=true
> > jcs.auxiliary.LTCPAIR.attributes.AllowGet=false
> >
>
jcs.auxiliary.LTCPAIR.attributes.IssueRemoveOnPut=false
> >
>
jcs.auxiliary.LTCPAIR.attributes.FilterRemoveByHashCode=true
> >
> >
> > Thanks for your help.
> >
> > Emily
> >
> >
> >
> >
> > Aaron Smuts <[EMAIL PROTECTED]> wrote:
> > Please think a bit about what the configuration
> is
> > supposed to accomplish, and the problem should be
> > clear. You tell one client where to find the
> others
> > in the "TcpServers" setting. The "TcpListenerPort"
> > is
> > the port at which this client listens.
> >
> > If server 2 is listening to port 1111, the server
> 1
> > should be configured like this:
> >
> >
>
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
> >
> > jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
> >
> > And server 2 should be configured like this:
> >
> >
>
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1110
> > jcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
> >
> > I'd recommend using UDP discovery, which greatly
> > simplfies these issues.
> >
> > Cheers,
> >
> > Aaron
> >
> > --- emily chen wrote:
> >
> > > Hi Aaron,
> > >
> > > I did a testing, used different port in
> cache.ccf
> > > file, and still got the same error:
> > >
> > > cache.ccf for web applicaton in Tomcat1:
>
=== message truncated ===
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]