[Jstyx-users] question about CStyx.openOrCreate()
Status: Beta
Brought to you by:
jonblower
From: Tianchao Li <li...@in...> - 2006-05-11 16:46:18
|
Hi, I have some problem with the correct usage of CStyx.openOrCreate() method. I have started the following server: import java.io.IOException; import uk.ac.rdg.resc.jstyx.StyxException; import uk.ac.rdg.resc.jstyx.server.DirectoryOnDisk; import uk.ac.rdg.resc.jstyx.server.StyxDirectory; import uk.ac.rdg.resc.jstyx.server.StyxServer; public class TestStyxServer { /** * @param args */ public static void main(String[] args) { StyxDirectory root; try { root = new StyxDirectory("/"); DirectoryOnDisk file = new DirectoryOnDisk("/home/lit/styxfilesystem"); root.addChild(file); new StyxServer(9876, root).start(); } catch (StyxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } and the following client: import uk.ac.rdg.resc.jstyx.StyxException; import uk.ac.rdg.resc.jstyx.StyxUtils; import uk.ac.rdg.resc.jstyx.client.CStyxFile; import uk.ac.rdg.resc.jstyx.client.StyxConnection; public class TestStyxClient { /** * @param args */ public static void main(String[] args) { StyxConnection conn = new StyxConnection("localhost", 9876); try { conn.connect(); CStyxFile file = conn.getFile("/styxfilesystem/test.txt"); file.openOrCreate(true, StyxUtils.OWRITE); System.out.println(file.getURL()); } catch (StyxException se) { se.printStackTrace(); } finally { conn.close(); } } } The client is blocked at file.openOrCreate(). Or more exactly, the callback.getReply() never returns. public void openOrCreate(boolean isDirectory, int mode) throws StyxException { StyxReplyCallback callback = new StyxReplyCallback(); this.openOrCreateAsync(isDirectory, mode, callback); // Blocks until the process is complete callback.getReply(); } Is this a bug? Regards, Tianchao Li |