Mercurial > hg > FederatedLinda
changeset 93:a1d796c0e975 fuchita
Wait Read Tester
author | one |
---|---|
date | Tue, 25 May 2010 22:57:54 +0900 |
parents | 226c97efb693 |
children | d962eecaf9f5 |
files | src/fdl/FederatedLinda.java src/fdl/MetaLinda.java src/fdl/PSXLinda.java src/fdl/PSXLindaImpl.java src/fdl/test/TestPSXLinda.java |
diffstat | 5 files changed, 33 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fdl/FederatedLinda.java Sun Dec 20 11:44:21 2009 +0900 +++ b/src/fdl/FederatedLinda.java Tue May 25 22:57:54 2010 +0900 @@ -184,6 +184,10 @@ if (level==Level.SEVERE) new IOException().setStackTrace(null); } + + public void wakeup() { + selector.wakeup(); + } } /* end */
--- a/src/fdl/MetaLinda.java Sun Dec 20 11:44:21 2009 +0900 +++ b/src/fdl/MetaLinda.java Tue May 25 22:57:54 2010 +0900 @@ -126,6 +126,10 @@ } return 0; } + + public void wakeup() { + fdl.wakeup(); + } public void send(ByteBuffer command, ByteBuffer data) { } @@ -133,6 +137,16 @@ public void setTupleSpaceHook(IOHandlerHook hook) { ts.hook = hook; } + + public void waitRd(int id, PSXCallback callback) { + MetaReply r = new MetaReply(PSX.PSX_WAIT_RD,id,ts,callback); + addReply(r); + } + + public PSXReply waitRd(int id) { + MetaReply r = new MetaReply(PSX.PSX_WAIT_RD,id,ts); + return r; + } }
--- a/src/fdl/PSXLinda.java Sun Dec 20 11:44:21 2009 +0900 +++ b/src/fdl/PSXLinda.java Tue May 25 22:57:54 2010 +0900 @@ -31,4 +31,8 @@ public int sync(long mtime) throws IOException ; public void send(ByteBuffer command, ByteBuffer data); + + public void waitRd(int i, PSXCallback callback); + + public PSXReply waitRd(int i); }
--- a/src/fdl/PSXLindaImpl.java Sun Dec 20 11:44:21 2009 +0900 +++ b/src/fdl/PSXLindaImpl.java Tue May 25 22:57:54 2010 +0900 @@ -183,6 +183,15 @@ } + public PSXReply waitRd(int id) { + PSXReply r = fdl.psx_queue(this, id, null, PSX.PSX_WAIT_RD, null); + return r; + } + + public void waitRd(int id, PSXCallback callback) { + fdl.psx_queue(this, id, null, PSX.PSX_WAIT_RD, callback); + } + }
--- a/src/fdl/test/TestPSXLinda.java Sun Dec 20 11:44:21 2009 +0900 +++ b/src/fdl/test/TestPSXLinda.java Tue May 25 22:57:54 2010 +0900 @@ -84,11 +84,10 @@ } } - public static void print_id (PSXReply ans) { + public static void print_id (PSXReply ans) throws IOException { ByteBuffer r = ans.getData(); - id = r.getShort(); System.out.print("ID = "); - System.out.println(id); + System.out.write(r.array()); } }