hey again,
my apoligies.... I've just found the hashtable demo, which seems to have
solved my problems.
I wouldn't mind if anyone wanted to give me a pointer on the protocols
though..
cheers
dim
Dmitri.Colebatch@... on 20/11/2003 12:23:31
PM
Sent by: javagroups-users-admin@...
To: javagroups-users@...
cc:
Subject: [javagroups-users] newbie question: protocols, and use of
DistributedHashtable
hey all,
firstly, this is a newbie post, although I have read all the doco I can
find. I imagine much of my uncertaintly comes from an unfamiliarity with
the underlying protocol patterns. the reason I'm looking at javagroups is
to come up with a replicated set of properties for our applications. we
are running in WL8.1 clustered, but BEA provides sfa in terms of changing
the configuration of our applications dynamically. what we currently have
is a Param class that contains properties on a project-by-project basis. I
think that changing this class to use DistributedHashtable instead of
HashMaps will provide the solution I am after.
However, my early prototyping has me confused. What I have so far is a
simple test class (see below) that I am curently running multiple instances
of for testing. What I see at the moment is that not all instances of my
test program (all running on a single windows xp box atm) keep the same
state. For instance, if I have two isntances - A and B (started 30 seconds
after A). In A, I can set foo bar, which works as expected (ie - I can see
foo=bar in B as well). But if I try the reverse, eg set bar foo in B, then
I dont see the result in A.
Couple of things of note, I've tried
String props
= "UDP(mcast_addr=228.1.2.3;mcast_port=45566;ip_ttl=32):" +
"PING(timeout=3000;num_initial_members=6):" +
"FD(timeout=5000):" +
"VERIFY_SUSPECT(timeout=1500):" +
// "pbcast.STABLE(desired_avg_gossip=10000):" +
"pbcast.NAKACK(gc_lag=10;retransmit_timeout=3000):" +
"UNICAST(timeout=5000):" + //;min_wait_time=2000
"FRAG:" +
"pbcast.GMS(join_timeout=5000;" + //initial_mbrs_timeout=4000;
"join_retry_timeout=2000;shun=false;print_local_addr=false)";
(from the user guide) as a parameter to the JChannel constructor. same
result.
The Mcast tests
(http://www.jgroups.org/javagroupsnew/docs/newuser/node15.html) work fine,
so I'm a bit confused as to where my problem lies. I assume that its
something to do with my protocol stack, which comes back to the first part
of the subject - could someone point me at some general docs/books on how
the various elements of the protocol stack are fitting together in the
above? Having not done a comp sci degree I fail miserably at things like
this...
cheers
dim
my test code:
public class Test2
{
private final BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
public static void main(String[] args) throws Exception
{
new Test2().run();
}
void run()
throws Exception
{
JChannel channel = new JChannel();
channel.connect("log-monitor");
DistributedHashtable map = new DistributedHashtable(channel,
0);
String cmd;
while ((cmd = nextCmd()) != null && cmd.trim().length() > 0 &&
!cmd.equals("exit"))
{
StringTokenizer tokenizer = new StringTokenizer(cmd);
String[] tokens = new String[tokenizer.countTokens()];
for (int i=0; tokenizer.hasMoreTokens(); i++)
{
tokens[i] = tokenizer.nextToken();
}
if (tokens[0].equals("set"))
{
if (tokens.length < 3)
{
System.out.println("Syntax: set com.foo
FINER");
continue;
}
map.put(tokens[1], tokens[2]);
System.out.println("Updated " + tokens[1] + " to "
+ tokens[2] + " locally.");
}
else if (tokens[0].equals("show"))
{
if (tokens.length == 1)
{
for (Iterator iterator =
map.keySet().iterator(); iterator.hasNext();)
{
String key = (String) iterator.next();
String value = (String) map.get(key);
System.out.println(key + " = " +
value);
}
}
else
{
System.out.println(tokens[1] + " = " +
map.get(tokens[1]));
}
}
else
{
System.out.println("Command '" + tokens[0] + "' not
known.");
}
}
channel.close();
}
String nextCmd()
throws Exception
{
System.out.print("> ");
return in.readLine();
}
}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
javagroups-users mailing list
javagroups-users@...
https://lists.sourceforge.net/lists/listinfo/javagroups-users
|