Mercurial > hg > FederatedLinda
changeset 75:5b1f099da593
user id format fix
author | one |
---|---|
date | Sat, 24 Oct 2009 17:38:21 +0900 |
parents | be8bc83c001a |
children | e8b757d7d0af fce61ee25d20 |
files | examples/filesend/writer.c src/fdl/TupleSpace.java |
diffstat | 2 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/filesend/writer.c Fri Oct 23 16:47:33 2009 +0900 +++ b/examples/filesend/writer.c Sat Oct 24 17:38:21 2009 +0900 @@ -76,6 +76,8 @@ mainLoop(tspace, xml_id, fileno(stdin)); sleep(1); send_serial_id(tspace, serial); - printf("mainLoop finished\n"); + printf("send xml_id = %d, seciral = %d\n",xml_id, serial); exit(EXIT_SUCCESS); } + +/* end */
--- a/src/fdl/TupleSpace.java Fri Oct 23 16:47:33 2009 +0900 +++ b/src/fdl/TupleSpace.java Sat Oct 24 17:38:21 2009 +0900 @@ -9,7 +9,6 @@ public class TupleSpace { static final boolean debug = true; public static int user = 0; - public byte userchar[] = new byte[2]; public Tuple[] tuple_space; public IOHandlerHook hook = new NullIOHandlerHook(); private FDLindaServ fds; @@ -37,11 +36,16 @@ user++; - ByteBuffer data = ByteBuffer.allocate(2); - userchar[0] = (byte) (user/10 + '0'); - userchar[1] = (byte) (user%10 + '0'); - data.put(userchar[0]); - data.put(userchar[1]); + ByteBuffer data = ByteBuffer.allocate(10); + ByteBuffer r = ByteBuffer.allocate(10); + int value = user; + while(value>0) { + r.put((byte) (value%10 + '0')); + value /= 10; + } + for(int i=r.position()-1;i>=0;i--) { + data.put(r.get(i)); + } data.flip(); int id = TupleSpace.MAX_TUPLE_ID-1;